appium_lib 9.4.3 → 9.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/android_tests/api.apk +0 -0
- data/android_tests/readme.md +1 -0
- data/docs/android_docs.md +240 -256
- data/docs/ios_docs.md +278 -259
- data/docs/travis.sample.yml +24 -0
- data/docs_gen/make_docs.rb +2 -2
- data/ios_tests/lib/ios/specs/ios/xcuitest_gestures.rb +38 -1
- data/lib/appium_lib/android/helper.rb +4 -42
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/device/device.rb +17 -13
- data/lib/appium_lib/driver.rb +1 -2
- data/lib/appium_lib/ios/helper.rb +0 -56
- data/lib/appium_lib/ios/xcuitest_gestures.rb +17 -0
- data/release_notes.md +12 -0
- metadata +3 -2
@@ -0,0 +1,24 @@
|
|
1
|
+
language: objective-c
|
2
|
+
sudo: false
|
3
|
+
osx_image: xcode8.3
|
4
|
+
|
5
|
+
cache: bundler
|
6
|
+
|
7
|
+
rvm:
|
8
|
+
- 2.4
|
9
|
+
|
10
|
+
install:
|
11
|
+
- bundle install
|
12
|
+
- npm install -g appium@1.6.4
|
13
|
+
|
14
|
+
before_script:
|
15
|
+
- appium --log-level warn &
|
16
|
+
|
17
|
+
script:
|
18
|
+
- bundle exec rake rubocop
|
19
|
+
- cd ios_tests; rake ios
|
20
|
+
|
21
|
+
notifications:
|
22
|
+
email:
|
23
|
+
on_success: never
|
24
|
+
on_failure: never
|
data/docs_gen/make_docs.rb
CHANGED
@@ -34,7 +34,7 @@ def mobj_to_md obj
|
|
34
34
|
|
35
35
|
indent = space 5
|
36
36
|
params = obj.tags.select { |tag| tag.tag_name == 'param' }
|
37
|
-
|
37
|
+
unless params.empty?
|
38
38
|
out += "__Parameters:__\n\n"
|
39
39
|
params.each do |param|
|
40
40
|
param_types = param.types ? "[#{param.types.join ', '}] " : ''
|
@@ -44,7 +44,7 @@ def mobj_to_md obj
|
|
44
44
|
end
|
45
45
|
|
46
46
|
ret = obj.tag 'return'
|
47
|
-
if ret
|
47
|
+
if ret&.types
|
48
48
|
out += "__Returns:__\n\n"
|
49
49
|
out += indent + "[#{ret.types.join ', '}] #{ret.text}\n\n"
|
50
50
|
end
|
@@ -8,6 +8,20 @@ describe 'ios/xcuitest_gestures' do
|
|
8
8
|
screen.must_equal catalog
|
9
9
|
end
|
10
10
|
|
11
|
+
def open_alert_ok_cancel
|
12
|
+
wait_true do
|
13
|
+
find_element(:name, 'Show OK-Cancel').click
|
14
|
+
find_element(:name, 'UIActionSheet <title>').displayed?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def open_alert_custom
|
19
|
+
wait_true do
|
20
|
+
find_element(:name, 'Show Customized').click
|
21
|
+
find_element(:name, 'UIActionSheet <title>').displayed?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
11
25
|
t 'before_first' do
|
12
26
|
before_first
|
13
27
|
end
|
@@ -58,8 +72,31 @@ describe 'ios/xcuitest_gestures' do
|
|
58
72
|
find_element(:name, 'Serena Auroux').displayed?.must_equal true
|
59
73
|
end
|
60
74
|
|
61
|
-
t '
|
75
|
+
t 'back to top' do
|
76
|
+
back_click
|
77
|
+
end
|
78
|
+
|
79
|
+
t 'alert' do
|
80
|
+
wait_true do
|
81
|
+
UI::Inventory.xcuitest? ? find_element(:name, 'Alerts').click : text('alerts').click
|
82
|
+
tag(UI::Inventory.navbar).name == 'Alerts' # wait for true
|
83
|
+
end
|
84
|
+
|
85
|
+
open_alert_ok_cancel
|
86
|
+
alert action: 'accept'
|
87
|
+
|
88
|
+
open_alert_ok_cancel
|
89
|
+
alert action: 'dismiss'
|
90
|
+
|
91
|
+
open_alert_custom
|
92
|
+
alert action: 'accept', button_label: 'Button1'
|
93
|
+
end
|
94
|
+
|
95
|
+
t 'back to top' do
|
62
96
|
back_click
|
97
|
+
end
|
98
|
+
|
99
|
+
t 'after_last' do
|
63
100
|
after_last
|
64
101
|
end
|
65
102
|
end
|
@@ -3,7 +3,7 @@ module Appium
|
|
3
3
|
# @private
|
4
4
|
# http://nokogiri.org/Nokogiri/XML/SAX.html
|
5
5
|
class AndroidElements < Nokogiri::XML::SAX::Document
|
6
|
-
attr_reader :result, :keys, :
|
6
|
+
attr_reader :result, :keys, :filter
|
7
7
|
|
8
8
|
# convert to string to support symbols
|
9
9
|
def filter=(value)
|
@@ -15,22 +15,17 @@ module Appium
|
|
15
15
|
def initialize
|
16
16
|
reset
|
17
17
|
@filter = false
|
18
|
-
@instance = Hash.new(-1)
|
19
18
|
end
|
20
19
|
|
21
20
|
def reset
|
22
21
|
@result = ''
|
23
22
|
@keys = %w(text resource-id content-desc)
|
24
|
-
@instance = Hash.new(-1)
|
25
23
|
end
|
26
24
|
|
27
25
|
# http://nokogiri.org/Nokogiri/XML/SAX/Document.html
|
28
26
|
def start_element(name, attrs = [])
|
29
27
|
return if filter && !name.downcase.include?(filter)
|
30
28
|
|
31
|
-
# instance numbers start at 0.
|
32
|
-
number = instance[name] += 1
|
33
|
-
|
34
29
|
attributes = {}
|
35
30
|
|
36
31
|
attrs.each do |key, value|
|
@@ -78,39 +73,10 @@ module Appium
|
|
78
73
|
string += " id: #{id}\n" unless id.nil?
|
79
74
|
string += " strings.xml: #{string_ids}" unless string_ids.nil?
|
80
75
|
|
81
|
-
@result += "\n#{name}
|
76
|
+
@result += "\n#{name}\n#{string}" unless attributes.empty?
|
82
77
|
end
|
83
78
|
end # class AndroidElements
|
84
79
|
|
85
|
-
# Fix uiautomator's xml dump.
|
86
|
-
# https://github.com/appium/appium/issues/2822
|
87
|
-
# https://code.google.com/p/android/issues/detail?id=74143
|
88
|
-
def _fix_android_native_source(source)
|
89
|
-
# <android.app.ActionBar$Tab
|
90
|
-
# <android.app.ActionBar $ Tab
|
91
|
-
|
92
|
-
# find each closing tag that contains a dollar sign.
|
93
|
-
source.scan(/<\/([^>]*\$[^>]*)>/).flatten.uniq.each do |problem_tag|
|
94
|
-
# "android.app.ActionBar$Tab"
|
95
|
-
before, after = problem_tag.split('$')
|
96
|
-
before.strip!
|
97
|
-
after.strip!
|
98
|
-
|
99
|
-
fixed = "#{before}.#{after}"
|
100
|
-
|
101
|
-
# now escape . in before/after because they're used in regex
|
102
|
-
before.gsub!('.', '\.')
|
103
|
-
after.gsub!('.', '\.')
|
104
|
-
|
105
|
-
# <android.app.ActionBar$Tab => <android.app.ActionBar.Tab
|
106
|
-
# </android.app.ActionBar$Tab> => </android.app.ActionBar.Tab>
|
107
|
-
source = source.gsub(/<#{before}\s*\$\s*#{after}/,
|
108
|
-
"<#{fixed}").gsub(/<\/#{before}\s*\$\s*#{after}>/, "</#{fixed}>")
|
109
|
-
end
|
110
|
-
|
111
|
-
source
|
112
|
-
end
|
113
|
-
|
114
80
|
# Prints xml of the current page
|
115
81
|
# @return [void]
|
116
82
|
def source
|
@@ -400,14 +366,10 @@ module Appium
|
|
400
366
|
find_elements :uiautomator, string_visible_exact(class_name, value)
|
401
367
|
end
|
402
368
|
|
403
|
-
# Returns XML string for the current page
|
404
|
-
# Fixes uiautomator's $ in node names.
|
405
|
-
# `android.app.ActionBar$Tab` becomes `android.app.ActionBar.Tab`
|
369
|
+
# Returns XML string for the current page via `page_source`
|
406
370
|
# @return [String]
|
407
371
|
def get_source
|
408
|
-
|
409
|
-
src = _fix_android_native_source src unless src && src.start_with?('<html>')
|
410
|
-
src
|
372
|
+
@driver.page_source
|
411
373
|
end
|
412
374
|
end # module Android
|
413
375
|
end # module Appium
|
@@ -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.4.
|
4
|
-
DATE = '2017-05-
|
3
|
+
VERSION = '9.4.4'.freeze unless defined? ::Appium::VERSION
|
4
|
+
DATE = '2017-05-13'.freeze unless defined? ::Appium::DATE
|
5
5
|
end
|
@@ -64,10 +64,14 @@ module Appium
|
|
64
64
|
# @!method hide_keyboard
|
65
65
|
# Hide the onscreen keyboard
|
66
66
|
# @param [String] close_key The name of the key which closes the keyboard.
|
67
|
-
# Defaults to 'Done'.
|
67
|
+
# Defaults to 'Done' for iOS(except for XCUITest).
|
68
|
+
# @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
|
69
|
+
# XCUITest ignore this argument.
|
70
|
+
# Default for iOS is `:pressKey`. Default for Android is `:tapOutside`.
|
68
71
|
# ```ruby
|
69
72
|
# hide_keyboard # Close a keyboard with the 'Done' button
|
70
73
|
# hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
|
74
|
+
# hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
|
71
75
|
# ```
|
72
76
|
|
73
77
|
# @!method press_keycode
|
@@ -273,20 +277,20 @@ module Appium
|
|
273
277
|
end
|
274
278
|
|
275
279
|
add_endpoint_method(:hide_keyboard) do
|
276
|
-
def hide_keyboard(close_key = nil)
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
# https://github.com/appium/appium-xcuitest-driver/blob/v2.2.0/lib/commands/general.js#L51
|
286
|
-
execute :hide_keyboard, {}, strategy: :grouped, key: close_key
|
280
|
+
def hide_keyboard(close_key = nil, strategy = nil)
|
281
|
+
option = {}
|
282
|
+
|
283
|
+
if $driver.device_is_android? # Android can only tapOutside.
|
284
|
+
option[:key] = close_key if close_key
|
285
|
+
option[:strategy] = strategy || :tapOutside # default to pressKey
|
286
|
+
elsif $driver.automation_name_is_xcuitest?
|
287
|
+
option[:key] = close_key if close_key
|
288
|
+
option[:strategy] = strategy if strategy
|
287
289
|
else
|
288
|
-
|
290
|
+
option[:key] = close_key || 'Done' # default to Done key.
|
291
|
+
option[:strategy] = strategy || :pressKey # default to pressKey
|
289
292
|
end
|
293
|
+
execute :hide_keyboard, {}, option
|
290
294
|
end
|
291
295
|
end
|
292
296
|
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -406,11 +406,10 @@ module Appium
|
|
406
406
|
# load common methods
|
407
407
|
extend Appium::Common
|
408
408
|
extend Appium::Device
|
409
|
+
|
409
410
|
if device_is_android?
|
410
|
-
# load Android specific methods
|
411
411
|
extend Appium::Android
|
412
412
|
else
|
413
|
-
# load iOS specific methods
|
414
413
|
extend Appium::Ios
|
415
414
|
extend Appium::Ios::XcuitestGesture if automation_name_is_xcuitest? # Override touch actions
|
416
415
|
end
|
@@ -527,62 +527,6 @@ module Appium
|
|
527
527
|
eles_by_json string_visible_exact element, value
|
528
528
|
end
|
529
529
|
|
530
|
-
# @private
|
531
|
-
# For Appium(automation name), not XCUITest
|
532
|
-
# If there's no keyboard, then do nothing.
|
533
|
-
# If there's no close key, fallback to window tap.
|
534
|
-
# If close key is present then tap it.
|
535
|
-
# @param close_key [String] close key to tap. Default value is 'Done'
|
536
|
-
# @return [void]
|
537
|
-
def hide_ios_keyboard(close_key = 'Done')
|
538
|
-
#
|
539
|
-
# TODO: there are many various ways to hide the keyboard that work in different
|
540
|
-
# app specific circumstances. webview keyboard will require a window.tap for example.
|
541
|
-
#
|
542
|
-
# Find the top left corner of the keyboard and move up 10 pixels (origin.y - 10)
|
543
|
-
# now swipe down until the end of the window - 10 pixels.
|
544
|
-
# -10 to ensure we're not going outside the window bounds.
|
545
|
-
#
|
546
|
-
# Swiping inside the keyboard will not dismiss it.
|
547
|
-
#
|
548
|
-
# If the 'Done' key exists then that should be pressed to dismiss the keyboard
|
549
|
-
# because swiping to dismiss works only if such key doesn't exist.
|
550
|
-
#
|
551
|
-
# Don't use window.tap. See https://github.com/appium/appium-uiauto/issues/28
|
552
|
-
#
|
553
|
-
dismiss_keyboard = <<-JS.strip
|
554
|
-
if (!au.mainApp().keyboard().isNil()) {
|
555
|
-
var key = au.mainApp().keyboard().buttons()['#{close_key}']
|
556
|
-
if (key.isNil()) {
|
557
|
-
var startY = au.mainApp().keyboard().rect().origin.y - 10;
|
558
|
-
var endY = au.mainWindow().rect().size.height - 10;
|
559
|
-
au.flickApp(0, startY, 0, endY);
|
560
|
-
} else {
|
561
|
-
key.tap();
|
562
|
-
}
|
563
|
-
au.delay(1000);
|
564
|
-
}
|
565
|
-
JS
|
566
|
-
|
567
|
-
ignore do
|
568
|
-
# wait 5 seconds for a wild keyboard to appear. if the textfield is disabled
|
569
|
-
# then setValue will work, however the keyboard will never display
|
570
|
-
# because users are normally not allowed to type into it.
|
571
|
-
wait_true(5) do
|
572
|
-
execute_script '!au.mainApp().keyboard().isNil()'
|
573
|
-
end
|
574
|
-
|
575
|
-
# dismiss keyboard
|
576
|
-
execute_script dismiss_keyboard
|
577
|
-
end
|
578
|
-
|
579
|
-
# wait 5 seconds for keyboard to go away.
|
580
|
-
# if the keyboard isn't dismissed then wait_true will error.
|
581
|
-
wait_true(5) do
|
582
|
-
execute_script 'au.mainApp().keyboard().isNil()'
|
583
|
-
end
|
584
|
-
end
|
585
|
-
|
586
530
|
#
|
587
531
|
# predicate - the predicate to evaluate on the main app
|
588
532
|
#
|
@@ -142,6 +142,23 @@ module Appium
|
|
142
142
|
args[:offset] = offset if offset
|
143
143
|
execute_script 'mobile: selectPickerWheelValue', args
|
144
144
|
end
|
145
|
+
|
146
|
+
# @param action [String] The following actions are supported: accept, dismiss and getButtons. Mandatory parameter
|
147
|
+
# @param button_label [String] The label text of an existing alert button to click on.
|
148
|
+
# This is an optional parameter and is only valid in combination with accept and dismiss actions.
|
149
|
+
# @return nil or Selenium::WebDriver::Error::NoSuchAlertError if no action sheet or alert
|
150
|
+
#
|
151
|
+
# ```ruby
|
152
|
+
# alert action: "accept"
|
153
|
+
# alert action: "dismiss"
|
154
|
+
# ```
|
155
|
+
def alert(action:, button_label: nil)
|
156
|
+
return 'Set "accept", "dismiss" or "getButtons" for :action' unless %w(accept dismiss getButtons).include?(action)
|
157
|
+
|
158
|
+
args = { action: action }
|
159
|
+
args[:button_label] if button_label
|
160
|
+
execute_script 'mobile: alert', args
|
161
|
+
end
|
145
162
|
end # module XcuitestGesture
|
146
163
|
end # module Ios
|
147
164
|
end # module Appium
|
data/release_notes.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
#### v9.4.3 2017-05-03
|
2
|
+
|
3
|
+
- [c413bd7](https://github.com/appium/ruby_lib/commit/c413bd77d0fec58e1c2cce6821694bcf659b9e1b) [Release 9 4 3 (#566)](https://github.com/appium/ruby_lib/issues/566)
|
4
|
+
- [8e600af](https://github.com/appium/ruby_lib/commit/8e600af469f0e00f1fb6cce331c72b13d11598c8) [fix tests for uiautomator2 (#565)](https://github.com/appium/ruby_lib/issues/565)
|
5
|
+
- [ab8ecf8](https://github.com/appium/ruby_lib/commit/ab8ecf860088f690777e7c8086c31753463577c8) [Update android_uiautomator.md (#564)](https://github.com/appium/ruby_lib/issues/564)
|
6
|
+
- [4f035d3](https://github.com/appium/ruby_lib/commit/4f035d39a0b3a3c39a9ef6a5cd0d2cb19d39f7d4) [Use uiautomator for uiautomator2 (#561)](https://github.com/appium/ruby_lib/issues/561)
|
7
|
+
- [71d8eb6](https://github.com/appium/ruby_lib/commit/71d8eb676bf5ac6d83c5da112d068865d76ebab4) [Add link to issue in generating release notes (#562)](https://github.com/appium/ruby_lib/issues/562)
|
8
|
+
- [915e75d](https://github.com/appium/ruby_lib/commit/915e75d08e89b4248ca104124f7430463c13ab22) [don't use selenium-webdriver 3.5+ (#559)](https://github.com/appium/ruby_lib/issues/559)
|
9
|
+
- [7e9c8ef](https://github.com/appium/ruby_lib/commit/7e9c8ef7fbed4e076fa6aec49f20d786fa6cbdf6) [update workaround (#557)](https://github.com/appium/ruby_lib/issues/557)
|
10
|
+
- [801a5a0](https://github.com/appium/ruby_lib/commit/801a5a07e5c1c062f5d108a844721c7a569765a3) [add workaround (#556)](https://github.com/appium/ruby_lib/issues/556)
|
11
|
+
|
12
|
+
|
1
13
|
#### v9.4.2 2017-04-21
|
2
14
|
|
3
15
|
- [0cd41ef](https://github.com/appium/ruby_lib/commit/0cd41ef58b6abf8444fcb95db59aebb2c6c2a890) [Release 9 4 2 (#554)](https://github.com/appium/ruby_lib/issues/554)
|
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.4.
|
4
|
+
version: 9.4.4
|
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: 2017-05-
|
11
|
+
date: 2017-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -261,6 +261,7 @@ files:
|
|
261
261
|
- docs/ios_docs.md
|
262
262
|
- docs/ios_xcuitest.md
|
263
263
|
- docs/migration.md
|
264
|
+
- docs/travis.sample.yml
|
264
265
|
- docs_gen/docs_from_js.md
|
265
266
|
- docs_gen/make_docs.rb
|
266
267
|
- ios_tests/Gemfile
|