appium_lib_core 5.7.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdc105db151bc415072c5c693ec951a14ea681762f686be52941b89d48eb879c
4
- data.tar.gz: 74ae58624c62216572e321b22386b530f3271ffeeba15b9e25764b9ffda5328d
3
+ metadata.gz: e147792f868660dca695a4e5bf9c31753f68515f5cd5b5bb66e4150028d7e1b4
4
+ data.tar.gz: 27b0afff682d0630df7a2e8d1e2ab5bc187b63049dce918b7f4cdc2a7868fd1a
5
5
  SHA512:
6
- metadata.gz: 0a52ad3c06dc494049be9c72cf7e74fea74ad005b4c45bc87ae308e3b27e180f0488c0a9e967e16992031d5282f637bba35b5aa80235ece79d1307e9e05ca120
7
- data.tar.gz: 160ec09d1c7f1205ade5e17fab276a3e68f10250b7c3ff84a5984b9fd875a7d74238fc5cc7bb2c6c960ccf581993b642718fba6b7f8731df2e74e1d676c0f2ae
6
+ metadata.gz: a3711c2f4ad056cc0278d1c7dfc174a6c5ebe87b7f772933f8a8d96dbfd3c9648c9aafc314e0f4e5854f01cd65ae066c7024e6519f4d4678d1c7fc5e48d80eb4
7
+ data.tar.gz: fb870f142226ee8ceadffd6962d028bd9b557fc8380972c12f138123181a95dc8e8887006365154e00372dbebd0f60a196b6965d6fff81060979519718412b1d
data/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [6.0.0] - 2022-12-25
14
+ - Remove iOS/UiAutomation classes
15
+ - The version may work for iOS 8. XCUITest driver will be the default behavior for iOS.
16
+
17
+ ## [5.8.0] - 2022-12-11
18
+
19
+ ### Enhancements
20
+ - Add `::Appium::Core::Driver#attach_to` to generate a driver instance which has the given session id.
21
+ - The primary usage is for debugging to attach to an existing session.
22
+
13
23
  ## [5.7.0] - 2022-12-02
14
24
 
15
25
  ### Enhancements
data/README.md CHANGED
@@ -32,6 +32,13 @@ $ bundle install
32
32
  $ bundle exec parallel_test test/unit/
