appium_lib 16.3.1 → 16.4.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/appium_lib.gemspec +9 -9
- data/lib/appium_lib/android/common/helper.rb +5 -3
- data/lib/appium_lib/driver.rb +1 -1
- data/lib/appium_lib/version.rb +2 -2
- data/readme.md +1 -1
- metadata +10 -18
- data/.gitignore +0 -4
- data/.rubocop.yml +0 -299
- data/Gemfile +0 -24
- data/Rakefile +0 -31
- data/contributing.md +0 -35
- data/docs/android_uiautomator.md +0 -17
- data/docs/docs.md +0 -130
- data/docs/ios_xcuitest.md +0 -114
- data/docs/parallel.md +0 -8
- data/docs/w3c.md +0 -55
- data/release_notes.md +0 -2279
- data/test/first_test.rb +0 -29
- data/test/regression_test.rb +0 -132
data/docs/docs.md
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# Documentation
|
|
2
|
-
## API Doc of Ruby Client
|
|
3
|
-
- This library: http://www.rubydoc.info/github/appium/ruby_lib
|
|
4
|
-
- Core: http://www.rubydoc.info/github/appium/ruby_lib_core
|
|
5
|
-
- [Ruby selenium-webdriver](https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings)
|
|
6
|
-
|
|
7
|
-
### General
|
|
8
|
-
- [Appium](https://github.com/appium/appium/blob/master/README.md)
|
|
9
|
-
- [Supported platforms](https://github.com/appium/appium/blob/master/docs/en/about-appium/platform-support.md)
|
|
10
|
-
- [All methods supported by Appium](https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md)
|
|
11
|
-
- Fundamental Commands: http://appium.io/docs/en/commands/status/ etc
|
|
12
|
-
- [MiniTest Expectations](http://docs.seattlerb.org/minitest/Minitest/Expectations.html)
|
|
13
|
-
|
|
14
|
-
### Driver types in Ruby Client
|
|
15
|
-
|
|
16
|
-
```ruby
|
|
17
|
-
# Appium specific driver with helpers available extending Standard Appium Driver.
|
|
18
|
-
@appium_driver = Appium::Driver.new @options, false
|
|
19
|
-
|
|
20
|
-
# Standard Appium Driver extends Selenium WebDriver.
|
|
21
|
-
@selenium_driver = @appium_driver.start_driver
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Example
|
|
25
|
-
|
|
26
|
-
Example of automating the built in Android settings.
|
|
27
|
-
|
|
28
|
-
```ruby
|
|
29
|
-
# run Pry, and paste the following
|
|
30
|
-
apk = {
|
|
31
|
-
platformName: 'android',
|
|
32
|
-
deviceName: :nexus,
|
|
33
|
-
appPackage: 'com.android.settings',
|
|
34
|
-
appActivity: '.Settings',
|
|
35
|
-
appWaitActivity: '.Settings'
|
|
36
|
-
}
|
|
37
|
-
Appium::Driver.new({caps: apk}, false).start_driver
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Example use of Appium's mobile gesture.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Long click on an ImageView in Android.
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
last_image = find_elements(:class, 'ImageView').last
|
|
47
|
-
long_press(element: last_image)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Rotate examples. The behaviour is depends on devices.
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
driver.rotate :landscape
|
|
54
|
-
driver.rotate :portrait
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
- `appium_server_version` Discover the Appium rev running on the server.
|
|
58
|
-
- `element.send_keys "msg"` Sends keys to currently active element
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### APIs
|
|
62
|
-
|
|
63
|
-
```ruby
|
|
64
|
-
e.name # button, text
|
|
65
|
-
e.value # secure, textfield
|
|
66
|
-
e.type 'some text' # type text into textfield
|
|
67
|
-
e.clear # clear textfield
|
|
68
|
-
e.tag_name # calls .type (patch.rb)
|
|
69
|
-
e.text
|
|
70
|
-
e.size
|
|
71
|
-
e.location
|
|
72
|
-
e.location_rel
|
|
73
|
-
e.click
|
|
74
|
-
e.send_keys 'keys to send'
|
|
75
|
-
e.displayed? # true or false depending if the element is visible
|
|
76
|
-
e.selected? # is the tab selected?
|
|
77
|
-
e.attribute('checked') # is the checkbox checked?
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
# alert example without helper methods
|
|
81
|
-
alert = @driver.switch_to.alert
|
|
82
|
-
alert.text
|
|
83
|
-
alert.accept
|
|
84
|
-
alert.dismiss
|
|
85
|
-
|
|
86
|
-
# Secure textfield example.
|
|
87
|
-
#
|
|
88
|
-
# Find using default value
|
|
89
|
-
s = textfield 'Password'
|
|
90
|
-
# Enter password
|
|
91
|
-
s.send_keys 'hello'
|
|
92
|
-
# Check value
|
|
93
|
-
s.value == ios_password('hello'.length)
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
--
|
|
97
|
-
|
|
98
|
-
#### Driver
|
|
99
|
-
- `start_driver` will restart the driver.
|
|
100
|
-
- `x` will quit the driver and exit Pry.
|
|
101
|
-
- `execute_script` calls `@driver.execute_script`
|
|
102
|
-
- `find_element` calls `@driver.find_element`
|
|
103
|
-
- `find_elements` calls `@driver.find_elements`
|
|
104
|
-
- `no_wait` will set implicit wait to 0. `@driver.manage.timeouts.implicit_wait = 0`
|
|
105
|
-
- `set_wait` will set implicit wait to default seconds. `@driver.manage.timeouts.implicit_wait = default`
|
|
106
|
-
- `set_wait(timeout_seconds)` will set implicit wait to desired timeout. `@driver.manage.timeouts.implicit_wait = timeout`
|
|
107
|
-
- `.click` to tap an element.
|
|
108
|
-
- `.send_keys` or `.type` to type on an element.
|
|
109
|
-
|
|
110
|
-
#### Cucumber Sauce Integration
|
|
111
|
-
|
|
112
|
-
Reset after each test and when done report the result to Sauce after quiting the driver.
|
|
113
|
-
|
|
114
|
-
```ruby
|
|
115
|
-
require 'rest_client' # https://github.com/archiloque/rest-client
|
|
116
|
-
require 'json' # for .to_json
|
|
117
|
-
require 'sauce_whisk'
|
|
118
|
-
|
|
119
|
-
After do |scenario|
|
|
120
|
-
# end the test session, ignoring any exceptions.
|
|
121
|
-
ignore { $driver.driver_quit }
|
|
122
|
-
|
|
123
|
-
user = ENV['SAUCE_USERNAME']
|
|
124
|
-
key = ENV['SAUCE_ACCESS_KEY']
|
|
125
|
-
if user && !user.empty? && key && !key.empty?
|
|
126
|
-
passed = ! scenario.failed?
|
|
127
|
-
SauceWhisk::Jobs.change_status $driver.driver.session_id, passed
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
```
|
data/docs/ios_xcuitest.md
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
## XCUITest
|
|
2
|
-
- Over Appium1.6.0 provides `XCUITest` automation name based on WebDriverAgent.
|
|
3
|
-
- [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver)
|
|
4
|
-
- [WebDriverAgent](https://github.com/facebook/WebDriverAgent)
|
|
5
|
-
- How to migrate XCUITest from UIAutomation
|
|
6
|
-
- [Migrating your iOS tests from UIAutomation](https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md)
|
|
7
|
-
- Mobile gestures for XCUITest
|
|
8
|
-
- [ios-xctest-mobile-gestures](https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures.md)
|
|
9
|
-
- Required Appium1.6.4+
|
|
10
|
-
|
|
11
|
-
## find elements
|
|
12
|
-
- supported elements by find_element are:
|
|
13
|
-
- [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver/blob/master/lib/commands/find.js#L17)
|
|
14
|
-
- [locatorStrategies](https://github.com/appium/appium-xcuitest-driver/blob/95886f1118d71fe950768f8262179d3608b40fc7/lib/driver.js#L81)
|
|
15
|
-
- [WebDriverAgent](https://github.com/facebook/WebDriverAgent/blob/8346199212bffceab24192e81bc0118d65132466/WebDriverAgentLib/Commands/FBFindElementCommands.m#L111)
|
|
16
|
-
- Mapping
|
|
17
|
-
- https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m#L19
|
|
18
|
-
|
|
19
|
-
### with except for XPath and Predicate
|
|
20
|
-
#### examples
|
|
21
|
-
- [button_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/button.rb#L8), [static_text_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/text.rb#L8), [text_field_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/textfield.rb#L10) and [secure_text_field_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/textfield.rb#L15) provide class name.
|
|
22
|
-
- If `automationName` is `Appium` or `nil`, then they provide `UIAxxxx`
|
|
23
|
-
- If `automationName` is `XCUITest`, then they provide `XCUIElementTypexxx`
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
find_element(:class, button_class) # Return a element of XCUIElementTypeButton for XCUITest
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
- [tag/s](https://github.com/appium/ruby_lib/blob/ac03116756a72fbd624fa32ea886123b955d7089/lib/appium_lib/android/helper.rb#L238) is alias of `find_element :class, element`
|
|
30
|
-
|
|
31
|
-
- `accessibility_id`
|
|
32
|
-
|
|
33
|
-
```ruby
|
|
34
|
-
find_element(:accessibility_id, element) # Return a element which has accessibilityIdentifier, `element`.
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
- `button/s(value)`, `button_exact/buttons_exact`, `text/s(value)`, `text_exact/texts_exact`
|
|
38
|
-
```ruby
|
|
39
|
-
buttons(value) # Return button elements include `value` as its name attributes.
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### with Predicate
|
|
43
|
-
- We recommend to use predicate strategy instead of XPath strategy.
|
|
44
|
-
- e.g. `find_ele_by_predicate/find_eles_by_predicate`, `find_ele_by_predicate_include/find_eles_by_predicate_include`
|
|
45
|
-
- A helpful cheatsheet for predicate
|
|
46
|
-
- https://realm.io/news/nspredicate-cheatsheet/
|
|
47
|
-
- For XCUITest(WebDriverAgent), without 'wd' prefixes are supported.
|
|
48
|
-
- https://github.com/facebook/WebDriverAgent/wiki/Queries
|
|
49
|
-
- For example, `%(name ==[c] "#{value}" || label ==[c] "#{value}" || value ==[c] "#{value}")` is equal to `%(wdName ==[c] "#{value}" || wdLabel ==[c] "#{value}" || wdValue ==[c] "#{value}")` in WebDriverAgent.
|
|
50
|
-
|
|
51
|
-
#### examples
|
|
52
|
-
- `textfield/s(value)`, `find/s`, `find_exact/finds_exact`, `find_ele_by_predicate/find_eles_by_predicate` and `find_ele_by_predicate_include/find_eles_by_predicate_include` use predicate strategy in their method.
|
|
53
|
-
|
|
54
|
-
```ruby
|
|
55
|
-
textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTextField element which has `value` text.
|
|
56
|
-
finds_exact(value) # Return any elements include `value` as its name attributes.
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### with Class Chain
|
|
60
|
-
- require Appium 1.6.4+
|
|
61
|
-
- https://github.com/appium/appium-xcuitest-driver/pull/391
|
|
62
|
-
- https://github.com/appium/java-client/pull/599/files
|
|
63
|
-
- WebDriverAgent
|
|
64
|
-
- https://github.com/facebook/WebDriverAgent/wiki/Queries
|
|
65
|
-
|
|
66
|
-
### with XPath
|
|
67
|
-
- It is better to avoid XPath strategy.
|
|
68
|
-
- https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy
|
|
69
|
-
- > Try not to use XPath locators unless there are absolutely no other alternatives. In general, XPath locators might be times slower, than other types of locators like accessibility id, class name and predicate (up to 100 times slower in some special cases). They are so slow because XPath location is not natively supported by Apple's XCTest framework.
|
|
70
|
-
- Improved performance a bit
|
|
71
|
-
- https://github.com/appium/appium/issues/6842
|
|
72
|
-
- https://github.com/facebook/WebDriverAgent/issues/306
|
|
73
|
-
- XPath in WebDriverAgent
|
|
74
|
-
- https://github.com/facebook/WebDriverAgent/blob/2158a8d0f305549532f1338fe1e4628cfbd53cd9/WebDriverAgentLib/Categories/XCElementSnapshot%2BFBHelpers.m#L57
|
|
75
|
-
|
|
76
|
-
#### examples
|
|
77
|
-
|
|
78
|
-
```ruby
|
|
79
|
-
xpaths("//some xpaths")
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Gesture
|
|
83
|
-
- `mobile:` commands are provided by WDA.
|
|
84
|
-
- Documentations
|
|
85
|
-
- https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures.md
|
|
86
|
-
- Specs by test code
|
|
87
|
-
- https://github.com/appium/appium-xcuitest-driver/blob/master/test/functional/basic/gesture-e2e-specs.js
|
|
88
|
-
|
|
89
|
-
### Workaround
|
|
90
|
-
- `mobile:` commands depends on WDA and Apple's framework and the behaviour depends on them.
|
|
91
|
-
- Sometimes issues occur such as "doubleTap isn't tapping #548"
|
|
92
|
-
- workaround for it:
|
|
93
|
-
- with `selenium-webdriver >= 3.4.0`
|
|
94
|
-
```ruby
|
|
95
|
-
def double_tap(element)
|
|
96
|
-
rect = element.rect
|
|
97
|
-
execute_script 'mobile: doubleTap', x: rect.x + rect.width / 2, y: rect.y + rect.height / 2
|
|
98
|
-
end
|
|
99
|
-
```
|
|
100
|
-
- with `selenium-webdriver < 3.4.0`
|
|
101
|
-
```ruby
|
|
102
|
-
def double_tap(element)
|
|
103
|
-
size = element.size
|
|
104
|
-
location = element.location
|
|
105
|
-
execute_script 'mobile: doubleTap', x: location.x + size.width / 2, y: location.y + size.height / 2
|
|
106
|
-
end
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Other actions
|
|
110
|
-
Basically, other actions such as `type` are compatible with `automationName = Appium`.
|
|
111
|
-
|
|
112
|
-
## Pasteboard
|
|
113
|
-
- Simulator only
|
|
114
|
-
- https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios-xctest-pasteboard.md
|
data/docs/parallel.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Appium 1.7.0+ supports single server and multiple sessions, and it requires Xcode 9 for iOS.
|
|
2
|
-
|
|
3
|
-
# Example
|
|
4
|
-
## Run tests on Multiple Simulators with Xcode 9
|
|
5
|
-
- https://github.com/appium/appium-xcuitest-driver/tree/master/test/functional/parallel
|
|
6
|
-
- https://github.com/appium/ruby_lib/tree/master/ios_tests/parallel
|
|
7
|
-
- Thread programming: TestParallelRunThread
|
|
8
|
-
- Process programming: TestParallelRunProcess
|
data/docs/w3c.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
Perform touch actions for W3C module. Generate `touch` pointer action here and users can use this via `driver.action`
|
|
2
|
-
|
|
3
|
-
[Documentation](http://www.rubydoc.info/github/appium/ruby_lib_core/Appium%2FCore%2FBase%2FCoreBridgeW3C:action)
|
|
4
|
-
|
|
5
|
-
# Example
|
|
6
|
-
|
|
7
|
-
```ruby
|
|
8
|
-
dialect #=> :w3c
|
|
9
|
-
|
|
10
|
-
# then
|
|
11
|
-
el = find_element(:name, 'Pickers')
|
|
12
|
-
driver.action.click(el).perform #=> work
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# Scroll/Swipe
|
|
16
|
-
driver.action
|
|
17
|
-
.move_to_location(500, 500).pointer_down(:left)
|
|
18
|
-
.move_to_location(0, 700)
|
|
19
|
-
.release.perform
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# Zoom in
|
|
23
|
-
# multiple action chains
|
|
24
|
-
f1 = driver.action.add_pointer_input(:touch, 'finger1')
|
|
25
|
-
f1.create_pointer_move(duration: 1, x: 200, y: 500,
|
|
26
|
-
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
27
|
-
f1.create_pointer_down(:left)
|
|
28
|
-
f1.create_pause(0.5)
|
|
29
|
-
f1.create_pointer_move(duration: 1, x: 200, y: 200,
|
|
30
|
-
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
31
|
-
f1.create_pointer_up(:left)
|
|
32
|
-
|
|
33
|
-
f2 = driver.action.add_pointer_input(:touch, 'finger2')
|
|
34
|
-
f2.create_pointer_move(duration: 1, x: 200, y: 500,
|
|
35
|
-
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
36
|
-
f2.create_pointer_down(:left)
|
|
37
|
-
f2.create_pause(0.5)
|
|
38
|
-
f2.create_pointer_move(duration: 1, x: 200, y: 800,
|
|
39
|
-
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
40
|
-
f2.create_pointer_up(:left)
|
|
41
|
-
|
|
42
|
-
driver.perform_actions [f1, f2]
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
# Note
|
|
46
|
-
## Coordinate points
|
|
47
|
-
- jsonwp
|
|
48
|
-
- Relative action coordinates are counted relatively to the **top left point** of element's rectangle
|
|
49
|
-
- W3C
|
|
50
|
-
- Relative action coordinates are counted relatively to the **center** of element's rectangle
|
|
51
|
-
|
|
52
|
-
## Limitations
|
|
53
|
-
- WebDriverAgent support only `touch` as a `pointer type`.
|
|
54
|
-
- By default, [ruby_lib_core](https://github.com/appium/ruby_lib_core/blob/ab5d7c5ed31f318a9395e5aeafe1d0d655d3cff4/lib/appium_lib_core/common/base/w3c_bridge.rb#L26) generate `touch` based actions.
|
|
55
|
-
- About `pointer type` => [W3C](https://www.w3.org/TR/webdriver/#perform-actions) and [Simple WD Spec](https://github.com/jlipps/simple-wd-spec#perform-actions)
|