appium_lib 9.4.5 → 9.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/appium_lib.gemspec +1 -1
- data/docs/android_docs.md +224 -224
- data/docs/ios_docs.md +250 -250
- data/lib/appium_lib/common/version.rb +1 -1
- data/release_notes.md +13 -0
- metadata +1 -109
- data/android_tests/Gemfile +0 -2
- data/android_tests/LICENSE-2.0.txt +0 -202
- data/android_tests/Rakefile +0 -68
- data/android_tests/api.apk +0 -0
- data/android_tests/appium.txt +0 -11
- data/android_tests/flaky.txt +0 -1
- data/android_tests/lib/android/specs/android/element/alert.rb +0 -48
- data/android_tests/lib/android/specs/android/element/button.rb +0 -52
- data/android_tests/lib/android/specs/android/element/generic.rb +0 -58
- data/android_tests/lib/android/specs/android/element/text.rb +0 -35
- data/android_tests/lib/android/specs/android/element/textfield.rb +0 -62
- data/android_tests/lib/android/specs/android/helper.rb +0 -111
- data/android_tests/lib/android/specs/android/patch.rb +0 -27
- data/android_tests/lib/android/specs/common/command.rb +0 -52
- data/android_tests/lib/android/specs/common/device.rb +0 -159
- data/android_tests/lib/android/specs/common/device_touchaction.rb +0 -34
- data/android_tests/lib/android/specs/common/element/window.rb +0 -11
- data/android_tests/lib/android/specs/common/helper.rb +0 -112
- data/android_tests/lib/android/specs/common/patch.rb +0 -78
- data/android_tests/lib/android/specs/common/version.rb +0 -9
- data/android_tests/lib/android/specs/common/web_context.rb +0 -60
- data/android_tests/lib/android/specs/device/touch_actions.rb +0 -71
- data/android_tests/lib/android/specs/driver.rb +0 -280
- data/android_tests/lib/android/specs/install.rb +0 -26
- data/android_tests/lib/format.rb +0 -47
- data/android_tests/lib/run.rb +0 -91
- data/android_tests/readme.md +0 -30
- data/grid/README.md +0 -21
- data/grid/appium.txt.ios.example +0 -15
- data/grid/config.json +0 -25
- data/grid/hub_config.json +0 -14
- data/grid/selenium-server-standalone-2.53.1.jar +0 -0
- data/grid/selenium-server-standalone-3.2.0.jar +0 -0
- data/ios_tests/Gemfile +0 -4
- data/ios_tests/LICENSE-2.0.txt +0 -202
- data/ios_tests/Rakefile +0 -54
- data/ios_tests/UICatalog.app.zip +0 -0
- data/ios_tests/UICatalog.app/12-6AM.png +0 -0
- data/ios_tests/UICatalog.app/12-6PM.png +0 -0
- data/ios_tests/UICatalog.app/6-12AM.png +0 -0
- data/ios_tests/UICatalog.app/6-12PM.png +0 -0
- data/ios_tests/UICatalog.app/Default-568h@2x.png +0 -0
- data/ios_tests/UICatalog.app/Default@2x.png +0 -0
- data/ios_tests/UICatalog.app/Info.plist +0 -0
- data/ios_tests/UICatalog.app/PkgInfo +0 -1
- data/ios_tests/UICatalog.app/UIButton_custom.png +0 -0
- data/ios_tests/UICatalog.app/UICatalog +0 -0
- data/ios_tests/UICatalog.app/blueButton.png +0 -0
- data/ios_tests/UICatalog.app/bookmarkImage.png +0 -0
- data/ios_tests/UICatalog.app/bookmarkImageHighlighted.png +0 -0
- data/ios_tests/UICatalog.app/divider.png +0 -0
- data/ios_tests/UICatalog.app/en.lproj/AlertsViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ButtonsViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ControlsViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ImagesViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/Localizable.strings +0 -0
- data/ios_tests/UICatalog.app/en.lproj/MainWindow.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/PickerViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/SearchBarController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/SegmentViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/TextFieldController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/TextViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ToolbarViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/TransitionViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/WebViewController.nib +0 -0
- data/ios_tests/UICatalog.app/orangeslide.png +0 -0
- data/ios_tests/UICatalog.app/scene1.jpg +0 -0
- data/ios_tests/UICatalog.app/scene2.jpg +0 -0
- data/ios_tests/UICatalog.app/scene3.jpg +0 -0
- data/ios_tests/UICatalog.app/scene4.jpg +0 -0
- data/ios_tests/UICatalog.app/scene5.jpg +0 -0
- data/ios_tests/UICatalog.app/searchBarBackground.png +0 -0
- data/ios_tests/UICatalog.app/segment_check.png +0 -0
- data/ios_tests/UICatalog.app/segment_search.png +0 -0
- data/ios_tests/UICatalog.app/segment_tools.png +0 -0
- data/ios_tests/UICatalog.app/segmentedBackground.png +0 -0
- data/ios_tests/UICatalog.app/slider_ball.png +0 -0
- data/ios_tests/UICatalog.app/toolbarBackground.png +0 -0
- data/ios_tests/UICatalog.app/whiteButton.png +0 -0
- data/ios_tests/UICatalog.app/yellowslide.png +0 -0
- data/ios_tests/appium.txt +0 -15
- data/ios_tests/data/unicode.txt +0 -1
- data/ios_tests/flaky.txt +0 -1
- data/ios_tests/lib/common.rb +0 -84
- data/ios_tests/lib/format.rb +0 -23
- data/ios_tests/lib/ios/specs/common/command.rb +0 -45
- data/ios_tests/lib/ios/specs/common/element/window.rb +0 -17
- data/ios_tests/lib/ios/specs/common/helper.rb +0 -228
- data/ios_tests/lib/ios/specs/common/patch.rb +0 -54
- data/ios_tests/lib/ios/specs/common/version.rb +0 -17
- data/ios_tests/lib/ios/specs/common/web_context.rb +0 -15
- data/ios_tests/lib/ios/specs/device/device.rb +0 -130
- data/ios_tests/lib/ios/specs/device/multi_touch.rb +0 -31
- data/ios_tests/lib/ios/specs/device/touch_actions.rb +0 -90
- data/ios_tests/lib/ios/specs/driver.rb +0 -308
- data/ios_tests/lib/ios/specs/ios/element/alert.rb +0 -51
- data/ios_tests/lib/ios/specs/ios/element/button.rb +0 -58
- data/ios_tests/lib/ios/specs/ios/element/generic.rb +0 -37
- data/ios_tests/lib/ios/specs/ios/element/text.rb +0 -63
- data/ios_tests/lib/ios/specs/ios/element/textfield.rb +0 -135
- data/ios_tests/lib/ios/specs/ios/helper.rb +0 -59
- data/ios_tests/lib/ios/specs/ios/mobile_methods.rb +0 -20
- data/ios_tests/lib/ios/specs/ios/patch.rb +0 -34
- data/ios_tests/lib/ios/specs/ios/xcuitest_gestures.rb +0 -110
- data/ios_tests/lib/run.rb +0 -4
- data/ios_tests/readme.md +0 -31
- data/ios_tests/upload/sauce_storage.rb +0 -67
- data/ios_tests/upload/upload.rb +0 -6
@@ -1,52 +0,0 @@
|
|
1
|
-
# rake android['android/element/button']
|
2
|
-
describe 'android/element/button' do
|
3
|
-
def before_first
|
4
|
-
# nav to buttons activity
|
5
|
-
wait { find('App').click }
|
6
|
-
wait { find('Activity').click }
|
7
|
-
wait { find('Animation').click }
|
8
|
-
end
|
9
|
-
|
10
|
-
def after_last
|
11
|
-
# nav back to home activity
|
12
|
-
3.times { back }
|
13
|
-
end
|
14
|
-
|
15
|
-
def fade_in
|
16
|
-
'Fade in'
|
17
|
-
end
|
18
|
-
|
19
|
-
t { before_first }
|
20
|
-
|
21
|
-
t 'button' do
|
22
|
-
# by index
|
23
|
-
2.times { wait { button(1).name.must_equal fade_in } }
|
24
|
-
|
25
|
-
# by name contains
|
26
|
-
wait { button('ade').name.must_equal fade_in }
|
27
|
-
end
|
28
|
-
|
29
|
-
t 'buttons' do
|
30
|
-
exp = ['Zoom in', 'Modern zoom in', 'Thumbnail zoom']
|
31
|
-
wait { buttons('zoom').map(&:text).must_equal exp }
|
32
|
-
wait { buttons.length.must_equal 6 }
|
33
|
-
end
|
34
|
-
|
35
|
-
t 'first_button' do
|
36
|
-
wait { first_button.name.must_equal fade_in }
|
37
|
-
end
|
38
|
-
|
39
|
-
t 'last_button' do
|
40
|
-
wait { last_button.name.must_equal 'Thumbnail zoom' }
|
41
|
-
end
|
42
|
-
|
43
|
-
t 'button_exact' do
|
44
|
-
wait { button_exact(fade_in).name.must_equal fade_in }
|
45
|
-
end
|
46
|
-
|
47
|
-
t 'buttons_exact' do
|
48
|
-
2.times { wait { buttons_exact(fade_in).first.name.must_equal fade_in } }
|
49
|
-
end
|
50
|
-
|
51
|
-
t { after_last }
|
52
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# rake android['android/element/generic']
|
2
|
-
describe 'android/element/generic' do
|
3
|
-
def content
|
4
|
-
'Content'
|
5
|
-
end
|
6
|
-
|
7
|
-
def partial
|
8
|
-
'tent'
|
9
|
-
end
|
10
|
-
|
11
|
-
t 'find works before and after get_source' do
|
12
|
-
wait { find(partial).text.must_equal content }
|
13
|
-
wait { get_source.class.must_equal String }
|
14
|
-
wait { find(partial).text.must_equal content }
|
15
|
-
end
|
16
|
-
|
17
|
-
t 'find' do
|
18
|
-
wait { find(partial).text.must_equal content }
|
19
|
-
end
|
20
|
-
|
21
|
-
t 'finds' do
|
22
|
-
wait { finds(partial).first.text.must_equal content }
|
23
|
-
end
|
24
|
-
|
25
|
-
t 'find_exact' do
|
26
|
-
wait { find_exact(content).text.must_equal content }
|
27
|
-
end
|
28
|
-
|
29
|
-
t 'finds_exact' do
|
30
|
-
wait { finds_exact(content).first.text.must_equal content }
|
31
|
-
end
|
32
|
-
|
33
|
-
# scroll_to is broken
|
34
|
-
t 'scroll_to' do
|
35
|
-
wait { find('Views').click }
|
36
|
-
wait { scroll_to('scrollbars').text.must_equal 'ScrollBars' }
|
37
|
-
|
38
|
-
wait { find('ScrollBars').click }
|
39
|
-
wait { text('style').click }
|
40
|
-
wait { scroll_to('Developers', 1).text.must_include 'What would it take to build a better mobile phone?' }
|
41
|
-
back
|
42
|
-
back
|
43
|
-
# back to start activity
|
44
|
-
back
|
45
|
-
end
|
46
|
-
|
47
|
-
t 'scroll_to_exact' do
|
48
|
-
wait { find('Views').click }
|
49
|
-
|
50
|
-
wait { scroll_to_exact('ScrollBars').text.must_equal 'ScrollBars' }
|
51
|
-
wait { find('ScrollBars').click }
|
52
|
-
wait { text('style').click }
|
53
|
-
back
|
54
|
-
back
|
55
|
-
# back to start activity
|
56
|
-
back
|
57
|
-
end
|
58
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# rake android['android/element/text']
|
2
|
-
describe 'android/element/text' do
|
3
|
-
def must_raise_no_element
|
4
|
-
proc { yield }.must_raise Selenium::WebDriver::Error::NoSuchElementError
|
5
|
-
end
|
6
|
-
|
7
|
-
t 'text' do
|
8
|
-
wait { text(1).text.must_equal 'API Demos' }
|
9
|
-
wait { text('mos').text.must_equal 'API Demos' }
|
10
|
-
end
|
11
|
-
|
12
|
-
t 'texts' do
|
13
|
-
wait { texts('i').length.must_equal 7 }
|
14
|
-
wait { texts.length.must_equal 13 }
|
15
|
-
end
|
16
|
-
|
17
|
-
t 'first_text' do
|
18
|
-
wait { first_text.text.must_equal 'API Demos' }
|
19
|
-
end
|
20
|
-
|
21
|
-
t 'last_text' do
|
22
|
-
wait { last_text.text.must_equal 'Views' }
|
23
|
-
end
|
24
|
-
|
25
|
-
t 'text_exact' do
|
26
|
-
must_raise_no_element { text_exact 'mos' }
|
27
|
-
|
28
|
-
# should pass
|
29
|
-
wait { text_exact('API Demos').text.must_equal 'API Demos' }
|
30
|
-
end
|
31
|
-
|
32
|
-
t 'texts_exact' do
|
33
|
-
wait { texts_exact('API Demos').length.must_equal 1 }
|
34
|
-
end
|
35
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
describe 'android/element/textfield' do
|
2
|
-
def must_raise_no_element
|
3
|
-
proc { yield }.must_raise Selenium::WebDriver::Error::NoSuchElementError
|
4
|
-
end
|
5
|
-
|
6
|
-
def left
|
7
|
-
'Left is best'
|
8
|
-
end
|
9
|
-
|
10
|
-
def right
|
11
|
-
'Right is always right'
|
12
|
-
end
|
13
|
-
|
14
|
-
def before_first
|
15
|
-
# nav to activity
|
16
|
-
wait { find('app').click }
|
17
|
-
wait { find('activity').click }
|
18
|
-
wait { find('custom title').click }
|
19
|
-
end
|
20
|
-
|
21
|
-
def after_last
|
22
|
-
# back to start
|
23
|
-
3.times { back }
|
24
|
-
end
|
25
|
-
|
26
|
-
t { before_first }
|
27
|
-
|
28
|
-
t 'textfield' do
|
29
|
-
wait { textfield(1).text.must_equal left }
|
30
|
-
wait { textfield('right').text.must_equal right }
|
31
|
-
end
|
32
|
-
|
33
|
-
t 'textfields' do
|
34
|
-
wait { textfields('right').first.text.must_equal right }
|
35
|
-
wait { textfields.length.must_equal 2 }
|
36
|
-
end
|
37
|
-
|
38
|
-
t 'first_textfield' do
|
39
|
-
wait { first_textfield.text.must_equal left }
|
40
|
-
end
|
41
|
-
|
42
|
-
t 'last_textfield' do
|
43
|
-
wait { last_textfield.text.must_equal right }
|
44
|
-
end
|
45
|
-
|
46
|
-
t 'textfield_exact' do
|
47
|
-
must_raise_no_element { textfield_exact 'zz' }
|
48
|
-
wait { textfield_exact(left).text.must_equal left }
|
49
|
-
end
|
50
|
-
|
51
|
-
t 'textfields_exact' do
|
52
|
-
wait { textfields_exact('zz').must_equal [] }
|
53
|
-
wait { textfields_exact(left).first.text.must_equal left }
|
54
|
-
end
|
55
|
-
|
56
|
-
t 'hide_keyboard' do
|
57
|
-
first_textfield.click
|
58
|
-
hide_keyboard
|
59
|
-
end
|
60
|
-
|
61
|
-
t { after_last }
|
62
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# rubocop:disable Metrics/LineLength
|
2
|
-
|
3
|
-
# rake android[android/helper]
|
4
|
-
describe 'android/helper' do
|
5
|
-
t 'tags' do
|
6
|
-
wait { tags('android.widget.TextView').length.must_equal 13 }
|
7
|
-
end
|
8
|
-
|
9
|
-
# t 'get_selendroid_inspect' # only works on selendroid
|
10
|
-
t 'get_page_class' do
|
11
|
-
# digit values change based on screen size
|
12
|
-
# larger screens have more elements
|
13
|
-
|
14
|
-
act = get_page_class
|
15
|
-
act.must_include 'android.widget.TextView'
|
16
|
-
act.must_include 'android.widget.ListView'
|
17
|
-
act.must_include 'android.widget.FrameLayout'
|
18
|
-
act.must_include 'hierarchy'
|
19
|
-
end
|
20
|
-
|
21
|
-
# t 'page_class' do # tested by get_page_class
|
22
|
-
|
23
|
-
t 'get_android_inspect' do
|
24
|
-
# line count changes based on screen size
|
25
|
-
wait { get_android_inspect.split("\n").length.must_be :>=, 40 }
|
26
|
-
end
|
27
|
-
|
28
|
-
# t 'get_inspect' do # tested by get_android_inspect
|
29
|
-
# t 'page' do # tested by get_android_inspect
|
30
|
-
|
31
|
-
def id_key
|
32
|
-
'animation_2_instructions'
|
33
|
-
end
|
34
|
-
|
35
|
-
def id_value
|
36
|
-
'Select an animation:'
|
37
|
-
end
|
38
|
-
|
39
|
-
t 'xml_keys' do
|
40
|
-
wait do
|
41
|
-
id_pair = xml_keys id_key
|
42
|
-
id_pair = id_pair.to_a[0]
|
43
|
-
id_pair.length.must_equal 2
|
44
|
-
id_pair.first.must_equal id_key
|
45
|
-
id_pair.last.must_equal id_value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
t 'resolve_id' do
|
50
|
-
wait do
|
51
|
-
str = resolve_id id_key
|
52
|
-
str.must_equal id_value
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
t 'xml_values' do
|
57
|
-
wait do
|
58
|
-
value = xml_values(id_value).first.last
|
59
|
-
value.must_equal id_value
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
t 'find by id' do
|
64
|
-
wait { find('accessibility').click }
|
65
|
-
wait { find('accessibility node provider').click }
|
66
|
-
|
67
|
-
if !automation_name_is_uiautomator2?
|
68
|
-
wait { text 'Accessibility/Accessibility Node Provider' }
|
69
|
-
else
|
70
|
-
# With string.xml
|
71
|
-
# Only for uiautomator1
|
72
|
-
wait { id 'accessibility_node_provider' }
|
73
|
-
end
|
74
|
-
|
75
|
-
2.times { back }
|
76
|
-
end
|
77
|
-
|
78
|
-
t 'ids' do
|
79
|
-
wait { ids('android:id/text1').length.must_equal 12 }
|
80
|
-
end
|
81
|
-
|
82
|
-
t '_parse_current_app_line' do
|
83
|
-
# test values from appium's test/unit/adb-specs.js
|
84
|
-
expected = [
|
85
|
-
# api 16 line
|
86
|
-
['mFocusedApp=AppWindowToken{417ee228 token=Token{41602f78 ActivityRecord{41798a08 io.appium.android.apis/.ApiDemos}}}',
|
87
|
-
'io.appium.android.apis',
|
88
|
-
'.ApiDemos'],
|
89
|
-
# api 18 line
|
90
|
-
['mFocusedApp=AppWindowToken{41744660 token=Token{41ac7198 ActivityRecord{41af55c8 u0 io.appium.android.apis/.ApiDemos}}}',
|
91
|
-
'io.appium.android.apis',
|
92
|
-
'.ApiDemos'],
|
93
|
-
# api 19
|
94
|
-
['mFocusedApp=AppWindowToken{b40af858 token=Token{b3e2ce38 ActivityRecord{b3eb47d8 u0 io.appium.android.apis/.ApiDemos t6}}}',
|
95
|
-
'io.appium.android.apis',
|
96
|
-
'.ApiDemos'],
|
97
|
-
# api 16 selendroid
|
98
|
-
['mFocusedApp=AppWindowToken{4157a2c8 token=Token{41582628 ActivityRecord{415821f0 com.android.launcher/com.android.launcher2.Launcher}}}',
|
99
|
-
'com.android.launcher',
|
100
|
-
'com.android.launcher2.Launcher']
|
101
|
-
]
|
102
|
-
|
103
|
-
expected.each do |line, package, activity|
|
104
|
-
parsed = _parse_current_app_line(line)
|
105
|
-
raise "failed to parse #{line}" if parsed.nil?
|
106
|
-
parsed.package.must_equal package
|
107
|
-
parsed.activity.must_equal activity
|
108
|
-
parsed.am_start.must_equal package + '/' + activity
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# rake android[android/patch]
|
2
|
-
describe 'android/patch.rb' do
|
3
|
-
t 'type' do
|
4
|
-
# nav to textfield
|
5
|
-
wait { find('app').click }
|
6
|
-
wait { find('Search').click }
|
7
|
-
wait { find('Invoke Search').click }
|
8
|
-
|
9
|
-
wait { first_textfield.type 'ok' }
|
10
|
-
wait { first_textfield.text.must_equal 'ok' }
|
11
|
-
|
12
|
-
# TODO: how to invoke random am start commands?
|
13
|
-
# nav to start activity
|
14
|
-
# io.appium.android.apis/.ApiDemos
|
15
|
-
|
16
|
-
# keyboard may exist, if it doesn't then an error will raise
|
17
|
-
ignore { hide_keyboard }
|
18
|
-
|
19
|
-
# return to app start
|
20
|
-
back
|
21
|
-
wait { find('Invoke Search') }
|
22
|
-
back
|
23
|
-
wait { find_exact('Search') }
|
24
|
-
back
|
25
|
-
wait { find('app') }
|
26
|
-
end
|
27
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# rake android[common/command]
|
2
|
-
describe 'common/command.rb' do
|
3
|
-
def before_first
|
4
|
-
wait { current_activity.must_equal '.ApiDemos' }
|
5
|
-
end
|
6
|
-
|
7
|
-
t 'before_first' do
|
8
|
-
before_first
|
9
|
-
end
|
10
|
-
|
11
|
-
t 'check all command no arg' do
|
12
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:shake).must_equal true
|
13
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:launch_app).must_equal true
|
14
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:close_app).must_equal true
|
15
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:reset).must_equal true
|
16
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:device_locked?).must_equal true
|
17
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:open_notifications).must_equal true
|
18
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:toggle_airplane_mode).must_equal true
|
19
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:current_activity).must_equal true
|
20
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_network_connection).must_equal true
|
21
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_performance_data_types).must_equal true
|
22
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_performance_data).must_equal true
|
23
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_system_bars).must_equal true
|
24
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_display_density).must_equal true
|
25
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:is_keyboard_shown).must_equal true
|
26
|
-
end
|
27
|
-
|
28
|
-
t 'check all command with arg' do
|
29
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:available_contexts).must_equal true
|
30
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:app_strings).must_equal true
|
31
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:lock).must_equal true
|
32
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:install_app).must_equal true
|
33
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:remove_app).must_equal true
|
34
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:app_installed?).must_equal true
|
35
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:background_app).must_equal true
|
36
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:start_activity).must_equal true
|
37
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:set_context).must_equal true
|
38
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:hide_keyboard).must_equal true
|
39
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:press_keycode).must_equal true
|
40
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:long_press_keycode).must_equal true
|
41
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:set_immediate_value).must_equal true
|
42
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:push_file).must_equal true
|
43
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:pull_file).must_equal true
|
44
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:pull_folder).must_equal true
|
45
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:end_coverage).must_equal true
|
46
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_settings).must_equal true
|
47
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:update_settings).must_equal true
|
48
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:set_network_connection).must_equal true
|
49
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:touch_actions).must_equal true
|
50
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:multi_touch).must_equal true
|
51
|
-
end
|
52
|
-
end
|
@@ -1,159 +0,0 @@
|
|
1
|
-
# rake android[common/device]
|
2
|
-
describe 'common/device' do
|
3
|
-
# Not yet implemented
|
4
|
-
t 'shake' do
|
5
|
-
# TODO: write test
|
6
|
-
end
|
7
|
-
|
8
|
-
t 'remove & install' do
|
9
|
-
# TODO: write test
|
10
|
-
# remove 'com.example.android.apis'
|
11
|
-
# install ENV['APP_PATH']
|
12
|
-
end
|
13
|
-
|
14
|
-
t 'get_performance_data_types' do
|
15
|
-
expected = %w(batteryinfo cpuinfo memoryinfo networkinfo)
|
16
|
-
get_performance_data_types.sort.must_equal expected
|
17
|
-
|
18
|
-
get_performance_data(package_name: 'io.appium.android.apis',
|
19
|
-
data_type: 'cpuinfo').must_equal [%w(user kernel), %w(0 0)]
|
20
|
-
end
|
21
|
-
|
22
|
-
t 'device_time' do
|
23
|
-
Date.parse(device_time)
|
24
|
-
end
|
25
|
-
|
26
|
-
t 'get_system_bars' do
|
27
|
-
get_system_bars
|
28
|
-
end
|
29
|
-
|
30
|
-
t 'get_display_density' do
|
31
|
-
(get_display_density > 0).must_equal true
|
32
|
-
end
|
33
|
-
|
34
|
-
t 'system_bars' do
|
35
|
-
is_keyboard_shown.must_equal false
|
36
|
-
end
|
37
|
-
|
38
|
-
t 'background_app' do
|
39
|
-
wait { background_app 5 }
|
40
|
-
end
|
41
|
-
|
42
|
-
t 'start_activity' do
|
43
|
-
wait { current_activity.must_equal '.ApiDemos' }
|
44
|
-
start_activity app_package: 'io.appium.android.apis',
|
45
|
-
app_activity: '.accessibility.AccessibilityNodeProviderActivity'
|
46
|
-
wait { current_activity.include?('Node').must_equal true }
|
47
|
-
start_activity app_package: 'com.android.settings', app_activity: '.Settings',
|
48
|
-
app_wait_package: 'com.android.settings', app_wait_activity: '.Settings'
|
49
|
-
wait { current_activity.include?('Settings').must_equal true }
|
50
|
-
end
|
51
|
-
|
52
|
-
t 'installed' do
|
53
|
-
wait { app_installed?('fake_app').must_equal false }
|
54
|
-
end
|
55
|
-
|
56
|
-
t 'reset' do
|
57
|
-
reset
|
58
|
-
wait { text(1).text.must_equal 'API Demos' }
|
59
|
-
end
|
60
|
-
|
61
|
-
t 'device_locked?' do
|
62
|
-
lock 5
|
63
|
-
wait { device_locked?.must_equal true }
|
64
|
-
press_keycode 82
|
65
|
-
wait { device_locked?.must_equal false }
|
66
|
-
end
|
67
|
-
|
68
|
-
t 'close & launch' do
|
69
|
-
close_app
|
70
|
-
launch_app
|
71
|
-
end
|
72
|
-
|
73
|
-
t 'current_activity' do
|
74
|
-
wait { current_activity.must_equal '.ApiDemos' }
|
75
|
-
end
|
76
|
-
|
77
|
-
t 'app_strings' do
|
78
|
-
wait_true { app_strings.key? 'activity_save_restore' }
|
79
|
-
end
|
80
|
-
|
81
|
-
def must_return_element(element)
|
82
|
-
element.class.must_equal Selenium::WebDriver::Element
|
83
|
-
end
|
84
|
-
|
85
|
-
t 'press_keycode' do
|
86
|
-
# http://developer.android.com/reference/android/view/KeyEvent.html
|
87
|
-
press_keycode 176
|
88
|
-
end
|
89
|
-
|
90
|
-
t 'long_press_keycode' do
|
91
|
-
# http://developer.android.com/reference/android/view/KeyEvent.html
|
92
|
-
long_press_keycode 176
|
93
|
-
end
|
94
|
-
|
95
|
-
t 'open_notifications' do
|
96
|
-
# test & comments from https://github.com/appium/appium/blob/master/test/functional/android/apidemos/notifications-specs.js#L19
|
97
|
-
# get to the notification page
|
98
|
-
wait { scroll_to('App').click }
|
99
|
-
wait { scroll_to('Notification').click }
|
100
|
-
wait { scroll_to('Status Bar').click }
|
101
|
-
# create a notification
|
102
|
-
wait { button(':-|').click }
|
103
|
-
open_notifications
|
104
|
-
# shouldn't see the elements behind shade
|
105
|
-
wait_true { !exists { find(':-|') } }
|
106
|
-
# should see the notification
|
107
|
-
wait_true { text_exact 'Mood ring' }
|
108
|
-
# return to app
|
109
|
-
back
|
110
|
-
# should be able to see elements from app
|
111
|
-
wait_true { button(':-|') }
|
112
|
-
|
113
|
-
# go back, waiting for each page to load.
|
114
|
-
# if we go back using 3.times { back }
|
115
|
-
# then android will flake out and discard some back events
|
116
|
-
back
|
117
|
-
wait { text('Status Bar') }
|
118
|
-
back
|
119
|
-
wait { text('Notification') }
|
120
|
-
back
|
121
|
-
wait { text('App') }
|
122
|
-
end
|
123
|
-
|
124
|
-
t 'push and pull file' do
|
125
|
-
file = 'A Fine Day'
|
126
|
-
path = '/data/local/tmp/remote.txt'
|
127
|
-
wait do
|
128
|
-
push_file path, file
|
129
|
-
read_file = pull_file path
|
130
|
-
read_file.must_equal file
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
t 'pull_folder' do
|
135
|
-
data = pull_folder '/data/local/tmp'
|
136
|
-
data.length.must_be :>, 100
|
137
|
-
end
|
138
|
-
|
139
|
-
t 'ime_available_engines' do
|
140
|
-
ime_latin = 'com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME'
|
141
|
-
|
142
|
-
wait { find('app').click }
|
143
|
-
wait { find('Search').click }
|
144
|
-
wait { find('Invoke Search').click }
|
145
|
-
|
146
|
-
imes = ime_available_engines
|
147
|
-
imes.include?(ime_latin).must_equal true
|
148
|
-
|
149
|
-
wait { ime_activate(ime_latin) }
|
150
|
-
ime_active_engine.must_equal ime_latin
|
151
|
-
ime_activated.must_equal true
|
152
|
-
|
153
|
-
wait { ime_deactivate }
|
154
|
-
ime_active_engine.wont_equal ime_latin
|
155
|
-
|
156
|
-
wait { ime_activate(ime_latin) }
|
157
|
-
ime_active_engine.must_equal ime_latin
|
158
|
-
end
|
159
|
-
end
|