appium_lib 9.1.2 → 9.1.3
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/.rubocop.yml +9 -0
- data/.travis.yml +4 -1
- data/android_tests/lib/android/specs/android/element/textfield.rb +0 -10
- data/android_tests/lib/android/specs/driver.rb +20 -0
- data/appium_lib.gemspec +1 -1
- data/docs/android_docs.md +223 -208
- data/docs/ios_docs.md +256 -217
- data/docs/ios_xcuitest.md +12 -7
- data/ios_tests/lib/ios/specs/driver.rb +21 -0
- data/ios_tests/lib/ios/specs/ios/element/button.rb +1 -1
- data/ios_tests/lib/ios/specs/ios/element/textfield.rb +0 -16
- data/ios_tests/lib/ios/specs/ios/patch.rb +1 -0
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/device/device.rb +12 -21
- data/lib/appium_lib/device/touch_actions.rb +4 -0
- data/lib/appium_lib/driver.rb +5 -3
- data/lib/appium_lib/ios/element/button.rb +6 -4
- data/lib/appium_lib/ios/element/generic.rb +23 -0
- data/lib/appium_lib/ios/element/text.rb +6 -4
- data/release_notes.md +13 -0
- metadata +4 -4
data/docs/ios_xcuitest.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
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
7
|
|
8
8
|
## find elements
|
9
|
-
- supported elements by find_element
|
9
|
+
- supported elements by find_element are:
|
10
10
|
- [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver/blob/master/lib/commands/find.js#L17)
|
11
11
|
- [WebDriverAgent](https://github.com/facebook/WebDriverAgent/blob/8346199212bffceab24192e81bc0118d65132466/WebDriverAgentLib/Commands/FBFindElementCommands.m#L111)
|
12
12
|
- Mapping
|
@@ -15,7 +15,7 @@
|
|
15
15
|
### with except for XPath
|
16
16
|
#### examples
|
17
17
|
- [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.
|
18
|
-
- If `automationName` is `Appium`, then they provide `UIAxxxx`
|
18
|
+
- If `automationName` is `Appium` or `nil`, then they provide `UIAxxxx`
|
19
19
|
- If `automationName` is `XCUITest`, then they provide `XCUIElementTypexxx`
|
20
20
|
|
21
21
|
```ruby
|
@@ -30,10 +30,16 @@ find_element(:class, button_class) # Return a element of XCUIElementTypeButton f
|
|
30
30
|
find_element(:accessibility_id, element) # Return a element which has accessibilityIdentifier, `element`.
|
31
31
|
```
|
32
32
|
|
33
|
+
- `button/s(value)`, `button_exact/buttons_exact`, `text/s(value)`, `text_exact/texts_exact`
|
34
|
+
```ruby
|
35
|
+
buttons(value) # Return button elements include `value` as its name attributes.
|
36
|
+
```
|
37
|
+
|
38
|
+
|
33
39
|
### with XPath
|
34
40
|
- It is better to avoid XPath strategy.
|
35
41
|
- https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy
|
36
|
-
- > Try not to use XPath locators unless there
|
42
|
+
- > 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.
|
37
43
|
- Improved performance a bit
|
38
44
|
- https://github.com/appium/appium/issues/6842
|
39
45
|
- https://github.com/facebook/WebDriverAgent/issues/306
|
@@ -41,13 +47,12 @@ find_element(:accessibility_id, element) # Return a element which has accessibil
|
|
41
47
|
- https://github.com/facebook/WebDriverAgent/blob/2158a8d0f305549532f1338fe1e4628cfbd53cd9/WebDriverAgentLib/Categories/XCElementSnapshot%2BFBHelpers.m#L57
|
42
48
|
|
43
49
|
#### examples
|
44
|
-
- `
|
50
|
+
- `textfield/s(value)`, `find/s`, `find_exact/finds_exact` uses XPath in their method. So, these methods are slower than other find_element directly.
|
45
51
|
|
46
52
|
```ruby
|
47
|
-
button(value) # Return a XCUIElementTypeButton element which has `value` text.
|
48
53
|
textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTextField element which has `value` text.
|
49
|
-
|
54
|
+
finds_exact(value) # Return any elements include `value` as its name attributes.
|
50
55
|
```
|
51
56
|
|
52
57
|
## Other actions
|
53
|
-
Basically, other actions such as `type`
|
58
|
+
Basically, other actions such as `type` are compatible with `automationName = Appium`.
|
@@ -137,6 +137,11 @@ describe 'driver' do
|
|
137
137
|
sauce_access_key.must_be_nil
|
138
138
|
end
|
139
139
|
end
|
140
|
+
|
141
|
+
t 'default timeout for http client' do
|
142
|
+
http_client.open_timeout.must_equal 999_999
|
143
|
+
http_client.read_timeout.must_equal 999_999
|
144
|
+
end
|
140
145
|
end
|
141
146
|
|
142
147
|
describe 'Appium::Driver' do
|
@@ -165,6 +170,22 @@ describe 'driver' do
|
|
165
170
|
client_version.must_equal expected
|
166
171
|
end
|
167
172
|
|
173
|
+
t 'set_immediate_value' do
|
174
|
+
go_to_textfields
|
175
|
+
|
176
|
+
message = 'hello'
|
177
|
+
|
178
|
+
element = textfield(1)
|
179
|
+
element.click
|
180
|
+
element.clear
|
181
|
+
|
182
|
+
set_immediate_value(element, message)
|
183
|
+
element.text.must_equal message
|
184
|
+
|
185
|
+
set_wait 10
|
186
|
+
leave_textfields
|
187
|
+
end
|
188
|
+
|
168
189
|
t 'restart' do
|
169
190
|
restart
|
170
191
|
text 'buttons'
|
@@ -29,7 +29,7 @@ describe 'ios/element/button' do
|
|
29
29
|
|
30
30
|
t 'buttons' do
|
31
31
|
exp = ['Back', 'Back', 'Gray', 'Right pointing arrow']
|
32
|
-
exp.concat ['
|
32
|
+
exp.concat ['Add contact'] if UI::Inventory.xcuitest?
|
33
33
|
|
34
34
|
target_buttons = buttons('a')
|
35
35
|
target_buttons.map(&:name).must_equal exp
|
@@ -124,22 +124,6 @@ describe 'ios/element/textfield' do
|
|
124
124
|
textfields_exact('does not exist').length.must_equal 0
|
125
125
|
end
|
126
126
|
|
127
|
-
t 'set_immediate_value' do
|
128
|
-
go_to_textfields
|
129
|
-
|
130
|
-
message = 'hello'
|
131
|
-
|
132
|
-
element = textfield(1)
|
133
|
-
element.click
|
134
|
-
element.clear
|
135
|
-
|
136
|
-
set_immediate_value(element, message)
|
137
|
-
element.text.must_equal message
|
138
|
-
|
139
|
-
set_wait 10
|
140
|
-
leave_textfields
|
141
|
-
end
|
142
|
-
|
143
127
|
t 'after_last' do
|
144
128
|
after_last
|
145
129
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Appium
|
2
2
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
3
|
-
VERSION = '9.1.
|
4
|
-
DATE = '
|
3
|
+
VERSION = '9.1.3'.freeze unless defined? ::Appium::VERSION
|
4
|
+
DATE = '2017-01-04'.freeze unless defined? ::Appium::DATE
|
5
5
|
end
|
@@ -166,7 +166,7 @@ module Appium
|
|
166
166
|
app_package = opts[:app_package]
|
167
167
|
raise 'app_package is required' unless app_package
|
168
168
|
app_activity = opts[:app_activity]
|
169
|
-
raise 'app_activity is required' unless
|
169
|
+
raise 'app_activity is required' unless app_activity
|
170
170
|
app_wait_package = opts.fetch(:app_wait_package, '')
|
171
171
|
app_wait_activity = opts.fetch(:app_wait_activity, '')
|
172
172
|
|
@@ -313,11 +313,7 @@ module Appium
|
|
313
313
|
|
314
314
|
# @private
|
315
315
|
def add_endpoint_method(method)
|
316
|
-
|
317
|
-
create_bridge_command method, &Proc.new
|
318
|
-
else
|
319
|
-
create_bridge_command method
|
320
|
-
end
|
316
|
+
block_given? ? create_bridge_command(method, &Proc.new) : create_bridge_command(method)
|
321
317
|
|
322
318
|
delegate_driver_method method
|
323
319
|
delegate_from_appium_driver method
|
@@ -345,11 +341,7 @@ module Appium
|
|
345
341
|
# @private
|
346
342
|
def create_bridge_command(method)
|
347
343
|
Selenium::WebDriver::Remote::Bridge.class_eval do
|
348
|
-
|
349
|
-
class_eval(&Proc.new)
|
350
|
-
else
|
351
|
-
define_method(method) { execute method }
|
352
|
-
end
|
344
|
+
block_given? ? class_eval(&Proc.new) : define_method(method) { execute method }
|
353
345
|
end
|
354
346
|
end
|
355
347
|
|
@@ -365,11 +357,7 @@ module Appium
|
|
365
357
|
Selenium::WebDriver::SearchContext.class_eval do
|
366
358
|
def find_element_with_appium(*args)
|
367
359
|
how, what = extract_args(args)
|
368
|
-
|
369
|
-
finders = ::Selenium::WebDriver::SearchContext::FINDERS.merge ::Appium::Driver::SearchContext::FINDERS
|
370
|
-
by = finders[how.to_sym]
|
371
|
-
raise ArgumentError, "cannot find element by #{how.inspect}" unless by
|
372
|
-
|
360
|
+
by = _set_by_from_finders(how)
|
373
361
|
begin
|
374
362
|
bridge.find_element_by by, what.to_s, ref
|
375
363
|
rescue Selenium::WebDriver::Error::TimeOutError
|
@@ -379,17 +367,20 @@ module Appium
|
|
379
367
|
|
380
368
|
def find_elements_with_appium(*args)
|
381
369
|
how, what = extract_args(args)
|
382
|
-
|
383
|
-
finders = ::Selenium::WebDriver::SearchContext::FINDERS.merge ::Appium::Driver::SearchContext::FINDERS
|
384
|
-
by = finders[how.to_sym]
|
385
|
-
raise ArgumentError, "cannot find element by #{how.inspect}" unless by
|
386
|
-
|
370
|
+
by = _set_by_from_finders(how)
|
387
371
|
begin
|
388
372
|
bridge.find_elements_by by, what.to_s, ref
|
389
373
|
rescue Selenium::WebDriver::Error::TimeOutError
|
390
374
|
raise Selenium::WebDriver::Error::NoSuchElementError
|
391
375
|
end
|
392
376
|
end
|
377
|
+
|
378
|
+
def _set_by_from_finders(how)
|
379
|
+
finders = ::Selenium::WebDriver::SearchContext::FINDERS.merge ::Appium::Driver::SearchContext::FINDERS
|
380
|
+
by = finders[how.to_sym]
|
381
|
+
raise ArgumentError, "cannot find element by #{how.inspect}" unless by
|
382
|
+
by
|
383
|
+
end
|
393
384
|
end
|
394
385
|
end
|
395
386
|
|
@@ -39,6 +39,10 @@ module Appium
|
|
39
39
|
end
|
40
40
|
|
41
41
|
# Press down for a specific duration.
|
42
|
+
# Alternatively, you can use `press(...).wait(...).release()` instead of `long_press` if duration doesn't work well.
|
43
|
+
# https://github.com/appium/ruby_lib/issues/231#issuecomment-269895512
|
44
|
+
# e.g. Appium::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
45
|
+
#
|
42
46
|
# @option element [WebDriver::Element] the element to press.
|
43
47
|
# @option x [integer] x co-ordinate to press on.
|
44
48
|
# @option y [integer] y co-ordinate to press on.
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -302,6 +302,9 @@ module Appium
|
|
302
302
|
# Returns the driver
|
303
303
|
# @return [Driver] the driver
|
304
304
|
attr_reader :driver
|
305
|
+
# Return http client called in start_driver()
|
306
|
+
# @return [Selenium::WebDriver::Remote::Http::Default] the http client
|
307
|
+
attr_reader :http_client
|
305
308
|
|
306
309
|
# Creates a new driver
|
307
310
|
#
|
@@ -547,13 +550,12 @@ module Appium
|
|
547
550
|
#
|
548
551
|
# @return [Selenium::WebDriver] the new global driver
|
549
552
|
def start_driver
|
550
|
-
@
|
551
|
-
@client.timeout = 999_999
|
553
|
+
@http_client ||= Selenium::WebDriver::Remote::Http::Default.new(open_timeout: 999_999, read_timeout: 999_999)
|
552
554
|
|
553
555
|
begin
|
554
556
|
driver_quit
|
555
557
|
@driver = Selenium::WebDriver.for(:remote,
|
556
|
-
http_client: @
|
558
|
+
http_client: @http_client,
|
557
559
|
desired_capabilities: @caps,
|
558
560
|
url: server_url,
|
559
561
|
listener: @listener)
|
@@ -18,7 +18,7 @@ module Appium
|
|
18
18
|
return ele_index button_class, value if value.is_a? Numeric
|
19
19
|
|
20
20
|
if automation_name_is_xcuitest?
|
21
|
-
|
21
|
+
_raise_error_if_no_element buttons(value).first
|
22
22
|
else
|
23
23
|
ele_by_json_visible_contains button_class, value
|
24
24
|
end
|
@@ -32,7 +32,8 @@ module Appium
|
|
32
32
|
return tags button_class unless value
|
33
33
|
|
34
34
|
if automation_name_is_xcuitest?
|
35
|
-
|
35
|
+
elements = tags button_class
|
36
|
+
_elements_include elements, value
|
36
37
|
else
|
37
38
|
eles_by_json_visible_contains button_class, value
|
38
39
|
end
|
@@ -57,7 +58,7 @@ module Appium
|
|
57
58
|
# @return [UIAButton|XCUIElementTypeButton]
|
58
59
|
def button_exact(value)
|
59
60
|
if automation_name_is_xcuitest?
|
60
|
-
|
61
|
+
_raise_error_if_no_element buttons_exact(value).first
|
61
62
|
else
|
62
63
|
ele_by_json_visible_exact button_class, value
|
63
64
|
end
|
@@ -68,7 +69,8 @@ module Appium
|
|
68
69
|
# @return [Array<UIAButton|XCUIElementTypeButton>]
|
69
70
|
def buttons_exact(value)
|
70
71
|
if automation_name_is_xcuitest?
|
71
|
-
|
72
|
+
elements = tags button_class
|
73
|
+
_elements_exact elements, value
|
72
74
|
else
|
73
75
|
eles_by_json_visible_exact button_class, value
|
74
76
|
end
|
@@ -43,5 +43,28 @@ module Appium
|
|
43
43
|
eles_by_json_visible_exact '*', value
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def _raise_error_if_no_element(element)
|
50
|
+
raise ::Selenium::WebDriver::Error::NoSuchElementError if element.nil?
|
51
|
+
element
|
52
|
+
end
|
53
|
+
|
54
|
+
def _elements_include(elements, value)
|
55
|
+
return [] if elements.empty?
|
56
|
+
elements.select do |element|
|
57
|
+
name = element.name
|
58
|
+
name.nil? ? false : name.downcase.include?(value.downcase)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def _elements_exact(elements, value)
|
63
|
+
return [] if elements.empty?
|
64
|
+
elements.select do |element|
|
65
|
+
name = element.name
|
66
|
+
name.nil? ? false : name.casecmp(value).zero?
|
67
|
+
end
|
68
|
+
end
|
46
69
|
end # module Ios
|
47
70
|
end # module Appium
|
@@ -17,7 +17,7 @@ module Appium
|
|
17
17
|
return ele_index static_text_class, value if value.is_a? Numeric
|
18
18
|
|
19
19
|
if automation_name_is_xcuitest?
|
20
|
-
|
20
|
+
_raise_error_if_no_element texts(value).first
|
21
21
|
else
|
22
22
|
ele_by_json_visible_contains static_text_class, value
|
23
23
|
end
|
@@ -31,7 +31,8 @@ module Appium
|
|
31
31
|
return tags static_text_class unless value
|
32
32
|
|
33
33
|
if automation_name_is_xcuitest?
|
34
|
-
|
34
|
+
elements = tags static_text_class
|
35
|
+
_elements_include elements, value
|
35
36
|
else
|
36
37
|
eles_by_json_visible_contains static_text_class, value
|
37
38
|
end
|
@@ -54,7 +55,7 @@ module Appium
|
|
54
55
|
# @return [UIAStaticText|XCUIElementTypeStaticText]
|
55
56
|
def text_exact(value)
|
56
57
|
if automation_name_is_xcuitest?
|
57
|
-
|
58
|
+
_raise_error_if_no_element texts_exact(value).first
|
58
59
|
else
|
59
60
|
ele_by_json_visible_exact static_text_class, value
|
60
61
|
end
|
@@ -65,7 +66,8 @@ module Appium
|
|
65
66
|
# @return [Array<UIAStaticText|XCUIElementTypeStaticText>]
|
66
67
|
def texts_exact(value)
|
67
68
|
if automation_name_is_xcuitest?
|
68
|
-
|
69
|
+
elements = tags static_text_class
|
70
|
+
_elements_exact elements, value
|
69
71
|
else
|
70
72
|
eles_by_json_visible_exact static_text_class, value
|
71
73
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
#### v9.1.3 2017-01-04
|
2
|
+
|
3
|
+
- [ba2fbdc](https://github.com/appium/ruby_lib/commit/ba2fbdcb206609259134fc09eac7940c21cc2c13) Release 9.1.3
|
4
|
+
- [f0c15c5](https://github.com/appium/ruby_lib/commit/f0c15c5b0211b40a8412583c5180a19dc4b56047) update documentations in xcuitest (#444)
|
5
|
+
- [67114d1](https://github.com/appium/ruby_lib/commit/67114d1c16f4289c9aa4e7bb02fcc05a08cc3575) Improve performance for button/s and text/s (#442)
|
6
|
+
- [2d1f30e](https://github.com/appium/ruby_lib/commit/2d1f30e9b4d89dc51bb546d535c0bd3f14687394) simplify a bit and move tests to suitable file (#441)
|
7
|
+
- [1efed4c](https://github.com/appium/ruby_lib/commit/1efed4cbf45b889ca9e64f91346e786a89ba3c42) add documentation for alternative long_press method (#440)
|
8
|
+
- [71e629f](https://github.com/appium/ruby_lib/commit/71e629f34065b6a6e39e9bc18bcf4eb0576be0cb) update small changes (#439)
|
9
|
+
- [cec023c](https://github.com/appium/ruby_lib/commit/cec023cc9388afe5283c7637622f369a9b891b1e) Use open timeout and read timeout and require selenium-webdriver3.0.4+ (#437)
|
10
|
+
- [ffa78a6](https://github.com/appium/ruby_lib/commit/ffa78a64b1dd68fa24c80779eff0a9c2ab685c19) Release 9 1 2 (#434)
|
11
|
+
- [22401b0](https://github.com/appium/ruby_lib/commit/22401b065f2317e82d37b5188ad9c18c701b0a41) Release 9.1.2
|
12
|
+
|
13
|
+
|
1
14
|
#### v9.1.2 2016-12-25
|
2
15
|
|
3
16
|
- [22401b0](https://github.com/appium/ruby_lib/commit/22401b065f2317e82d37b5188ad9c18c701b0a41) Release 9.1.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.1.
|
4
|
+
version: 9.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.0.
|
22
|
+
version: 3.0.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.0.
|
32
|
+
version: 3.0.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: awesome_print
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|