appium_lib_core 3.2.0 → 3.2.1
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 +2 -0
- data/CHANGELOG.md +14 -0
- data/README.md +11 -1
- data/azure-pipelines.yml +9 -0
- data/ci-jobs/functional/run_appium.yml +5 -3
- data/ci-jobs/functional_test.yml +73 -34
- data/lib/appium_lib_core/android/device.rb +12 -12
- data/lib/appium_lib_core/android/uiautomator2/device.rb +1 -1
- data/lib/appium_lib_core/common/base/bridge.rb +4 -4
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +17 -8
- data/lib/appium_lib_core/common/base/driver.rb +38 -34
- data/lib/appium_lib_core/common/base/http_default.rb +2 -2
- data/lib/appium_lib_core/common/base/platform.rb +1 -1
- data/lib/appium_lib_core/common/base/screenshot.rb +1 -1
- data/lib/appium_lib_core/common/base/search_context.rb +4 -4
- data/lib/appium_lib_core/common/device/image_comparison.rb +7 -7
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +2 -2
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +6 -6
- data/lib/appium_lib_core/common/wait.rb +8 -8
- data/lib/appium_lib_core/common/ws/websocket.rb +5 -5
- data/lib/appium_lib_core/driver.rb +22 -19
- data/lib/appium_lib_core/ios/xcuitest/device.rb +27 -18
- data/lib/appium_lib_core/ios/xcuitest/device/screen.rb +2 -1
- data/lib/appium_lib_core/patch.rb +21 -1
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +17 -0
- metadata +2 -2
@@ -51,15 +51,15 @@ module Appium
|
|
51
51
|
@bridge.dialect
|
52
52
|
end
|
53
53
|
|
54
|
-
# Update
|
55
|
-
# After this method,
|
54
|
+
# Update +server_url+ and HTTP clients following this arguments, protocol, host, port and path.
|
55
|
+
# After this method, +@bridge.http+ will be a new instance following them instead of +server_url+ which is
|
56
56
|
# set before creating session.
|
57
57
|
#
|
58
58
|
# @example
|
59
59
|
#
|
60
|
-
# driver = core.start_driver server_url: 'http://example1.com:8000/wd/hub # @bridge.http is for
|
60
|
+
# driver = core.start_driver server_url: 'http://example1.com:8000/wd/hub # @bridge.http is for 'http://example1.com:8000/wd/hub/'
|
61
61
|
# driver.update_sending_request_to protocol: 'https', host: 'example2.com', port: 9000, path: '/wd/hub'
|
62
|
-
# driver.manage.timeouts.implicit_wait = 10 # @bridge.http is for
|
62
|
+
# driver.manage.timeouts.implicit_wait = 10 # @bridge.http is for 'https://example2.com:9000/wd/hub/'
|
63
63
|
#
|
64
64
|
def update_sending_request_to(protocol:, host:, port:, path:)
|
65
65
|
@bridge.http.update_sending_request_to(scheme: protocol,
|
@@ -110,7 +110,7 @@ module Appium
|
|
110
110
|
# Defaults to 'Done' for iOS(except for XCUITest).
|
111
111
|
# @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
|
112
112
|
# XCUITest ignore this argument.
|
113
|
-
# Default for iOS is
|
113
|
+
# Default for iOS is +:pressKey+. Default for Android is +:tapOutside+.
|
114
114
|
#
|
115
115
|
# @example
|
116
116
|
#
|
@@ -312,13 +312,13 @@ module Appium
|
|
312
312
|
#
|
313
313
|
# result = @driver.within_context('NATIVE_APP') do
|
314
314
|
# @driver.find_element :tag, "button"
|
315
|
-
# end # The result of
|
315
|
+
# end # The result of 'find_element :tag, "button"'
|
316
316
|
#
|
317
317
|
def within_context(context)
|
318
318
|
block_given? ? @bridge.within_context(context, &Proc.new) : @bridge.within_context(context)
|
319
319
|
end
|
320
320
|
|
321
|
-
# Change to the default context. This is equivalent to
|
321
|
+
# Change to the default context. This is equivalent to +set_context nil+.
|
322
322
|
#
|
323
323
|
# @example
|
324
324
|
#
|
@@ -368,6 +368,8 @@ module Appium
|
|
368
368
|
# @driver.set_immediate_value element, 'hello'
|
369
369
|
#
|
370
370
|
def set_immediate_value(element, *value)
|
371
|
+
::Appium::Logger.warn '[DEPRECATION] driver#set_immediate_value(element, *value) is deprecated. ' \
|
372
|
+
'Use Element#immediate_value(*value) instead'
|
371
373
|
@bridge.set_immediate_value(element, *value)
|
372
374
|
end
|
373
375
|
|
@@ -375,9 +377,11 @@ module Appium
|
|
375
377
|
#
|
376
378
|
# @example
|
377
379
|
#
|
378
|
-
# replace_value element, 'hello'
|
380
|
+
# @driver.replace_value element, 'hello'
|
379
381
|
#
|
380
382
|
def replace_value(element, *value)
|
383
|
+
::Appium::Logger.warn '[DEPRECATION] driver#replace_value(element, *value) is deprecated. ' \
|
384
|
+
'Use Element#replace_value(*value) instead'
|
381
385
|
@bridge.replace_value(element, *value)
|
382
386
|
end
|
383
387
|
|
@@ -495,15 +499,15 @@ module Appium
|
|
495
499
|
|
496
500
|
# Press keycode on the device.
|
497
501
|
# http://developer.android.com/reference/android/view/KeyEvent.html
|
498
|
-
# @param [Integer] key The key to press. The values which have
|
499
|
-
# e.g.: KEYCODE_HOME is
|
502
|
+
# @param [Integer] key The key to press. The values which have +KEYCODE_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
503
|
+
# e.g.: KEYCODE_HOME is +3+ or +0x00000003+
|
500
504
|
# @param [[Integer]] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
|
501
|
-
# Metastate have
|
502
|
-
# e.g.: META_SHIFT_ON is
|
505
|
+
# Metastate have +META_+ prefix in https://developer.android.com/reference/android/view/KeyEvent.html
|
506
|
+
# e.g.: META_SHIFT_ON is +1+ or +0x00000001+
|
503
507
|
# @param [[Integer]] flags Native Android flag value. Several flags can be combined into a single key event.
|
504
508
|
# Default is empty Array. Can set multiple flags as Array.
|
505
|
-
# Flags have
|
506
|
-
# e.g.: FLAG_CANCELED is
|
509
|
+
# Flags have +FLAG_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
510
|
+
# e.g.: FLAG_CANCELED is +32+ or +0x00000020+
|
507
511
|
#
|
508
512
|
# @example
|
509
513
|
#
|
@@ -517,15 +521,15 @@ module Appium
|
|
517
521
|
|
518
522
|
# Long press keycode on the device.
|
519
523
|
# http://developer.android.com/reference/android/view/KeyEvent.html
|
520
|
-
# @param [Integer] key The key to long press. The values which have
|
521
|
-
# e.g.: KEYCODE_HOME is
|
524
|
+
# @param [Integer] key The key to long press. The values which have +KEYCODE_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
525
|
+
# e.g.: KEYCODE_HOME is +3+ or +0x00000003+
|
522
526
|
# @param [[Integer]] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
|
523
|
-
# Metastate have
|
524
|
-
# e.g.: META_SHIFT_ON is
|
527
|
+
# Metastate have +META_+ prefix in https://developer.android.com/reference/android/view/KeyEvent.html
|
528
|
+
# e.g.: META_SHIFT_ON is +1+ or +0x00000001+
|
525
529
|
# @param [[Integer]] flags Native Android flag value. Several flags can be combined into a single key event.
|
526
530
|
# Default is empty Array. Can set multiple flags as Array.
|
527
|
-
# Flags have
|
528
|
-
# e.g.: FLAG_CANCELED is
|
531
|
+
# Flags have +FLAG_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
532
|
+
# e.g.: FLAG_CANCELED is +32+ or +0x00000020+
|
529
533
|
#
|
530
534
|
# @example
|
531
535
|
#
|
@@ -598,14 +602,14 @@ module Appium
|
|
598
602
|
# @param [String] path The absolute local path or remote http URL to an .ipa or .apk file,
|
599
603
|
# or a .zip containing one of these.
|
600
604
|
# @param [Boolean] replace Only for Android. Whether to reinstall/upgrade the package if it is already present
|
601
|
-
# on the device under test.
|
605
|
+
# on the device under test. +true+ by default
|
602
606
|
# @param [Integer] timeout Only for Android. How much time to wait for the installation to complete.
|
603
607
|
# 60000ms by default.
|
604
608
|
# @param [Boolean] allow_test_packages Only for Android. Whether to allow installation of packages marked as test
|
605
|
-
# in the manifest.
|
606
|
-
# @param [Boolean] use_sdcard Only for Android. Whether to use the SD card to install the app.
|
609
|
+
# in the manifest. +false+ by default
|
610
|
+
# @param [Boolean] use_sdcard Only for Android. Whether to use the SD card to install the app. +false+ by default
|
607
611
|
# @param [Boolean] grant_permissions Only for Android. whether to automatically grant application permissions
|
608
|
-
# on Android 6+ after the installation completes.
|
612
|
+
# on Android 6+ after the installation completes. +false+ by default
|
609
613
|
#
|
610
614
|
# @example
|
611
615
|
#
|
@@ -629,7 +633,7 @@ module Appium
|
|
629
633
|
|
630
634
|
# @param [Strong] app_id BundleId for iOS or package name for Android
|
631
635
|
# @param [Boolean] keep_data Only for Android. Whether to keep application data and caches after it is uninstalled.
|
632
|
-
#
|
636
|
+
# +false+ by default
|
633
637
|
# @param [Integer] timeout Only for Android. How much time to wait for the uninstall to complete. 20000ms by default.
|
634
638
|
#
|
635
639
|
# @example
|
@@ -728,7 +732,7 @@ module Appium
|
|
728
732
|
#
|
729
733
|
# # iOS
|
730
734
|
# @driver.start_recording_screen video_type: 'libx264'
|
731
|
-
# @driver.stop_and_save_recording_screen 'example.mp4' # Video type
|
735
|
+
# @driver.stop_and_save_recording_screen 'example.mp4' # Video type 'libx264' can be play as '.mp4' video
|
732
736
|
#
|
733
737
|
# # Android
|
734
738
|
# @driver.start_recording_screen
|
@@ -752,7 +756,7 @@ module Appium
|
|
752
756
|
#
|
753
757
|
# @param [String] format The set of format specifiers. Read https://momentjs.com/docs/ to get
|
754
758
|
# the full list of supported datetime format specifiers.
|
755
|
-
# The default format is
|
759
|
+
# The default format is +YYYY-MM-DDTHH:mm:ssZ+, which complies to ISO-8601
|
756
760
|
# @return [String] Formatted datetime string or the raw command output if formatting fails
|
757
761
|
#
|
758
762
|
# @example
|
@@ -774,7 +778,7 @@ module Appium
|
|
774
778
|
end
|
775
779
|
|
776
780
|
#
|
777
|
-
# Send multiple W3C action chains to server. Use
|
781
|
+
# Send multiple W3C action chains to server. Use +@driver.action+ for single action chain.
|
778
782
|
#
|
779
783
|
# @param [Array] data Array of actions
|
780
784
|
# @return nil|error
|
@@ -797,7 +801,7 @@ module Appium
|
|
797
801
|
# origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
798
802
|
# f2.create_pointer_up(:left)
|
799
803
|
#
|
800
|
-
# @driver.perform_actions [f1, f2] #=>
|
804
|
+
# @driver.perform_actions [f1, f2] #=> 'nil' if the action succeed
|
801
805
|
#
|
802
806
|
def perform_actions(data)
|
803
807
|
raise ArgumentError, "'#{data}' must be Array" unless data.is_a? Array
|
@@ -868,7 +872,7 @@ module Appium
|
|
868
872
|
end
|
869
873
|
|
870
874
|
# Retrieve the capabilities of the specified session.
|
871
|
-
# It's almost same as
|
875
|
+
# It's almost same as +@driver.capabilities+ but you can get more details.
|
872
876
|
#
|
873
877
|
# @return [Selenium::WebDriver::Remote::Capabilities]
|
874
878
|
#
|
@@ -1036,7 +1040,7 @@ module Appium
|
|
1036
1040
|
# @@driver.update_settings({ fixImageFindScreenshotDims: false, fixImageTemplateSize: true,
|
1037
1041
|
# autoUpdateImageElementPosition: true })
|
1038
1042
|
# e = @@driver.find_elements_by_image ['./test/functional/data/test_element_image.png']
|
1039
|
-
# e == [] # if the
|
1043
|
+
# e == [] # if the 'e' is empty
|
1040
1044
|
#
|
1041
1045
|
def find_elements_by_image(img_path)
|
1042
1046
|
template = Base64.strict_encode64 File.read img_path
|
@@ -1053,7 +1057,7 @@ module Appium
|
|
1053
1057
|
# @param [String] script The string consisting of the script itself
|
1054
1058
|
# @param [String] type The name of the script type.
|
1055
1059
|
# Defaults to 'webdriverio'. Depends on server implementation which type is supported.
|
1056
|
-
# @param [Integer] timeout_ms The number of
|
1060
|
+
# @param [Integer] timeout_ms The number of +ms+ Appium should wait for the script to finish
|
1057
1061
|
# before killing it due to timeout.
|
1058
1062
|
#
|
1059
1063
|
# @return [Appium::Core::Base::Device::ExecuteDriver::Result] The script result parsed by
|
@@ -1070,8 +1074,8 @@ module Appium
|
|
1070
1074
|
# SCRIPT
|
1071
1075
|
# r = @@driver.execute_driver(script: script, type: 'webdriverio', timeout: 10_000)
|
1072
1076
|
# r #=> An instance of Appium::Core::Base::Device::ExecuteDriver::Result
|
1073
|
-
# r.result #=> The
|
1074
|
-
# r.logs #=> The
|
1077
|
+
# r.result #=> The 'result' key part as the result of the script
|
1078
|
+
# r.logs #=> The 'logs' key part as '{'log' => [], 'warn' => [], 'error' => []}'
|
1075
1079
|
#
|
1076
1080
|
def execute_driver(script: '', type: 'webdriverio', timeout_ms: nil)
|
1077
1081
|
@bridge.execute_driver(script: script, type: type, timeout_ms: timeout_ms)
|
@@ -34,13 +34,13 @@ module Appium
|
|
34
34
|
# @param [string|integer] port A port number to update server_url to
|
35
35
|
# @param [string] path A path to update server_url to
|
36
36
|
#
|
37
|
-
# @return [URI] An instance of URI updated to. Returns default
|
37
|
+
# @return [URI] An instance of URI updated to. Returns default +server_url+ if some of arguments are +nil+
|
38
38
|
def update_sending_request_to(scheme:, host:, port:, path:)
|
39
39
|
return @server_url unless validate_url_param(scheme, host, port, path)
|
40
40
|
|
41
41
|
::Appium::Logger.debug("[experimental] This feature, #{__method__}, is an experimental")
|
42
42
|
|
43
|
-
# Add / if
|
43
|
+
# Add / if 'path' does not have it
|
44
44
|
path = path.start_with?('/') ? path : "/#{path}"
|
45
45
|
path = path.end_with?('/') ? path : "#{path}/"
|
46
46
|
|
@@ -94,7 +94,7 @@ module Appium
|
|
94
94
|
|
95
95
|
# @since Appium 1.3.4
|
96
96
|
# @!method save_viewport_screenshot
|
97
|
-
# Save screenshot except for status bar while
|
97
|
+
# Save screenshot except for status bar while +@driver.save_screenshot+ save entire screen.
|
98
98
|
#
|
99
99
|
# @example
|
100
100
|
#
|
@@ -93,7 +93,7 @@ module Appium
|
|
93
93
|
# ## With uiautomator
|
94
94
|
# @driver.find_elements :uiautomator, 'new UiSelector().clickable(true)'
|
95
95
|
# ## With viewtag, but only for Espresso
|
96
|
-
# ##
|
96
|
+
# ## 'setTag'/'getTag' in https://developer.android.com/reference/android/view/View
|
97
97
|
# @driver.find_elements :viewtag, 'new UiSelector().clickable(true)'
|
98
98
|
# # With data_matcher. The argument should be JSON format.
|
99
99
|
# @driver.find_elements :data_matcher, { name: 'hasEntry', args: %w(title Animation) }.to_json
|
@@ -111,9 +111,9 @@ module Appium
|
|
111
111
|
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow'
|
112
112
|
# ### select the second last child of the second child window
|
113
113
|
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
|
114
|
-
# ### matching predicate. <code
|
115
|
-
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow[
|
116
|
-
# ### containing predicate.
|
114
|
+
# ### matching predicate. <code>'</code> is the mark.
|
115
|
+
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow['visible = 1]['name = "bla"']'
|
116
|
+
# ### containing predicate. '$' is the mark.
|
117
117
|
# ### Require appium-xcuitest-driver 2.54.0+. PR: https://github.com/facebook/WebDriverAgent/pull/707/files
|
118
118
|
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow[$name = \"bla$$$bla\"$]'
|
119
119
|
# e = find_element :class_chain, "**/XCUIElementTypeWindow[$name == 'Buttons'$]"
|
@@ -113,7 +113,7 @@ module Appium
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# Performs images matching to calculate the similarity score between them
|
116
|
-
# with default options. The flow there is similar to the one used in
|
116
|
+
# with default options. The flow there is similar to the one used in +find_image_occurrence+
|
117
117
|
# but it is mandatory that both images are of equal size.
|
118
118
|
#
|
119
119
|
# @param [String] first_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
@@ -140,14 +140,14 @@ module Appium
|
|
140
140
|
# It is expected that both OpenCV framework and opencv4nodejs
|
141
141
|
# module are installed on the machine where Appium server is running.
|
142
142
|
#
|
143
|
-
# @param [Symbol] mode One of possible comparison modes:
|
144
|
-
#
|
143
|
+
# @param [Symbol] mode One of possible comparison modes: +:matchFeatures+, +:getSimilarity+, +:matchTemplate+.
|
144
|
+
# +:matchFeatures is by default.
|
145
145
|
# @param [String] first_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
146
146
|
# @param [String] second_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
147
|
-
# @param [Hash] options The content of this dictionary depends on the actual
|
148
|
-
# See the documentation on
|
149
|
-
# @return [Hash] The content of the resulting dictionary depends on the actual
|
150
|
-
# See the documentation on
|
147
|
+
# @param [Hash] options The content of this dictionary depends on the actual +mode+ value.
|
148
|
+
# See the documentation on +appium-support+ module for more details.
|
149
|
+
# @return [Hash] The content of the resulting dictionary depends on the actual +mode+ and +options+ values.
|
150
|
+
# See the documentation on +appium-support+ module for more details.
|
151
151
|
#
|
152
152
|
def compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil)
|
153
153
|
raise "content_type should be #{MODE}" unless MODE.member?(mode)
|
@@ -17,8 +17,8 @@ module Appium
|
|
17
17
|
# MultiTouch actions allow for multiple touches to happen at the same time,
|
18
18
|
# for instance, to simulate multiple finger swipes.
|
19
19
|
#
|
20
|
-
# Create a series of touch actions by themselves (without a
|
21
|
-
# add to a new MultiTouch action. When ready, call
|
20
|
+
# Create a series of touch actions by themselves (without a +prepare()+), then
|
21
|
+
# add to a new MultiTouch action. When ready, call +prepare()+ and all
|
22
22
|
# actions will be executed simultaneously.
|
23
23
|
#
|
24
24
|
# @example
|
@@ -15,7 +15,7 @@
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
17
|
# Perform a series of gestures, one after another. Gestures are chained
|
18
|
-
# together and only performed when
|
18
|
+
# together and only performed when +perform()+ is called. Default is conducted by global driver.
|
19
19
|
#
|
20
20
|
# Each method returns the object itself, so calls can be chained.
|
21
21
|
#
|
@@ -45,7 +45,7 @@ module Appium
|
|
45
45
|
|
46
46
|
# Move to the given co-ordinates.
|
47
47
|
#
|
48
|
-
#
|
48
|
+
# +move_to+'s +x+ and +y+ have two case. One is working as coordinate, the other is working as offset.
|
49
49
|
#
|
50
50
|
# @param opts [Hash] Options
|
51
51
|
# @option opts [integer] :x x co-ordinate to move to if element isn't set. Works as an absolute if x is set with Element.
|
@@ -57,7 +57,7 @@ module Appium
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# Press down for a specific duration.
|
60
|
-
# Alternatively, you can use
|
60
|
+
# Alternatively, you can use +press(...).wait(...).release()+ instead of +long_press+ if duration doesn't work well.
|
61
61
|
# https://github.com/appium/ruby_lib/issues/231#issuecomment-269895512
|
62
62
|
# e.g. Appium::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
63
63
|
#
|
@@ -72,14 +72,14 @@ module Appium
|
|
72
72
|
chain_method(:longPress, args) # longPress is what the appium server expects
|
73
73
|
end
|
74
74
|
|
75
|
-
# Press a finger onto the screen. Finger will stay down until you call
|
75
|
+
# Press a finger onto the screen. Finger will stay down until you call +release+.
|
76
76
|
#
|
77
77
|
# @param opts [Hash] Options
|
78
78
|
# @option opts [WebDriver::Element] :element (Optional) Element to press within.
|
79
79
|
# @option opts [integer] :x x co-ordinate to press on
|
80
80
|
# @option opts [integer] :y y co-ordinate to press on
|
81
81
|
# @option opts [Float] pressure (iOS Only) press as force touch.
|
82
|
-
# See the description of
|
82
|
+
# See the description of +force+ property on Apple's UITouch class
|
83
83
|
# (https://developer.apple.com/documentation/uikit/uitouch?language=objc)
|
84
84
|
# for more details on possible value ranges.
|
85
85
|
def press(opts)
|
@@ -101,7 +101,7 @@ module Appium
|
|
101
101
|
end
|
102
102
|
|
103
103
|
# Touch a point on the screen.
|
104
|
-
# Alternatively, you can use
|
104
|
+
# Alternatively, you can use +press(...).release.perform+ instead of +tap(...).perform+.
|
105
105
|
#
|
106
106
|
# @param opts [Hash] Options
|
107
107
|
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
@@ -28,8 +28,8 @@ module Appium
|
|
28
28
|
#
|
29
29
|
# If only a number is provided then it's treated as the timeout value.
|
30
30
|
#
|
31
|
-
# @param [Integer] timeout Seconds to wait before timing out. Set default by
|
32
|
-
# @param [Integer] interval Seconds to sleep between polls. Set default by
|
31
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by +appium_wait_timeout+ (30).
|
32
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by +appium_wait_interval+ (0.5).
|
33
33
|
# @param [String] message Exception message if timed out.
|
34
34
|
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
35
35
|
# @param [Object, NilClass] object Object to evaluate block against
|
@@ -72,8 +72,8 @@ module Appium
|
|
72
72
|
#
|
73
73
|
# If only a number is provided then it's treated as the timeout value.
|
74
74
|
#
|
75
|
-
# @param [Integer] timeout Seconds to wait before timing out. Set default by
|
76
|
-
# @param [Integer] interval Seconds to sleep between polls. Set default by
|
75
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by +appium_wait_timeout+ (30).
|
76
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by +appium_wait_interval+ (0.5).
|
77
77
|
# @param [String] message Exception message if timed out.
|
78
78
|
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
79
79
|
# @param [Object, NilClass] object Object to evaluate block against
|
@@ -128,8 +128,8 @@ module Appium
|
|
128
128
|
#
|
129
129
|
# If only a number is provided then it's treated as the timeout value.
|
130
130
|
#
|
131
|
-
# @param [Integer] timeout Seconds to wait before timing out. Set default by
|
132
|
-
# @param [Integer] interval Seconds to sleep between polls. Set default by
|
131
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by +appium_wait_timeout+ (30).
|
132
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by +appium_wait_interval+ (0.5).
|
133
133
|
# @param [String] message Exception message if timed out.
|
134
134
|
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
135
135
|
#
|
@@ -150,8 +150,8 @@ module Appium
|
|
150
150
|
#
|
151
151
|
# If only a number is provided then it's treated as the timeout value.
|
152
152
|
#
|
153
|
-
# @param [Integer] timeout Seconds to wait before timing out. Set default by
|
154
|
-
# @param [Integer] interval Seconds to sleep between polls. Set default by
|
153
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by +appium_wait_timeout+ (30).
|
154
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by +appium_wait_interval+ (0.5).
|
155
155
|
# @param [String] message Exception message if timed out.
|
156
156
|
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
157
157
|
#
|
@@ -25,13 +25,13 @@ module Appium
|
|
25
25
|
# with close method.
|
26
26
|
#
|
27
27
|
# @param [String] url URL to establish web socket connection. If the URL has no port, the client use:
|
28
|
-
#
|
28
|
+
# +ws+: 80, +wss+: 443 ports.
|
29
29
|
# @param [Array] protocols An array of strings representing acceptable subprotocols for use over the socket.
|
30
30
|
# The driver will negotiate one of these to use via the Sec-WebSocket-Protocol header
|
31
31
|
# if supported by the other peer. Default is nil.
|
32
32
|
# The protocols is equal to https://github.com/faye/faye-websocket-ruby/ 's one for client.
|
33
33
|
# @param [Hash] options Initialize options for Faye client. Read https://github.com/faye/faye-websocket-ruby#initialization-options
|
34
|
-
# for more details. Default is
|
34
|
+
# for more details. Default is +{}+.
|
35
35
|
#
|
36
36
|
# @example
|
37
37
|
# ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
|
@@ -127,7 +127,7 @@ module Appium
|
|
127
127
|
# In general, users should customise only message_data
|
128
128
|
|
129
129
|
#
|
130
|
-
# Fires when the socket receives a message. The message gas one
|
130
|
+
# Fires when the socket receives a message. The message gas one +data+ attribute and this method can handle the data.
|
131
131
|
# The data is either a String (for text frames) or an Array of byte-sized integers (for binary frames).
|
132
132
|
#
|
133
133
|
# Default is just put a debug message and puts the result on standard out.
|
@@ -149,11 +149,11 @@ module Appium
|
|
149
149
|
end
|
150
150
|
|
151
151
|
#
|
152
|
-
# Fires when either the client or the server closes the connection. The method gets
|
152
|
+
# Fires when either the client or the server closes the connection. The method gets +code+ and +reason+ attributes.
|
153
153
|
# They expose the status code and message sent by the peer that closed the connection.
|
154
154
|
#
|
155
155
|
# Default is just put a error message.
|
156
|
-
# The methods also clear
|
156
|
+
# The methods also clear +client+ instance and stop the eventmachine which is called in initialising this class.
|
157
157
|
#
|
158
158
|
def handle_close(code, reason)
|
159
159
|
::Appium::Logger.debug %W(#{self.class} :close #{code} #{reason})
|
@@ -51,7 +51,7 @@ module Appium
|
|
51
51
|
@wait_interval = appium_lib_opts.fetch :wait_interval, ::Appium::Core::Wait::DEFAULT_INTERVAL
|
52
52
|
|
53
53
|
# to pass it in Selenium.new.
|
54
|
-
#
|
54
|
+
# 'listener = opts.delete(:listener)' is called in Selenium::Driver.new
|
55
55
|
@listener = appium_lib_opts.fetch :listener, nil
|
56
56
|
end
|
57
57
|
|
@@ -184,9 +184,9 @@ module Appium
|
|
184
184
|
#
|
185
185
|
# # format 1
|
186
186
|
# @core = Appium::Core.for caps: {...}, appium_lib: {...}
|
187
|
-
# # format 2.
|
187
|
+
# # format 2. 'desired_capabilities:' is also available instead of 'caps:'. Either is fine.
|
188
188
|
# @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", desired_capabilities: {...}, appium_lib: {...}
|
189
|
-
# # format 3.
|
189
|
+
# # format 3. 'appium_lib: {...}' can be blank
|
190
190
|
# @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", desired_capabilities: {...}
|
191
191
|
#
|
192
192
|
#
|
@@ -211,11 +211,11 @@ module Appium
|
|
211
211
|
# listener: nil,
|
212
212
|
# }
|
213
213
|
# }
|
214
|
-
# @core = Appium::Core.for(opts) # create a core driver with
|
215
|
-
# @core.start_driver # Connect to
|
214
|
+
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
|
215
|
+
# @core.start_driver # Connect to 'http://127.0.0.1:8080/wd/hub' because of 'port: 8080'
|
216
216
|
#
|
217
217
|
# # Start iOS driver with .zip file over HTTP
|
218
|
-
# #
|
218
|
+
# # 'desired_capabilities:' is also available instead of 'caps:'. Either is fine.
|
219
219
|
# opts = {
|
220
220
|
# desired_capabilities: {
|
221
221
|
# platformName: :ios,
|
@@ -234,9 +234,9 @@ module Appium
|
|
234
234
|
# }
|
235
235
|
# }
|
236
236
|
# @core = Appium::Core.for(opts)
|
237
|
-
# @core.start_driver # Connect to
|
237
|
+
# @core.start_driver # Connect to 'http://custom-host:8080/wd/hub.com'
|
238
238
|
#
|
239
|
-
# # Start iOS driver as another format.
|
239
|
+
# # Start iOS driver as another format. 'url' is available like below
|
240
240
|
# opts = {
|
241
241
|
# url: "http://custom-host:8080/wd/hub.com",
|
242
242
|
# desired_capabilities: {
|
@@ -254,8 +254,8 @@ module Appium
|
|
254
254
|
# listener: nil,
|
255
255
|
# }
|
256
256
|
# }
|
257
|
-
# @core = Appium::Core.for(opts) # create a core driver with
|
258
|
-
# @core.start_driver # start driver with
|
257
|
+
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
|
258
|
+
# @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub.com'
|
259
259
|
#
|
260
260
|
def self.for(opts = {})
|
261
261
|
new(opts)
|
@@ -274,7 +274,7 @@ module Appium
|
|
274
274
|
# @private
|
275
275
|
def initialize(opts = {})
|
276
276
|
@delegate_target = self # for testing purpose
|
277
|
-
@automation_name = nil # initialise before
|
277
|
+
@automation_name = nil # initialise before 'set_automation_name'
|
278
278
|
|
279
279
|
opts = Appium.symbolize_keys opts
|
280
280
|
validate_keys(opts)
|
@@ -325,7 +325,7 @@ module Appium
|
|
325
325
|
# }
|
326
326
|
# }
|
327
327
|
#
|
328
|
-
# @core = Appium::Core.for(opts) # create a core driver with
|
328
|
+
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
|
329
329
|
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub"
|
330
330
|
#
|
331
331
|
# # Attach custom HTTP client
|
@@ -421,7 +421,7 @@ module Appium
|
|
421
421
|
# }
|
422
422
|
# }
|
423
423
|
#
|
424
|
-
# Returns blank hash for Selenium Grid since
|
424
|
+
# Returns blank hash for Selenium Grid since 'remote_status' gets 500 error
|
425
425
|
#
|
426
426
|
# @example
|
427
427
|
#
|
@@ -456,7 +456,7 @@ module Appium
|
|
456
456
|
# @example
|
457
457
|
#
|
458
458
|
# @core.screenshot '/tmp/hi.png' #=> nil
|
459
|
-
# # same as
|
459
|
+
# # same as '@driver.save_screenshot png_save_path'
|
460
460
|
#
|
461
461
|
def screenshot(png_save_path)
|
462
462
|
::Appium::Logger.warn '[DEPRECATION] screenshot will be removed. Please use driver.save_screenshot instead.'
|
@@ -496,11 +496,14 @@ module Appium
|
|
496
496
|
when :tizen
|
497
497
|
# https://github.com/Samsung/appium-tizen-driver
|
498
498
|
::Appium::Logger.debug('tizen')
|
499
|
-
when :youiengine
|
500
|
-
# https://github.com/YOU-i-Labs/appium-youiengine-driver
|
501
|
-
::Appium::Logger.debug('YouiEngine')
|
502
499
|
else
|
503
|
-
|
500
|
+
case automation_name
|
501
|
+
when :youiengine
|
502
|
+
# https://github.com/YOU-i-Labs/appium-youiengine-driver
|
503
|
+
::Appium::Logger.debug('YouiEngine')
|
504
|
+
else
|
505
|
+
::Appium::Logger.warn("No matched driver by platformName: #{device} and automationName: #{automation_name}")
|
506
|
+
end
|
504
507
|
end
|
505
508
|
|
506
509
|
self
|
@@ -541,7 +544,7 @@ module Appium
|
|
541
544
|
|
542
545
|
# @private
|
543
546
|
# Path to the .apk, .app or .app.zip.
|
544
|
-
# The path can be local, HTTP/S, Windows Share and other path like
|
547
|
+
# The path can be local, HTTP/S, Windows Share and other path like 'sauce-storage:'.
|
545
548
|
# Use @caps[:app] without modifications if the path isn't HTTP/S or local path.
|
546
549
|
def set_app_path
|
547
550
|
return unless @caps && @caps[:app] && !@caps[:app].empty?
|