33
33
  ```
34
34
 
35
+ or
36
+
37
+ ```bash
38
+ $ bundle install
39
+ $ bundle exec rake test:unit
40
+ ```
41
+
35
42
  ### Functional Tests
36
43
  Run functional tests which require the Appium server and real device, Simulator/Emulator.
37
44
 
@@ -104,11 +111,11 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
104
111
 
105
112
  opts = {
106
113
  capabilities: { # Append capabilities
107
- platformName: :ios,
114
+ platformName: 'ios',
108
115
  platformVersion: '11.0',
109
116
  deviceName: 'iPhone Simulator',
110
- automationName: 'XCUITest',
111
- app: '/path/to/MyiOS.app'
117
+ # app: '/path/to/MyiOS.app', # Without 'app' capability, an appium session starts with the home screen
118
+ automationName: 'XCUITest'
112
119
  },
113
120
  appium_lib: {
114
121
  wait: 30
@@ -133,6 +140,15 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
133
140
 
134
141
  More examples are in [test/functional](test/functional)
135
142
 
143
+ As of version 5.8.0, the client can attach to an existing session. The main purpose is for debugging.
144
+
145
+ ```ruby
146
+ # @driver is the driver instance of an existing session
147
+ attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'XCUITest', platform_name: 'ios'
148
+ assert attached_driver.session_id == @driver.session_id
149
+ attached_driver.page_source
150
+ ```
151
+
136
152
  ### Capabilities
137
153
 
138
154
  Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'appium_lib_core/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.required_ruby_version = '>= 2.7'
7
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7')
8
8
 
9
9
  spec.name = 'appium_lib_core'
10
10
  spec.version = Appium::Core::VERSION
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'minitest', '~> 5.0'
31
31
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
32
32
  spec.add_development_dependency 'webmock', '~> 3.18.1'
33
- spec.add_development_dependency 'rubocop', '1.39.0'
33
+ spec.add_development_dependency 'rubocop', '1.41.1'
34
34
  spec.add_development_dependency 'appium_thor', '~> 1.0'
35
35
  spec.add_development_dependency 'parallel_tests'
36
36
  spec.add_development_dependency 'simplecov'
@@ -43,13 +43,39 @@ module Appium
43
43
 
44
44
  def browser
45
45
  @browser ||= begin
46
- name = @capabilities.browser_name
46
+ name = @capabilities&.browser_name
47
47
  name ? name.tr(' ', '_').downcase.to_sym : 'unknown'
48
48
  rescue KeyError
49
49
  APPIUM_NATIVE_BROWSER_NAME
50
50
  end
51
51
  end
52
52
 
53
+ # Appium only.
54
+ # Attach to an existing session.
55
+ #
56
+ # @param [String] The session id to attach to.
57
+ # @param [String] platform_name The platform name to keep in the dummy capabilities
58
+ # @param [String] platform_name The automation name to keep in the dummy capabilities
59
+ # @return [::Appium::Core::Base::Capabilities]
60
+ #
61
+ # @example
62
+ #
63
+ # new_driver = ::Appium::Core::Driver.attach_to(
64
+ # driver.session_id,
65
+ # url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
66
+ # )
67
+ #
68
+ def attach_to(session_id, platform_name, automation_name)
69
+ @available_commands = ::Appium::Core::Commands::COMMANDS.dup
70
+ @session_id = session_id
71
+
72
+ # generate a dummy capabilities instance which only has the given platformName and automationName
73
+ @capabilities = ::Appium::Core::Base::Capabilities.new(
74
+ 'platformName' => platform_name,
75
+ 'automationName' => automation_name
76
+ )
77
+ end
78
+
53
79
  # Override
54
80
  # Creates session handling.
55
81
  #
@@ -185,11 +211,6 @@ module Appium
185
211
  ::Appium::Core::Base::Capabilities.json_create execute(:get_capabilities)
186
212
  end
187
213
 
188
- # Override for safe. Newer ruby selenium webdriver already has the same code
189
- def page_source
190
- execute :get_page_source
191
- end
192
-
193
214
  # For Appium
194
215
  # override
195
216
  def element_displayed?(element)
@@ -203,7 +224,8 @@ module Appium
203
224
  # override
204
225
  def element_attribute(element, name)
205
226
  # For W3C in Selenium Client
206
- # execute_atom :getAttribute, element, name
227
+ # execute_atom :getAttribute, element, name.
228
+ # 'dom_attribute' in the WebDriver Selenium.
207
229
  execute :get_element_attribute, id: element.id, name: name
208
230
  end
209
231
 
@@ -51,10 +51,6 @@ module Appium
51
51
  @wait_timeout = opts.delete(:wait_timeout)
52
52
  @wait_interval = opts.delete(:wait_interval)
53
53
 
54
- # For logging.
55
- # TODO: Remove when appium core no longer uses this in this bridge.
56
- @automation_name = opts.delete(:automation_name)
57
-
58
54
  super
59
55
  end
60
56
 
@@ -63,13 +59,26 @@ module Appium
63
59
  # @return [::Appium::Core::Base::Bridge]
64
60
  #
65
61
  def create_bridge(**opts)
62
+ # for a new session request
66
63
  capabilities = opts.delete(:capabilities)
67
64
  bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }
65
+
66
+ # for attaching to an existing session
67
+ session_id = opts.delete(:existing_session_id)
68
+ automation_name = opts.delete(:automation_name)
69
+ platform_name = opts.delete(:platform_name)
70
+
68
71
  raise ::Appium::Core::Error::ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
69
72
 
70
73
  bridge = ::Appium::Core::Base::Bridge.new(**bridge_opts)
71
74
 
72
- bridge.create_session(capabilities)
75
+ if session_id.nil?
76
+ bridge.create_session(capabilities)
77
+ else
78
+ # attach to the existing session id
79
+ bridge.attach_to(session_id, platform_name, automation_name)
80
+ end
81
+
73
82
  bridge
74
83
  end
75
84
 
@@ -566,12 +575,6 @@ module Appium
566
575
  # @driver.launch_app
567
576
  #
568
577
  def launch_app
569
- # TODO: Define only in Windows module when ruby_lib_core removes this method
570
- if @automation_name != :windows
571
- ::Appium::Logger.warn(
572
- '[DEPRECATION] launch_app is deprecated. Please use activate_app instead.'
573
- )
574
- end
575
578
  @bridge.launch_app
576
579
  end
577
580
 
@@ -583,12 +586,6 @@ module Appium
583
586
  # @driver.close_app
584
587
  #
585
588
  def close_app
586
- # TODO: Define only in Windows module when ruby_lib_core removes this method
587
- if @automation_name != :windows
588
- ::Appium::Logger.warn(
589
- '[DEPRECATION] close_app is deprecated. Please use terminate_app instead.'
590
- )
591
- end
592
589
  @bridge.close_app
593
590
  end
594
591
 
@@ -28,7 +28,6 @@ module Appium
28
28
  data_matcher: '-android datamatcher', # Available in Espresso
29
29
  view_matcher: '-android viewmatcher', # Available in Espresso
30
30
  # iOS
31
- uiautomation: '-ios uiautomation',
32
31
  predicate: '-ios predicate string',
33
32
  class_chain: '-ios class chain',
34
33
  # Windows with windows prefix
@@ -70,11 +70,15 @@ module Appium
70
70
  find_elements: [:post, 'session/:session_id/elements'],
71
71
  find_child_element: [:post, 'session/:session_id/element/:id/element'],
72
72
  find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
73
+ find_shadow_child_element: [:post, 'session/:session_id/shadow/:id/element'],
74
+ find_shadow_child_elements: [:post, 'session/:session_id/shadow/:id/elements'],
73
75
  get_active_element: [:get, 'session/:session_id/element/active'],
74
76
  is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
75
77
  get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
76
78
  get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
77
79
  get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
80
+ get_element_aria_role: [:get, 'session/:session_id/element/:id/computedrole'],
81
+ get_element_aria_label: [:get, 'session/:session_id/element/:id/computedlabel'],
78
82
  get_element_text: [:get, 'session/:session_id/element/:id/text'],
79
83
  get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
80
84
  get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
@@ -18,10 +18,16 @@ module Appium
18
18
  module Device
19
19
  module AppManagement
20
20
  def launch_app
21
+ ::Appium::Logger.warn(
22
+ '[DEPRECATION] launch_app is deprecated. Please use activate_app instead.'
23
+ )
21
24
  execute :launch_app
22
25
  end
23
26
 
24
27
  def close_app
28
+ ::Appium::Logger.warn(
29
+ '[DEPRECATION] close_app is deprecated. Please use terminate_app instead.'
30
+ )
25
31
  execute :close_app
26
32
  end
27
33
 
@@ -23,7 +23,6 @@ module Appium
23
23
  end
24
24
 
25
25
  module Ios
26
- autoload :Uiautomation, 'appium_lib_core/ios'
27
26
  autoload :Xcuitest, 'appium_lib_core/ios_xcuitest'
28
27
  end
29
28
 
@@ -275,7 +274,40 @@ module Appium
275
274
  # @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub.com'
276
275
  #
277
276
  def self.for(opts = {})
278
- new(opts)
277
+ new.setup_for_new_session(opts)
278
+ end
279
+
280
+ # Attach to an existing session. The main usage of this method is to attach to
281
+ # an existing session for debugging. The generated driver instance has the capabilities which
282
+ # has the given automationName and platformName only since the W3C WebDriver spec does not provide
283
+ # an endpoint to get running session's capabilities.
284
+ #
285
+ #
286
+ # @param [String] The session id to attach to.
287
+ # @param [String] url The WebDriver URL to attach to with the session_id.
288
+ # @param [String] automation_name The platform name to keep in the dummy capabilities
289
+ # @param [String] platform_name The automation name to keep in the dummy capabilities
290
+ # @return [Selenium::WebDriver] A new driver instance with the given session id.
291
+ #
292
+ # @example
293
+ #
294
+ # new_driver = ::Appium::Core::Driver.attach_to(
295
+ # driver.session_id, # The 'driver' has an existing session id
296
+ # url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
297
+ # )
298
+ # new_driver.page_source # for example
299
+ #
300
+ def self.attach_to(
301
+ session_id, url: nil, automation_name: nil, platform_name: nil,
302
+ http_client_ops: { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 }
303
+ )
304
+ new.attach_to(
305
+ session_id,
306
+ automation_name: automation_name,
307
+ platform_name: platform_name,
308
+ url: url,
309
+ http_client_ops: http_client_ops
310
+ )
279
311
  end
280
312
 
281
313
  private
@@ -286,12 +318,18 @@ module Appium
286
318
  @delegate_target
287
319
  end
288
320
 
289
- public
290
-
291
321
  # @private
292
- def initialize(opts = {})
322
+ def initialize
293
323
  @delegate_target = self # for testing purpose
294
324
  @automation_name = nil # initialise before 'set_automation_name'
325
+ end
326
+
327
+ public
328
+
329
+ # @private
330
+ # Set up for a new session
331
+ def setup_for_new_session(opts = {})
332
+ @custom_url = opts.delete :url # to set the custom url as :url
295
333
 
296
334
  # TODO: Remove when we implement Options
297
335
  # The symbolize_keys is to keep compatiility for the legacy code, which allows capabilities to give 'string' as the key.
@@ -299,7 +337,6 @@ module Appium
299
337
  # FIXME: First, please try to remove `nested: true` to `nested: false`.
300
338
  opts = Appium.symbolize_keys(opts, nested: true)
301
339
 
302
- @custom_url = opts.delete :url
303
340
  @caps = get_caps(opts)
304
341
 
305
342
  set_appium_lib_specific_values(get_appium_lib_opts(opts))
@@ -308,8 +345,7 @@ module Appium
308
345
  set_automation_name
309
346
 
310
347
  extend_for(device: @device, automation_name: @automation_name)
311
-
312
- self # rubocop:disable Lint/Void
348
+ self
313
349
  end
314
350
 
315
351
  # Creates a new global driver and quits the old one if it exists.
@@ -320,7 +356,7 @@ module Appium
320
356
  # @option http_client_ops [Hash] :http_client Custom HTTP Client
321
357
  # @option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
322
358
  # @option http_client_ops [Hash] :read_timeout Custom read timeout for http client.
323
- # @return [Selenium::WebDriver] the new global driver
359
+ # @return [Selenium::WebDriver] A new driver instance
324
360
  #
325
361
  # @example
326
362
  #
@@ -377,8 +413,7 @@ module Appium
377
413
  capabilities: @caps, # ::Appium::Core::Base::Capabilities
378
414
  url: @custom_url,
379
415
  wait_timeout: @wait_timeout,
380
- wait_interval: @wait_interval,
381
- automation_name: @automation_name)
416
+ wait_interval: @wait_interval)
382
417
 
383
418
  if @direct_connect
384
419
  d_c = DirectConnections.new(@driver.capabilities)
@@ -396,6 +431,8 @@ module Appium
396
431
  @http_client.additional_headers.delete Appium::Core::Base::Http::RequestHeaders::KEYS[:idempotency]
397
432
  end
398
433
 
434
+ # TODO: this method can be removed after releasing Appium 2.0, and after a while
435
+ # since Appium 2.0 reuqires 'automationName'. This method won't help anymore then.
399
436
  # If "automationName" is set only server side, this method set "automationName" attribute into @automation_name.
400
437
  # Since @automation_name is set only client side before start_driver is called.
401
438
  set_automation_name_if_nil
@@ -405,7 +442,47 @@ module Appium
405
442
  @driver
406
443
  end
407
444
 
408
- private
445
+ # @private
446
+ # Attach to an existing session
447
+ def attach_to(session_id, url: nil, automation_name: nil, platform_name: nil,
448
+ http_client_ops: { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 })
449
+
450
+ raise ::Appium::Core::Error::ArgumentError, 'The :url must not be nil' if url.nil?
451
+ raise ::Appium::Core::Error::ArgumentError, 'The :automation_name must not be nil' if automation_name.nil?
452
+ raise ::Appium::Core::Error::ArgumentError, 'The :platform_name must not be nil' if platform_name.nil?
453
+
454
+ @custom_url = url
455
+
456
+ # use lowercase internally
457
+ @automation_name = convert_downcase(automation_name)
458
+ @device = convert_downcase(platform_name)
459
+
460
+ extend_for(device: @device, automation_name: @automation_name)
461
+
462
+ @http_client = get_http_client http_client: http_client_ops.delete(:http_client),
463
+ open_timeout: http_client_ops.delete(:open_timeout),
464
+ read_timeout: http_client_ops.delete(:read_timeout)
465
+
466
+ # Note that 'enable_idempotency_header' works only a new session reqeust. The attach_to method skips
467
+ # the new session request, this it does not needed.
468
+
469
+ begin
470
+ # included https://github.com/SeleniumHQ/selenium/blob/43f8b3f66e7e01124eff6a5805269ee441f65707/rb/lib/selenium/webdriver/remote/driver.rb#L29
471
+ @driver = ::Appium::Core::Base::Driver.new(http_client: @http_client,
472
+ url: @custom_url,
473
+ listener: @listener,
474
+ existing_session_id: session_id,
475
+ automation_name: automation_name,
476
+ platform_name: platform_name)
477
+
478
+ # export session
479
+ write_session_id(@driver.session_id, @export_session_path) if @export_session
480
+ rescue Errno::ECONNREFUSED
481
+ raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}?"
482
+ end
483
+
484
+ @driver
485
+ end
409
486
 
410
487
  def get_http_client(http_client: nil, open_timeout: nil, read_timeout: nil)
411
488
  client = http_client || Appium::Core::Base::Http::Default.new
@@ -431,9 +508,7 @@ module Appium
431
508
  {}
432
509
  end
433
510
 
434
- public
435
-
436
- # Quits the driver
511
+ # [Deprecated] Quits the driver. This method is the same as @driver.quit
437
512
  # @return [void]
438
513
  #
439
514
  # @example
@@ -441,6 +516,7 @@ module Appium
441
516
  # @core.quit_driver
442
517
  #
443
518
  def quit_driver
519
+ ::Appium::Logger.warn('[DEPRECATION] quit_driver will be removed. Please use @driver.quit instead.')
444
520
  @driver.quit
445
521
  rescue # rubocop:disable Style/RescueStandardError
446
522
  nil
@@ -486,6 +562,11 @@ module Appium
486
562
  # @core.platform_version #=> [10,1,1]
487
563
  #
488
564
  def platform_version
565
+ ::Appium::Logger.warn(
566
+ '[DEPRECATION] platform_version method will be. ' \
567
+ 'Please check the platformVersion via @driver.capabilities["platformVersion"] instead.'
568
+ )
569
+
489
570
  p_version = @driver.capabilities['platformVersion'] || @driver.session_capabilities['platformVersion']
490
571
  p_version.split('.').map(&:to_i)
491
572
  end
@@ -523,10 +604,8 @@ module Appium
523
604
  case sym_automation_name
524
605
  when :safari
525
606
  ::Appium::Logger.debug('SafariDriver for iOS')
526
- when :xcuitest
607
+ else # XCUITest
527
608
  ::Appium::Core::Ios::Xcuitest::Bridge.for self
528
- else # default and UIAutomation
529
- ::Appium::Core::Ios::Uiautomation::Bridge.for self
530
609
  end
531
610
  when :mac
532
611
  case sym_automation_name
@@ -626,7 +705,7 @@ module Appium
626
705
  @device = @caps[:platformName] || @caps['platformName']
627
706
  return @device unless @device
628
707
 
629
- @device = @device.is_a?(Symbol) ? @device.downcase : @device.downcase.strip.intern
708
+ @device = convert_downcase @device
630
709
  end
631
710
 
632
711
  # @private
@@ -634,9 +713,12 @@ module Appium
634
713
  # TODO: check if the Appium.symbolize_keys(opts, nested: false) enoug with this
635
714
  candidate = @caps[:automationName] || @caps['automationName']
636
715
  @automation_name = candidate if candidate
637
- @automation_name = if @automation_name
638
- @automation_name.is_a?(Symbol) ? @automation_name.downcase : @automation_name.downcase.strip.intern
639
- end
716
+ @automation_name = convert_downcase @automation_name if @automation_name
717
+ end
718
+
719
+ # @private
720
+ def convert_downcase(value)
721
+ value.is_a?(Symbol) ? value.downcase : value.downcase.strip.intern
640
722
  end
641
723
 
642
724
  # @private
@@ -650,6 +732,10 @@ module Appium
650
732
 
651
733
  # @private
652
734
  def write_session_id(session_id, export_path = '/tmp/appium_lib_session')
735
+ ::Appium::Logger.warn(
736
+ '[DEPRECATION] export_session option will be removed. ' \
737
+ 'Please save the session id by yourself with #session_id method like @driver.session_id.'
738
+ )
653
739
  export_path = export_path.tr('/', '\\') if ::Appium::Core::Base.platform.windows?
654
740
  File.write(export_path, session_id)
655
741
  rescue IOError => e
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '5.7.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2022-12-02' unless defined? ::Appium::Core::DATE
17
+ VERSION = '6.0.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2022-12-25' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -14,17 +14,25 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- module Ios
18
- module Uiautomation
19
- module Bridge
20
- def self.for(target)
21
- target.extend Appium::Core::Ios::Device
17
+ module Windows
18
+ module Device
19
+ module AppManagement
20
+ # override
21
+ def self.add_methods
22
+ ::Appium::Core::Device.add_endpoint_method(:launch_app) do
23
+ def launch_app
24
+ execute :launch_app
25
+ end
26
+ end
22
27
 
23
- Core::Ios::Uiautomation.patch_webdriver_element
24
- Core::Ios::Uiautomation::Device.add_methods
28
+ ::Appium::Core::Device.add_endpoint_method(:close_app) do
29
+ def close_app
30
+ execute :close_app
31
+ end
32
+ end
25
33
  end
26
- end
27
- end
28
- end
29
- end
30
- end
34
+ end # module AppManagement
35
+ end # module Device
36
+ end # module Windows
37
+ end # module Core
38
+ end # module Appium
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require_relative 'device/screen'
16
+ require_relative 'device/app_management'
16
17
 
17
18
  module Appium
18
19
  module Core
@@ -78,6 +79,7 @@ module Appium
78
79
  class << self
79
80
  def extended(_mod)
80
81
  Screen.add_methods
82
+ AppManagement.add_methods
81
83
  end
82
84
  end # class << self
83
85
  end # module Device
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-03 00:00:00.000000000 Z
11
+ date: 2022-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 1.39.0
123
+ version: 1.41.1
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 1.39.0
130
+ version: 1.41.1
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: appium_thor
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -247,12 +247,8 @@ files:
247
247
  - lib/appium_lib_core/device.rb
248
248
  - lib/appium_lib_core/driver.rb
249
249
  - lib/appium_lib_core/element.rb
250
- - lib/appium_lib_core/ios.rb
251
250
  - lib/appium_lib_core/ios/device.rb
252
251
  - lib/appium_lib_core/ios/device/clipboard.rb
253
- - lib/appium_lib_core/ios/uiautomation/bridge.rb
254
- - lib/appium_lib_core/ios/uiautomation/device.rb
255
- - lib/appium_lib_core/ios/uiautomation/patch.rb
256
252
  - lib/appium_lib_core/ios/xcuitest/bridge.rb
257
253
  - lib/appium_lib_core/ios/xcuitest/device.rb
258
254
  - lib/appium_lib_core/ios/xcuitest/device/battery.rb
@@ -267,12 +263,13 @@ files:
267
263
  - lib/appium_lib_core/windows.rb
268
264
  - lib/appium_lib_core/windows/bridge.rb
269
265
  - lib/appium_lib_core/windows/device.rb
266
+ - lib/appium_lib_core/windows/device/app_management.rb
270
267
  - lib/appium_lib_core/windows/device/screen.rb
271
268
  homepage: https://github.com/appium/ruby_lib_core/
272
269
  licenses:
273
270
  - Apache-2.0
274
271
  metadata: {}
275
- post_install_message:
272
+ post_install_message:
276
273
  rdoc_options: []
277
274
  require_paths:
278
275
  - lib
@@ -287,8 +284,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
284
  - !ruby/object:Gem::Version
288
285
  version: '0'
289
286
  requirements: []
290
- rubygems_version: 3.3.3
291
- signing_key:
287
+ rubygems_version: 3.2.14
288
+ signing_key:
292
289
  specification_version: 4
293
290
  summary: Minimal Ruby library for Appium.
294
291
  test_files: []
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- module Appium
16
- module Core
17
- module Ios
18
- module Uiautomation
19
- module Device
20
- def self.add_methods
21
- # UiAutomation, Override included method in bridge
22
- ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
23
- def hide_keyboard(close_key = nil, strategy = nil)
24
- option = {}
25
-
26
- option[:key] = close_key || 'Done' # default to Done key.
27
- option[:strategy] = strategy || :pressKey # default to pressKey
28
-
29
- execute :hide_keyboard, {}, option
30
- end
31
- end
32
-
33
- # UiAutomation, Override included method in bridge
34
- ::Appium::Core::Device.add_endpoint_method(:background_app) do
35
- def background_app(duration = 0)
36
- execute :background_app, {}, seconds: duration
37
- end
38
- end
39
- end
40
- end # module Device
41
- end # module Uiautomation
42
- end # module Ios
43
- end # module Core
44
- end # module Appium
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- module Appium
16
- module Core
17
- module Ios
18
- module Uiautomation
19
- # @private
20
- # class_eval inside a method because class Selenium::WebDriver::Element
21
- # will trigger as soon as the file is required. in contrast a method
22
- # will trigger only when invoked.
23
- def self.patch_webdriver_element
24
- ::Appium::Core::Element.class_eval do
25
- # Cross platform way of entering text into a textfield
26
- def type(text, driver)
27
- driver.execute_script %(au.getElement('#{ref}').setValue('#{text}');)
28
- end # def type
29
- end # Selenium::WebDriver::Element.class_eval
30
- end # def patch_webdriver_element
31
- end # module Uiautomation
32
- end # module Ios
33
- end # module Core
34
- end # module Appium
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- # loaded in common/driver.rb
16
- require_relative 'ios/device'
17
-
18
- require_relative 'ios/uiautomation/patch'
19
- require_relative 'ios/uiautomation/device'
20
- require_relative 'ios/uiautomation/bridge'