appium_lib 9.7.5 → 9.8.1

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/appium_lib.gemspec +1 -3
  4. data/contributing.md +2 -0
  5. data/docs/android_docs.md +186 -180
  6. data/docs/ios_docs.md +238 -234
  7. data/docs/ios_xcuitest.md +1 -1
  8. data/lib/appium_lib/android/common/helper.rb +0 -30
  9. data/lib/appium_lib/appium.rb +3 -4
  10. data/lib/appium_lib/common/helper.rb +0 -1
  11. data/lib/appium_lib/common/http_client.rb +1 -1
  12. data/lib/appium_lib/common/touch_actions.rb +4 -4
  13. data/lib/appium_lib/common/wait.rb +1 -1
  14. data/lib/appium_lib/driver.rb +7 -8
  15. data/lib/appium_lib/ios/common/helper.rb +1 -8
  16. data/lib/appium_lib/version.rb +2 -2
  17. data/readme.md +29 -8
  18. data/release_notes.md +6 -0
  19. metadata +5 -77
  20. data/lib/appium_lib/core/android.rb +0 -5
  21. data/lib/appium_lib/core/android/device.rb +0 -142
  22. data/lib/appium_lib/core/android/espresso/bridge.rb +0 -18
  23. data/lib/appium_lib/core/android/search_context.rb +0 -17
  24. data/lib/appium_lib/core/android/touch.rb +0 -15
  25. data/lib/appium_lib/core/android/uiautomator1/bridge.rb +0 -18
  26. data/lib/appium_lib/core/android/uiautomator2/bridge.rb +0 -18
  27. data/lib/appium_lib/core/android_espresso.rb +0 -5
  28. data/lib/appium_lib/core/android_uiautomator2.rb +0 -5
  29. data/lib/appium_lib/core/common.rb +0 -6
  30. data/lib/appium_lib/core/common/base.rb +0 -8
  31. data/lib/appium_lib/core/common/base/bridge.rb +0 -47
  32. data/lib/appium_lib/core/common/base/capabilities.rb +0 -16
  33. data/lib/appium_lib/core/common/base/command.rb +0 -10
  34. data/lib/appium_lib/core/common/base/driver.rb +0 -40
  35. data/lib/appium_lib/core/common/base/http_default.rb +0 -12
  36. data/lib/appium_lib/core/common/base/search_context.rb +0 -89
  37. data/lib/appium_lib/core/common/base/wait.rb +0 -56
  38. data/lib/appium_lib/core/common/command.rb +0 -75
  39. data/lib/appium_lib/core/common/device.rb +0 -462
  40. data/lib/appium_lib/core/common/error.rb +0 -18
  41. data/lib/appium_lib/core/common/log.rb +0 -30
  42. data/lib/appium_lib/core/common/logger.rb +0 -35
  43. data/lib/appium_lib/core/core.rb +0 -67
  44. data/lib/appium_lib/core/device/multi_touch.rb +0 -48
  45. data/lib/appium_lib/core/device/touch_actions.rb +0 -191
  46. data/lib/appium_lib/core/driver.rb +0 -417
  47. data/lib/appium_lib/core/ios.rb +0 -7
  48. data/lib/appium_lib/core/ios/device.rb +0 -44
  49. data/lib/appium_lib/core/ios/search_context.rb +0 -27
  50. data/lib/appium_lib/core/ios/touch.rb +0 -16
  51. data/lib/appium_lib/core/ios/uiautomation/bridge.rb +0 -20
  52. data/lib/appium_lib/core/ios/uiautomation/patch.rb +0 -20
  53. data/lib/appium_lib/core/ios/xcuitest/bridge.rb +0 -20
  54. data/lib/appium_lib/core/ios/xcuitest/device.rb +0 -59
  55. data/lib/appium_lib/core/ios/xcuitest/search_context.rb +0 -40
  56. data/lib/appium_lib/core/ios_xcuitest.rb +0 -8
  57. data/lib/appium_lib/core/patch.rb +0 -56
