appium_lib 9.4.5 → 9.4.6
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 +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
data/ios_tests/Rakefile
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
require 'rubocop/rake_task'
|
|
4
|
-
|
|
5
|
-
task default: :ios
|
|
6
|
-
|
|
7
|
-
# Run sh and ignore exception
|
|
8
|
-
# rubocop:disable Lint/HandleExceptions
|
|
9
|
-
def run_sh(cmd)
|
|
10
|
-
sh cmd
|
|
11
|
-
rescue
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Run cmd. On failure run install and try again.
|
|
15
|
-
def bash(cmd)
|
|
16
|
-
sh cmd do |successful, result|
|
|
17
|
-
# exitstatus 7 means bundle install failed
|
|
18
|
-
# exitstatus 1 means the test failed
|
|
19
|
-
if !successful && result.exitstatus == 7
|
|
20
|
-
Rake::Task['install'].execute
|
|
21
|
-
run_sh cmd
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Run a single test with:
|
|
27
|
-
# rake ios['ios/element/generic']
|
|
28
|
-
#
|
|
29
|
-
# rake ios['driver']
|
|
30
|
-
#
|
|
31
|
-
# Run all tests with:
|
|
32
|
-
# rake ios
|
|
33
|
-
desc 'Run the iOS tests'
|
|
34
|
-
task :ios, :args, :test_file do |_args, test_file|
|
|
35
|
-
# rake android['ok']
|
|
36
|
-
# args = android
|
|
37
|
-
# test_file = {:args=>"ok"}
|
|
38
|
-
test_file = test_file[:args]
|
|
39
|
-
cmd = 'bundle exec ruby ./lib/run.rb ios'
|
|
40
|
-
cmd += %( "#{test_file}") if test_file
|
|
41
|
-
bash cmd
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
desc 'Run bundle install'
|
|
45
|
-
task :install do
|
|
46
|
-
sh 'bundle install'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
desc 'Execute RuboCop static code analysis'
|
|
50
|
-
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
51
|
-
t.patterns = %w(**/*.rb)
|
|
52
|
-
t.options = %w(-D)
|
|
53
|
-
t.fail_on_error = false
|
|
54
|
-
end
|
data/ios_tests/UICatalog.app.zip
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
APPL????
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/ios_tests/appium.txt
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
[caps]
|
|
2
|
-
platformName = "ios"
|
|
3
|
-
platformVersion = "10.3"
|
|
4
|
-
deviceName ="iPhone Simulator"
|
|
5
|
-
automationName = 'XCUITest'
|
|
6
|
-
app = "./UICatalog.app"
|
|
7
|
-
some_capability = "some_capability"
|
|
8
|
-
|
|
9
|
-
[appium_lib]
|
|
10
|
-
sauce_username = ""
|
|
11
|
-
sauce_access_key = ""
|
|
12
|
-
sauce_endpoint = ""
|
|
13
|
-
wait = 30
|
|
14
|
-
wait_timeout = 20
|
|
15
|
-
wait_interval = 1
|
data/ios_tests/data/unicode.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
®
|
data/ios_tests/flaky.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ios = "lib/ios/specs/"
|
data/ios_tests/lib/common.rb
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# common methods
|
|
3
|
-
def back_click(opts = {})
|
|
4
|
-
opts ||= {}
|
|
5
|
-
search_wait = opts.fetch(:wait, 60 * 1.7)
|
|
6
|
-
# iOS may have multiple 'back' buttons
|
|
7
|
-
# select the first displayed? back button.
|
|
8
|
-
wait(search_wait) do
|
|
9
|
-
button_exact('Back').click
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def leave_textfields
|
|
14
|
-
back_click
|
|
15
|
-
screen.must_equal catalog
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def go_to_textfields
|
|
19
|
-
screen.must_equal catalog
|
|
20
|
-
wait_true do
|
|
21
|
-
UI::Inventory.xcuitest? ? find_element(:name, 'TextFields').click : text('textfield').click
|
|
22
|
-
screen == 'TextFields' # wait for screen transition
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def screen
|
|
27
|
-
$driver.find_element(:class, UI::Inventory.navbar).name
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def catalog
|
|
31
|
-
'UICatalog'
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
module UI
|
|
35
|
-
module Inventory
|
|
36
|
-
def self.xcuitest?
|
|
37
|
-
$driver.automation_name_is_xcuitest?
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.navbar
|
|
41
|
-
xcuitest? ? 'XCUIElementTypeNavigationBar' : 'UIANavigationBar'
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def self.button
|
|
45
|
-
xcuitest? ? 'XCUIElementTypeButton' : 'UIAButton'
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def self.static_text
|
|
49
|
-
xcuitest? ? 'XCUIElementTypeStaticText' : 'UIAStaticText'
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def self.text_field
|
|
53
|
-
xcuitest? ? 'XCUIElementTypeTextField' : 'UIATextField'
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def self.secure_text_field
|
|
57
|
-
xcuitest? ? 'XCUIElementTypeSecureTextField' : 'UIASecureTextField'
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def self.picker
|
|
61
|
-
xcuitest? ? 'XCUIElementTypePicker' : 'UIAPicker'
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def self.action_sheet
|
|
65
|
-
xcuitest? ? 'XCUIElementTypeActionSheet' : 'UIActionSheet'
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def self.table
|
|
69
|
-
xcuitest? ? 'XCUIElementTypeTable' : 'UIATable'
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def self.table_cell
|
|
73
|
-
xcuitest? ? 'XCUIElementTypeCell' : 'UIATableCell'
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def self.other
|
|
77
|
-
xcuitest? ? 'XCUIElementTypeOther' : raise('unknown UIA element: other')
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def self.status_bar
|
|
81
|
-
xcuitest? ? 'XCUIElementTypeStatusBar' : 'UIAStatusBar'
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
data/ios_tests/lib/format.rb
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# helper code useful for writing and verifying tests using Pry
|
|
2
|
-
list = <<TXT
|
|
3
|
-
alert_click
|
|
4
|
-
alert_text
|
|
5
|
-
alert_accept
|
|
6
|
-
alert_accept_text
|
|
7
|
-
alert_dismiss
|
|
8
|
-
alert_dismiss_text
|
|
9
|
-
TXT
|
|
10
|
-
|
|
11
|
-
list.split("\n").each do |method|
|
|
12
|
-
puts "t '#{method}' do"
|
|
13
|
-
puts
|
|
14
|
-
puts 'end'
|
|
15
|
-
puts
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# for Pry
|
|
19
|
-
# class Object
|
|
20
|
-
# def must_equal b
|
|
21
|
-
# raise 'not equal' unless self == b
|
|
22
|
-
# end
|
|
23
|
-
# end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# rake ios[common/command]
|
|
2
|
-
describe 'common/command.rb' do
|
|
3
|
-
def before_first
|
|
4
|
-
screen.must_equal catalog
|
|
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?(:device_time).must_equal true
|
|
18
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:current_context).must_equal true
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
t 'check all command with arg' do
|
|
22
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:available_contexts).must_equal true
|
|
23
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:app_strings).must_equal true
|
|
24
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:lock).must_equal true
|
|
25
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:install_app).must_equal true
|
|
26
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:remove_app).must_equal true
|
|
27
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:app_installed?).must_equal true
|
|
28
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:background_app).must_equal true
|
|
29
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:start_activity).must_equal true
|
|
30
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:set_context).must_equal true
|
|
31
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:hide_keyboard).must_equal true
|
|
32
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:press_keycode).must_equal true
|
|
33
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:long_press_keycode).must_equal true
|
|
34
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:set_immediate_value).must_equal true
|
|
35
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:push_file).must_equal true
|
|
36
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:pull_file).must_equal true
|
|
37
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:pull_folder).must_equal true
|
|
38
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:touch_id).must_equal true
|
|
39
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:toggle_touch_id_enrollment).must_equal true
|
|
40
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:get_settings).must_equal true
|
|
41
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:update_settings).must_equal true
|
|
42
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:touch_actions).must_equal true
|
|
43
|
-
Selenium::WebDriver::Remote::Bridge.method_defined?(:multi_touch).must_equal true
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# rake ios[common/element/window]
|
|
2
|
-
describe 'common/element/window' do
|
|
3
|
-
def before_first
|
|
4
|
-
screen.must_equal catalog
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
t 'before_first' do
|
|
8
|
-
before_first
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# rubocop:disable Lint/UnifiedInteger
|
|
12
|
-
t 'window_size' do
|
|
13
|
-
size = window_size
|
|
14
|
-
size.width.class.must_equal Fixnum
|
|
15
|
-
size.height.class.must_equal Fixnum
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
# rake ios[common/helper]
|
|
2
|
-
describe 'common/helper.rb' do
|
|
3
|
-
def before_first
|
|
4
|
-
screen.must_equal catalog
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
t 'before_first' do
|
|
8
|
-
before_first
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
wait_opts = { timeout: 0.2, interval: 0.2 } # max_wait, interval
|
|
12
|
-
|
|
13
|
-
# There's no `must_not_raise` as the opposite of must_raise
|
|
14
|
-
#
|
|
15
|
-
# By default code is expected to not raise exceptions.
|
|
16
|
-
# must_not_raise is a no-op.
|
|
17
|
-
|
|
18
|
-
# wait is a success unless an error is raised
|
|
19
|
-
# max_wait=0 is infinity to use 0.1
|
|
20
|
-
t 'wait' do
|
|
21
|
-
# successful wait should not raise error
|
|
22
|
-
wait(wait_opts) { true }
|
|
23
|
-
wait(wait_opts) { false }
|
|
24
|
-
wait(wait_opts) { nil }
|
|
25
|
-
|
|
26
|
-
# failed wait should error
|
|
27
|
-
proc { wait(wait_opts) { raise } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
28
|
-
|
|
29
|
-
# regular rescue will not handle exceptions outside of StandardError hierarchy
|
|
30
|
-
# must rescue Exception explicitly to rescue everything
|
|
31
|
-
proc { wait(wait_opts) { raise NoMemoryError } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
32
|
-
proc { wait(timeout: 0.2, interval: 0.0) { raise NoMemoryError } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
33
|
-
|
|
34
|
-
# invalid keys are rejected
|
|
35
|
-
proc { wait(invalidkey: 2) { true } }.must_raise RuntimeError
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
t 'ignore' do
|
|
39
|
-
# ignore should rescue all exceptions
|
|
40
|
-
ignore { true }
|
|
41
|
-
ignore { false }
|
|
42
|
-
ignore { nil }
|
|
43
|
-
ignore { raise }
|
|
44
|
-
ignore { raise NoMemoryError }
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# wait_true is a success unless the value is not true
|
|
48
|
-
t 'wait_true' do
|
|
49
|
-
# successful wait should not error
|
|
50
|
-
wait_true(wait_opts) { true }
|
|
51
|
-
|
|
52
|
-
# failed wait should error
|
|
53
|
-
proc { wait_true(wait_opts) { false } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
54
|
-
proc { wait_true(wait_opts) { nil } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
55
|
-
|
|
56
|
-
# raise should error
|
|
57
|
-
proc { wait_true(wait_opts) { raise } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
58
|
-
|
|
59
|
-
# regular rescue will not handle exceptions outside of StandardError hierarchy
|
|
60
|
-
# must rescue Exception explicitly to rescue everything
|
|
61
|
-
proc { wait_true(wait_opts) { raise NoMemoryError } }.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
62
|
-
proc { wait_true(timeout: 0.2, interval: 0.0) { raise NoMemoryError } }
|
|
63
|
-
.must_raise Selenium::WebDriver::Error::TimeOutError
|
|
64
|
-
|
|
65
|
-
# invalid keys are rejected
|
|
66
|
-
proc { wait_true(invalidkey: 2) { true } }.must_raise RuntimeError
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# t 'id' # id is for Selendroid
|
|
70
|
-
|
|
71
|
-
t 'back' do
|
|
72
|
-
# start page
|
|
73
|
-
tag(UI::Inventory.navbar).name.must_equal 'UICatalog'
|
|
74
|
-
# nav to new page.
|
|
75
|
-
wait_true do
|
|
76
|
-
text('buttons').click
|
|
77
|
-
tag(UI::Inventory.navbar).name == 'Buttons'
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
tag(UI::Inventory.navbar).name.must_equal 'Buttons'
|
|
81
|
-
# go back
|
|
82
|
-
back_click
|
|
83
|
-
# start page
|
|
84
|
-
tag(UI::Inventory.navbar).name.must_equal 'UICatalog'
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
t 'session_id' do
|
|
88
|
-
# Sauce doesn't return '-' so make them optional.
|
|
89
|
-
session_id.must_match(/\h{8}-?\h{4}-?\h{4}-?\h{4}-?\h{12}/)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
t 'xpath' do
|
|
93
|
-
xpath("//#{UI::Inventory.static_text}").name.must_equal 'UICatalog'
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
t 'xpaths' do
|
|
97
|
-
xpaths("//#{UI::Inventory.static_text}").length.must_equal 25
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def uibutton_text
|
|
101
|
-
'Buttons'
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
t 'ele_index' do
|
|
105
|
-
ele_index(UI::Inventory.static_text, 2).name.must_equal uibutton_text
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
# TODO: 'string_attr_exact'
|
|
109
|
-
|
|
110
|
-
t 'find_ele_by_attr' do
|
|
111
|
-
el_id = find_ele_by_attr(UI::Inventory.static_text, 'name', uibutton_text).instance_variable_get :@id
|
|
112
|
-
el_id.must_match(/\d+/)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
t 'find_eles_by_attr' do
|
|
116
|
-
# '!' clears the input buffer in Pry so make sure there's
|
|
117
|
-
# no space after the !
|
|
118
|
-
set_wait 1
|
|
119
|
-
# empty array returned when no match
|
|
120
|
-
found = !find_eles_by_attr(UI::Inventory.static_text, 'name', uibutton_text).empty?
|
|
121
|
-
found.must_equal true
|
|
122
|
-
|
|
123
|
-
found = !find_eles_by_attr(UI::Inventory.static_text, 'name', 'zz').empty?
|
|
124
|
-
found.must_equal false
|
|
125
|
-
set_wait
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
t 'find_ele_by_predicate' do
|
|
129
|
-
el_text = find_ele_by_predicate(value: uibutton_text).text
|
|
130
|
-
el_text.must_equal uibutton_text
|
|
131
|
-
|
|
132
|
-
el_name = find_ele_by_predicate(value: uibutton_text).name
|
|
133
|
-
el_name.must_equal uibutton_text
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
t 'find_eles_by_predicate' do
|
|
137
|
-
ele_count = find_eles_by_predicate(value: uibutton_text).length
|
|
138
|
-
ele_count.must_equal 1
|
|
139
|
-
|
|
140
|
-
ele_count = find_eles_by_predicate(value: 'zz').length
|
|
141
|
-
ele_count.must_equal 0
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# TODO: 'string_attr_include'
|
|
145
|
-
|
|
146
|
-
t 'find_ele_by_attr_include' do
|
|
147
|
-
el_text = find_ele_by_attr_include(UI::Inventory.static_text, :name, 'button').text
|
|
148
|
-
el_text.must_equal uibutton_text
|
|
149
|
-
|
|
150
|
-
el_name = find_ele_by_attr_include(UI::Inventory.static_text, :name, 'button').name
|
|
151
|
-
el_name.must_equal uibutton_text
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
t 'find_eles_by_attr_include' do
|
|
155
|
-
ele_count = find_eles_by_attr_include(UI::Inventory.static_text, :name, 'e').length
|
|
156
|
-
expected = UI::Inventory.xcuitest? ? 20 : 19
|
|
157
|
-
ele_count.must_equal expected
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
t 'find_ele_by_predicate_include' do
|
|
161
|
-
el_text = find_ele_by_predicate_include(value: 'button').text
|
|
162
|
-
el_text.must_equal uibutton_text
|
|
163
|
-
|
|
164
|
-
el_name = find_ele_by_predicate_include(value: 'button').name
|
|
165
|
-
el_name.must_equal uibutton_text
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
t 'find_eles_by_predicate_include' do
|
|
169
|
-
find_eles_by_predicate_include(value: 'e').length.must_equal 21
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
t 'first_ele' do
|
|
173
|
-
first_ele(UI::Inventory.static_text).name.must_equal 'UICatalog'
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
t 'last_ele' do
|
|
177
|
-
expected = 'Transitions'
|
|
178
|
-
|
|
179
|
-
el = last_ele(UI::Inventory.static_text)
|
|
180
|
-
el.text.must_equal expected
|
|
181
|
-
el.name.must_equal expected
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
# t 'source' do # tested by get_source
|
|
185
|
-
|
|
186
|
-
t 'get_source' do
|
|
187
|
-
get_source.class.must_equal String
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
t 'invalid id should error' do
|
|
191
|
-
proc { id 'does not exist' }.must_raise Selenium::WebDriver::Error::NoSuchElementError
|
|
192
|
-
|
|
193
|
-
# resource id should error on ios
|
|
194
|
-
proc { id 'android:id/text1' }.must_raise Selenium::WebDriver::Error::NoSuchElementError
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
t 'tag' do
|
|
198
|
-
tag(UI::Inventory.navbar).name.must_equal 'UICatalog'
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
t 'tags' do
|
|
202
|
-
tags(UI::Inventory.table_cell).length.must_equal 12
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
t 'find_eles_by_attr_include_length' do
|
|
206
|
-
find_eles_by_attr_include(UI::Inventory.static_text, 'name', 'Use').length.must_equal 7
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
t 'get_page_class' do
|
|
210
|
-
# 8 local. 9 on sauce.
|
|
211
|
-
get_page_class.split("\n").length.must_be :>=, 8
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
# TODO: write tests
|
|
215
|
-
# page_class
|
|
216
|
-
# px_to_window_rel
|
|
217
|
-
# lazy_load_strings
|
|
218
|
-
# xml_keys
|
|
219
|
-
# xml_values
|
|
220
|
-
# resolve_id
|
|
221
|
-
# string_visible_contains
|
|
222
|
-
# xpath_visible_contains
|
|
223
|
-
# xpaths_visible_contains
|
|
224
|
-
# string_visible_exact
|
|
225
|
-
# xpath_visible_exact
|
|
226
|
-
# xpaths_visible_exact
|
|
227
|
-
# raise_no_element_error
|
|
228
|
-
end
|