@@ -1,7 +0,0 @@
1
- # loaded in common/driver.rb
2
- require_relative 'ios/search_context'
3
- require_relative 'ios/device'
4
- require_relative 'ios/touch'
5
-
6
- require_relative 'ios/uiautomation/patch'
7
- require_relative 'ios/uiautomation/bridge'
@@ -1,44 +0,0 @@
1
- module Appium
2
- module Ios
3
- module Device
4
- extend Forwardable
5
-
6
- # @!method touch_id
7
- # iOS only; Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint.
8
- # @param [Boolean] match fingerprint validity
9
- # Defaults to true.
10
- # ```ruby
11
- # touch_id true #=> Simulate valid fingerprint
12
- # touch_id false #=> Simulate invalid fingerprint
13
- # ```
14
-
15
- # @!method toggle_touch_id_enrollment
16
- # iOS Simulator only: Toggle touch id enrollment on an iOS Simulator.
17
- # @param [Boolean] enabled Enable toggle touch id enrollment. Set true by default.
18
- # ```ruby
19
- # toggle_touch_id_enrollment #=> Enable toggle enrolled
20
- # toggle_touch_id_enrollment true #=> Enable toggle enrolled
21
- # toggle_touch_id_enrollment false #=> Disable toggle enrolled
22
- # ```
23
- # toggle_touch_id_enrollment
24
- class << self
25
- def extended(_mod)
26
- ::Appium::Core::Device.extend_webdriver_with_forwardable
27
-
28
- # TODO: TEST ME
29
- ::Appium::Core::Device.add_endpoint_method(:touch_id) do
30
- def touch_id(match = true)
31
- execute :touch_id, {}, match: match
32
- end
33
- end
34
-
35
- ::Appium::Core::Device.add_endpoint_method(:toggle_touch_id_enrollment) do
36
- def toggle_touch_id_enrollment(enabled = true)
37
- execute :toggle_touch_id_enrollment, {}, enabled: enabled
38
- end
39
- end
40
- end
41
- end
42
- end # module Device
43
- end # module iOS
44
- end # module Appium
@@ -1,27 +0,0 @@
1
- module Appium
2
- module Core
3
- module Ios
4
- module SearchContext
5
- # @!method uiautomation_find
6
- # find_element/s can be used with a [UIAutomation command](https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAWindowClassReference/UIAWindow/UIAWindow.html#//apple_ref/doc/uid/TP40009930).
7
- #
8
- # ```ruby
9
- # find_elements :uiautomation, 'elements()
10
- # ```
11
- #
12
- # @!method ios_predicate_string_find
13
- # find_element/s can be used with a [Predicates](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html)
14
- #
15
- # ```ruby
16
- # find_elements :predicate, "isWDVisible == 1"
17
- # find_elements :predicate, 'wdName == "Buttons"'
18
- # find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
19
- # ```
20
- def self.extend
21
- ::Appium::Core::Base::SearchContext.add_finders(uiautomation: '-ios uiautomation')
22
- ::Appium::Core::Base::SearchContext.add_finders(predicate: '-ios predicate string')
23
- end
24
- end # class << self
25
- end # module Ios
26
- end # module Core
27
- end # module Appium
@@ -1,16 +0,0 @@
1
- module Appium
2
- module Core
3
- module Ios
4
- module Touch
5
- def self.extend_touch_actions
6
- ::Appium::Core::TouchAction.class_eval do
7
- def swipe_coordinates(start_x: 0, start_y: 0, offset_x: 0, offset_y: 0)
8
- Appium::Logger.info "start_x: #{start_x}, start_y: #{start_y}, offset_x: #{offset_x}, offset_y: #{offset_y}"
9
- { offset_x: offset_x, offset_y: offset_y }
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,20 +0,0 @@
1
- require_relative '../../ios'
2
-
3
- module Appium
4
- module Core
5
- module Ios
6
- module Uiautomation
7
- module Bridge
8
- def self.for(target)
9
- Core::Ios::SearchContext.extend
10
- target.extend Appium::Ios::Device
11
-
12
- Core::Ios::Uiautomation.patch_webdriver_element
13
-
14
- Core::Ios::Touch.extend_touch_actions
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- module Appium
2
- module Core
3
- module Ios
4
- module Uiautomation
5
- # @private
6
- # class_eval inside a method because class Selenium::WebDriver::Element
7
- # will trigger as soon as the file is required. in contrast a method
8
- # will trigger only when invoked.
9
- def self.patch_webdriver_element
10
- ::Selenium::WebDriver::Element.class_eval do
11
- # Cross platform way of entering text into a textfield
12
- def type(text, driver = $driver)
13
- driver.execute_script %(au.getElement('#{ref}').setValue('#{text}');)
14
- end # def type
15
- end # Selenium::WebDriver::Element.class_eval
16
- end # def patch_webdriver_element
17
- end # module Uiautomation
18
- end # module Ios
19
- end # module Core
20
- end # module Appium
@@ -1,20 +0,0 @@
1
- require_relative '../../ios_xcuitest'
2
-
3
- module Appium
4
- module Core
5
- module Ios
6
- module Xcuitest
7
- module Bridge
8
- def self.for(target)
9
- Core::Ios::SearchContext.extend
10
- Core::Ios::Xcuitest::SearchContext.extend
11
- target.extend Appium::Ios::Device
12
- target.extend Appium::Ios::Xcuitest::Device
13
-
14
- Core::Ios::Touch.extend_touch_actions
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,59 +0,0 @@
1
- module Appium
2
- module Ios
3
- module Xcuitest
4
- module Device
5
- extend Forwardable
6
-
7
- # @!method hide_keyboard
8
- # Hide the onscreen keyboard
9
- # @param [String] close_key The name of the key which closes the keyboard.
10
- # @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
11
- # XCUITest ignore this argument.
12
- # Default for iOS is `:pressKey`. Default for Android is `:tapOutside`.
13
- # ```ruby
14
- # hide_keyboard # Close a keyboard with the 'Done' button
15
- # hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
16
- # ```
17
-
18
- # @!method background_app
19
- # Backgrounds the app for a set number of seconds.
20
- # This is a blocking application
21
- # @param [Integer] seconds How many seconds to background the app for.
22
- #
23
- # ```ruby
24
- # background_app
25
- # background_app(5)
26
- # background_app(-1) #=> the app never come back. https://github.com/appium/appium/issues/7741
27
- # ```
28
-
29
- class << self
30
- def extended(_mod)
31
- ::Appium::Core::Device.extend_webdriver_with_forwardable
32
-
33
- # Override
34
- ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
35
- def hide_keyboard(close_key = nil, strategy = nil)
36
- option = {}
37
-
38
- option[:key] = close_key if close_key
39
- option[:strategy] = strategy if strategy
40
-
41
- execute :hide_keyboard, {}, option
42
- end
43
- end
44
-
45
- # Override
46
- ::Appium::Core::Device.add_endpoint_method(:background_app) do
47
- def background_app(duration = 0)
48
- # https://github.com/appium/ruby_lib/issues/500, https://github.com/appium/appium/issues/7741
49
- # `execute :background_app, {}, seconds: { timeout: duration_milli_sec }` works over Appium 1.6.4
50
- duration_milli_sec = duration.nil? ? nil : duration * 1000
51
- execute :background_app, {}, seconds: { timeout: duration_milli_sec }
52
- end
53
- end
54
- end
55
- end # class << self
56
- end # module Device
57
- end # module Xcuitest
58
- end # module Ios
59
- end # module Appium
@@ -1,40 +0,0 @@
1
- module Appium
2
- module Core
3
- module Ios
4
- module Xcuitest
5
- module SearchContext
6
- # @!method ios_class_chain_find
7
- # Only for XCUITest(WebDriverAgent)
8
- # find_element/s can be used with a [class chain]( https://github.com/facebook/WebDriverAgent/wiki/Queries)
9
- #
10
- # @example
11
- #
12
- # # select the third child button of the first child window element
13
- # find_elements :class_chain, 'XCUIElementTypeWindow/XCUIElementTypeButton[3]'
14
- #
15
- # # select all the children windows
16
- # find_elements :class_chain, 'XCUIElementTypeWindow'
17
- #
18
- # # select the second last child of the second child window
19
- # find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
20
- #
21
- # # matching predicate. <code>`</code> is the mark.
22
- # find_elements :class_chain, 'XCUIElementTypeWindow[`visible = 1][`name = \"bla\"`]'
23
- #
24
- # # containing predicate. `$` is the mark.
25
- # # Require appium-xcuitest-driver 2.54.0+
26
- # # PR: https://github.com/facebook/WebDriverAgent/pull/707/files
27
- # find_elements :class_chain, 'XCUIElementTypeWindow[$name = \"bla$$$bla\"$]'
28
- # e = find_element :class_chain, "**/XCUIElementTypeWindow[$name == 'Buttons'$]"
29
- # e.tag_name #=> "XCUIElementTypeWindow"
30
- # e = find_element :class_chain, "**/XCUIElementTypeStaticText[$name == 'Buttons'$]"
31
- # e.tag_name #=> "XCUIElementTypeStaticText"
32
- #
33
- def self.extend
34
- ::Appium::Core::Base::SearchContext.add_finders(class_chain: '-ios class chain')
35
- end
36
- end
37
- end # class << self
38
- end # module Ios
39
- end # module Core
40
- end # module Appium
@@ -1,8 +0,0 @@
1
- # loaded in common/driver.rb
2
- require_relative 'ios/search_context'
3
- require_relative 'ios/device'
4
- require_relative 'ios/touch'
5
-
6
- require_relative 'ios/xcuitest/search_context'
7
- require_relative 'ios/xcuitest/device'
8
- require_relative 'ios/xcuitest/bridge'
@@ -1,56 +0,0 @@
1
- require_relative '../version'
2
-
3
- module Appium
4
- module Core
5
- # Implement useful features for element.
6
- class Selenium::WebDriver::Element # rubocop:disable Style/ClassAndModuleChildren
7
- # Note: For testing .text should be used over value, and name.
8
-
9
- # Returns the value attribute
10
- #
11
- # Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
12
- def value
13
- attribute :value
14
- end
15
-
16
- # Returns the name attribute
17
- #
18
- # Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
19
- def name
20
- attribute :name
21
- end
22
-
23
- # Enable access to iOS accessibility label
24
- # accessibility identifier is supported as 'name'
25
- def label
26
- attribute :label
27
- end
28
-
29
- # Alias for type
30
- alias type send_keys
31
-
32
- # For use with mobile tap.
33
- #
34
- # ```ruby
35
- # execute_script 'mobile: tap', :x => 0.0, :y => 0.98
36
- # ```
37
- #
38
- # @return [OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
39
- def location_rel(driver = $driver)
40
- rect = self.rect
41
- location_x = rect.x.to_f
42
- location_y = rect.y.to_f
43
-
44
- size_width = rect.width.to_f
45
- size_height = rect.height.to_f
46
-
47
- center_x = location_x + (size_width / 2.0)
48
- center_y = location_y + (size_height / 2.0)
49
-
50
- w = driver.window_size
51
- OpenStruct.new(x: "#{center_x} / #{w.width.to_f}",
52
- y: "#{center_y} / #{w.height.to_f}")
53
- end
54
- end
55
- end # module Core
56
- end # module Appium