calabash-cucumber 0.18.2 → 0.19.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/calabash-ios +0 -16
- data/bin/calabash-ios-build.rb +0 -86
- data/bin/calabash-ios-helpers.rb +0 -65
- data/bin/calabash-ios-setup.rb +5 -119
- data/bin/calabash-ios-sim.rb +0 -37
- data/bin/frank-calabash +0 -1
- data/doc/calabash-ios-help.txt +0 -8
- data/dylibs/libCalabashDyn.dylib +0 -0
- data/dylibs/libCalabashDynSim.dylib +0 -0
- data/features-skeleton/support/01_launch.rb +3 -4
- data/features/step_definitions/calabash_steps.rb +1 -7
- data/lib/calabash-cucumber.rb +1 -2
- data/lib/calabash-cucumber/actions/instruments_actions.rb +2 -3
- data/lib/calabash-cucumber/core.rb +97 -101
- data/lib/calabash-cucumber/device.rb +5 -118
- data/lib/calabash-cucumber/environment.rb +109 -5
- data/lib/calabash-cucumber/environment_helpers.rb +4 -66
- data/lib/calabash-cucumber/http/http.rb +114 -0
- data/lib/calabash-cucumber/http_helpers.rb +3 -1
- data/lib/calabash-cucumber/ipad_1x_2x.rb +5 -7
- data/lib/calabash-cucumber/keyboard_helpers.rb +0 -44
- data/lib/calabash-cucumber/launcher.rb +425 -808
- data/lib/calabash-cucumber/logging.rb +2 -74
- data/lib/calabash-cucumber/operations.rb +0 -2
- data/lib/calabash-cucumber/rotation_helpers.rb +2 -82
- data/lib/calabash-cucumber/status_bar_helpers.rb +2 -8
- data/lib/calabash-cucumber/store/preferences.rb +2 -1
- data/lib/calabash-cucumber/uia.rb +4 -9
- data/lib/calabash-cucumber/version.rb +2 -2
- data/lib/calabash-cucumber/wait_helpers.rb +0 -2
- data/staticlib/calabash.framework.zip +0 -0
- data/staticlib/libFrankCalabash.a +0 -0
- metadata +13 -143
- data/lib/calabash-cucumber/actions/playback_actions.rb +0 -109
- data/lib/calabash-cucumber/deprecated.rb +0 -34
- data/lib/calabash-cucumber/launch/simulator_helper.rb +0 -62
- data/lib/calabash-cucumber/launch/simulator_launcher.rb +0 -617
- data/lib/calabash-cucumber/playback_helpers.rb +0 -225
- data/lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64 +0 -51
- data/lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64 +0 -51
- data/lib/calabash-cucumber/resources/cell_swipe_ios5_ipad.base64 +0 -74
- data/lib/calabash-cucumber/resources/cell_swipe_ios5_iphone.base64 +0 -74
- data/lib/calabash-cucumber/resources/double_tap_ios5_ipad.base64 +0 -15
- data/lib/calabash-cucumber/resources/double_tap_ios5_iphone.base64 +0 -15
- data/lib/calabash-cucumber/resources/double_tap_ios6_ipad.base64 +0 -22
- data/lib/calabash-cucumber/resources/double_tap_ios6_iphone.base64 +0 -22
- data/lib/calabash-cucumber/resources/pan_ios5_ipad.base64 +0 -199
- data/lib/calabash-cucumber/resources/pan_ios5_iphone.base64 +0 -199
- data/lib/calabash-cucumber/resources/pan_ios6_ipad.base64 +0 -206
- data/lib/calabash-cucumber/resources/pan_ios6_iphone.base64 +0 -206
- data/lib/calabash-cucumber/resources/pinch_in_ios4_ipad.base64 +0 -104
- data/lib/calabash-cucumber/resources/pinch_in_ios4_iphone.base64 +0 -104
- data/lib/calabash-cucumber/resources/pinch_in_ios5_ipad.base64 +0 -144
- data/lib/calabash-cucumber/resources/pinch_in_ios5_iphone.base64 +0 -144
- data/lib/calabash-cucumber/resources/pinch_in_ios6_ipad.base64 +0 -70
- data/lib/calabash-cucumber/resources/pinch_in_ios6_iphone.base64 +0 -70
- data/lib/calabash-cucumber/resources/pinch_out_ios5_ipad.base64 +0 -207
- data/lib/calabash-cucumber/resources/pinch_out_ios5_iphone.base64 +0 -207
- data/lib/calabash-cucumber/resources/pinch_out_ios6_ipad.base64 +0 -96
- data/lib/calabash-cucumber/resources/pinch_out_ios6_iphone.base64 +0 -96
- data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_ipad.base64 +0 -2
- data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_iphone.base64 +0 -2
- data/lib/calabash-cucumber/resources/swipe_down_ios5_ipad.base64 +0 -18
- data/lib/calabash-cucumber/resources/swipe_down_ios5_iphone.base64 +0 -31
- data/lib/calabash-cucumber/resources/swipe_down_ios6_ipad.base64 +0 -25
- data/lib/calabash-cucumber/resources/swipe_down_ios6_iphone.base64 +0 -25
- data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_ipad.base64 +0 -15
- data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_iphone.base64 +0 -15
- data/lib/calabash-cucumber/resources/swipe_left_ios4_ipad.base64 +0 -18
- data/lib/calabash-cucumber/resources/swipe_left_ios4_iphone.base64 +0 -18
- data/lib/calabash-cucumber/resources/swipe_left_ios5_ipad.base64 +0 -17
- data/lib/calabash-cucumber/resources/swipe_left_ios5_iphone.base64 +0 -34
- data/lib/calabash-cucumber/resources/swipe_left_ios6_ipad.base64 +0 -28
- data/lib/calabash-cucumber/resources/swipe_left_ios6_iphone.base64 +0 -28
- data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_ipad.base64 +0 -17
- data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_iphone.base64 +0 -17
- data/lib/calabash-cucumber/resources/swipe_right_ios4_ipad.base64 +0 -13
- data/lib/calabash-cucumber/resources/swipe_right_ios4_iphone.base64 +0 -13
- data/lib/calabash-cucumber/resources/swipe_right_ios5_ipad.base64 +0 -17
- data/lib/calabash-cucumber/resources/swipe_right_ios5_iphone.base64 +0 -17
- data/lib/calabash-cucumber/resources/swipe_right_ios6_ipad.base64 +0 -25
- data/lib/calabash-cucumber/resources/swipe_right_ios6_iphone.base64 +0 -25
- data/lib/calabash-cucumber/resources/swipe_up_ios5_ipad.base64 +0 -34
- data/lib/calabash-cucumber/resources/swipe_up_ios5_iphone.base64 +0 -28
- data/lib/calabash-cucumber/resources/swipe_up_ios6_ipad.base64 +0 -25
- data/lib/calabash-cucumber/resources/swipe_up_ios6_iphone.base64 +0 -25
- data/lib/calabash-cucumber/resources/touch_done_ios4_ipad.base64 +0 -7
- data/lib/calabash-cucumber/resources/touch_done_ios4_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_done_ios5_ipad.base64 +0 -7
- data/lib/calabash-cucumber/resources/touch_done_ios5_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_hold_ios5_ipad.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_hold_ios5_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_hold_ios6_ipad.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_hold_ios6_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_ios4_ipad.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_ios4_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_ios5_ipad.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_ios5_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_ios7_ipad.base64 +0 -9
- data/lib/calabash-cucumber/resources/touch_ios7_iphone.base64 +0 -9
- data/lib/calabash-cucumber/resources/wheel_down_ios4_ipad.base64 +0 -159
- data/lib/calabash-cucumber/resources/wheel_down_ios4_iphone.base64 +0 -159
- data/lib/calabash-cucumber/resources/wheel_down_ios5_ipad.base64 +0 -156
- data/lib/calabash-cucumber/resources/wheel_down_ios5_iphone.base64 +0 -156
- data/lib/calabash-cucumber/resources/wheel_up_ios4_ipad.base64 +0 -166
- data/lib/calabash-cucumber/resources/wheel_up_ios4_iphone.base64 +0 -166
- data/lib/calabash-cucumber/resources/wheel_up_ios5_ipad.base64 +0 -156
- data/lib/calabash-cucumber/resources/wheel_up_ios5_iphone.base64 +0 -156
- data/lib/calabash-cucumber/utils/logging.rb +0 -111
- data/lib/calabash-cucumber/utils/plist_buddy.rb +0 -45
- data/lib/calabash-cucumber/utils/simulator_accessibility.rb +0 -334
- data/lib/calabash-cucumber/utils/xctools.rb +0 -101
- data/scripts/.irbrc +0 -64
- data/scripts/launch.rb +0 -48
data/dylibs/libCalabashDyn.dylib
CHANGED
Binary file
|
Binary file
|
@@ -25,7 +25,6 @@ Before do |scenario|
|
|
25
25
|
}
|
26
26
|
|
27
27
|
launcher.relaunch(options)
|
28
|
-
launcher.calabash_notify(self)
|
29
28
|
end
|
30
29
|
|
31
30
|
After do |scenario|
|
@@ -33,11 +32,11 @@ After do |scenario|
|
|
33
32
|
# in the UIApplicationDelegate. This is really nice for CI environments, but
|
34
33
|
# not so good for local development.
|
35
34
|
#
|
36
|
-
# See the documentation for
|
35
|
+
# See the documentation for QUIT_APP_AFTER_SCENARIO for a nice debugging workflow
|
37
36
|
#
|
38
|
-
# http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html#label-
|
37
|
+
# http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html#label-QUIT_APP_AFTER_SCENARIO
|
39
38
|
# http://calabashapi.xamarin.com/ios/Calabash/Cucumber/Core.html#console_attach-instance_method
|
40
|
-
|
39
|
+
if launcher.quit_app_after_scenario?
|
41
40
|
calabash_exit
|
42
41
|
end
|
43
42
|
end
|
@@ -85,7 +85,7 @@ Then /^I touch (?:the)? user location$/ do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
Then /^I (?:touch|press) (?:done|search)$/ do
|
88
|
-
|
88
|
+
tap_keyboard_action_key
|
89
89
|
sleep(STEP_PAUSE)
|
90
90
|
end
|
91
91
|
|
@@ -138,12 +138,6 @@ Then /^I use the native keyboard to enter "([^\"]*)" into (?:input|text) field n
|
|
138
138
|
sleep(STEP_PAUSE)
|
139
139
|
end
|
140
140
|
|
141
|
-
When /^I clear "([^\"]*)"$/ do |name|
|
142
|
-
msg = "When I clear <name>' will be deprecated because it is ambiguous - what should be cleared?"
|
143
|
-
_deprecated('0.9.151', msg, :warn)
|
144
|
-
clear_text("textField marked: '#{name}'")
|
145
|
-
end
|
146
|
-
|
147
141
|
Then /^I clear (?:input|text) field number (\d+)$/ do |index|
|
148
142
|
index = index.to_i
|
149
143
|
screenshot_and_raise("Index should be positive (was: #{index})") if index <= 0
|
data/lib/calabash-cucumber.rb
CHANGED
@@ -4,6 +4,7 @@ require "calabash-cucumber/dot_dir"
|
|
4
4
|
require "calabash-cucumber/store/preferences"
|
5
5
|
require "calabash-cucumber/usage_tracker.rb"
|
6
6
|
require "calabash-cucumber/dylibs"
|
7
|
+
require "calabash-cucumber/http/http"
|
7
8
|
require 'calabash-cucumber/core'
|
8
9
|
require 'calabash-cucumber/tests_helpers'
|
9
10
|
require 'calabash-cucumber/keyboard_helpers'
|
@@ -13,8 +14,6 @@ require 'calabash-cucumber/operations'
|
|
13
14
|
require 'calabash-cucumber/version'
|
14
15
|
require 'calabash-cucumber/date_picker'
|
15
16
|
require 'calabash-cucumber/ipad_1x_2x'
|
16
|
-
require 'calabash-cucumber/utils/logging'
|
17
|
-
require 'calabash-cucumber/deprecated'
|
18
17
|
|
19
18
|
# stubs for documentation
|
20
19
|
|
@@ -116,17 +116,16 @@ class Calabash::Cucumber::InstrumentsActions
|
|
116
116
|
def normalize_rect_for_orientation!(orientation, rect)
|
117
117
|
orientation = orientation.to_sym
|
118
118
|
launcher = Calabash::Cucumber::Launcher.launcher
|
119
|
+
device = launcher.device
|
119
120
|
|
120
121
|
# Coordinate translations for orientation is handled in the server for iOS 8+
|
121
|
-
|
122
|
-
if launcher.ios_major_version.to_i >= 8
|
122
|
+
if device.ios_major_version.to_i >= 8
|
123
123
|
return
|
124
124
|
end
|
125
125
|
|
126
126
|
# We cannot use Device#screen_dimensions here because on iPads the height
|
127
127
|
# and width are the opposite of what we expect.
|
128
128
|
# @todo Move all coordinate/orientation translation into the server.
|
129
|
-
device = launcher.device
|
130
129
|
if device.ipad?
|
131
130
|
screen_size = { :width => 768, :height => 1024 }
|
132
131
|
elsif device.iphone_4in?
|
@@ -5,19 +5,11 @@ require 'calabash-cucumber/uia'
|
|
5
5
|
require 'calabash-cucumber/environment_helpers'
|
6
6
|
require 'calabash-cucumber/connection'
|
7
7
|
require 'calabash-cucumber/connection_helpers'
|
8
|
-
require 'calabash-cucumber/launch/simulator_launcher'
|
9
8
|
require 'calabash-cucumber/query_helpers'
|
10
|
-
require 'calabash-cucumber/playback_helpers'
|
11
9
|
require 'calabash-cucumber/failure_helpers'
|
12
10
|
require 'calabash-cucumber/status_bar_helpers'
|
13
11
|
require 'calabash-cucumber/rotation_helpers'
|
14
12
|
require 'calabash-cucumber/map'
|
15
|
-
require 'calabash-cucumber/utils/logging'
|
16
|
-
|
17
|
-
|
18
|
-
# legacy support - module was deprecated 0.9.169
|
19
|
-
# replaced with simulator-launcher
|
20
|
-
require 'calabash-cucumber/launch/simulator_helper'
|
21
13
|
|
22
14
|
module Calabash
|
23
15
|
module Cucumber
|
@@ -25,7 +17,6 @@ module Calabash
|
|
25
17
|
# A collection of methods that provide the core calabash behaviors.
|
26
18
|
module Core
|
27
19
|
|
28
|
-
include Calabash::Cucumber::Logging
|
29
20
|
include Calabash::Cucumber::EnvironmentHelpers
|
30
21
|
include Calabash::Cucumber::ConnectionHelpers
|
31
22
|
include Calabash::Cucumber::QueryHelpers
|
@@ -34,7 +25,6 @@ module Calabash
|
|
34
25
|
include Calabash::Cucumber::UIA
|
35
26
|
include Calabash::Cucumber::StatusBarHelpers
|
36
27
|
include Calabash::Cucumber::RotationHelpers
|
37
|
-
include Calabash::Cucumber::PlaybackHelpers
|
38
28
|
|
39
29
|
# @!visibility private
|
40
30
|
# @deprecated Use Cucumber's step method (avoid this: using step is not considered best practice).
|
@@ -48,6 +38,46 @@ module Calabash
|
|
48
38
|
end
|
49
39
|
end
|
50
40
|
|
41
|
+
# Prints a blue warning message.
|
42
|
+
# @param [String] msg the message to print
|
43
|
+
# @return [void]
|
44
|
+
def calabash_warn(msg)
|
45
|
+
require "run_loop/logging"
|
46
|
+
RunLoop.log_warn(msg)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Prints a green info message.
|
50
|
+
# @param [String] msg the message to print
|
51
|
+
# @return [void]
|
52
|
+
def calabash_info(msg)
|
53
|
+
require "run_loop/logging"
|
54
|
+
RunLoop.log_info2(msg)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Prints a deprecated message that includes the line number.
|
58
|
+
#
|
59
|
+
# @param [String] version indicates when the feature was deprecated
|
60
|
+
# @param [String] msg deprecation message (possibly suggesting alternatives)
|
61
|
+
# @param [Symbol] type { :warn | :pending } - :pending will raise a
|
62
|
+
# cucumber pending error
|
63
|
+
# @return [void]
|
64
|
+
def deprecated(version, msg, type)
|
65
|
+
allowed = [:pending, :warn]
|
66
|
+
unless allowed.include?(type)
|
67
|
+
raise ArgumentError, "Expected type '#{type}' to be one of #{allowed.join(", ")}"
|
68
|
+
end
|
69
|
+
|
70
|
+
stack = Kernel.caller(0, 6)[1..-1].join("\n")
|
71
|
+
|
72
|
+
msg = "deprecated '#{version}' - #{msg}\n#{stack}"
|
73
|
+
|
74
|
+
if type.eql?(:pending)
|
75
|
+
pending(msg)
|
76
|
+
else
|
77
|
+
calabash_warn(msg)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
51
81
|
# The core method for querying into the current visible view
|
52
82
|
# of the app under test. The query method takes as first parameter
|
53
83
|
# a String `:uiquery`. This string must follow the query syntax
|
@@ -146,16 +176,6 @@ module Calabash
|
|
146
176
|
Calabash::Cucumber::VERSION
|
147
177
|
end
|
148
178
|
|
149
|
-
# Queries all views in view hierarchy, even if not visible.
|
150
|
-
# @deprecated use the 'all' or 'visible' modifier in query syntax
|
151
|
-
def query_all(uiquery, *args)
|
152
|
-
msg0 = "use the 'all' or 'visible' query language feature"
|
153
|
-
msg1 = 'see: https://github.com/calabash/calabash-ios/wiki/05-Query-syntax'
|
154
|
-
msg = "#{msg0}\n#{msg1}"
|
155
|
-
_deprecated('0.9.133', msg, :warn)
|
156
|
-
map("all #{uiquery}", :query, *args)
|
157
|
-
end
|
158
|
-
|
159
179
|
# Performs the `tap` gesture on the (first) view that matches
|
160
180
|
# query `uiquery`. Note that `touch` assumes the view is visible and not animating.
|
161
181
|
# If the view is not visible `touch` will fail. If the view is animating
|
@@ -746,15 +766,7 @@ details => '#{result["details"]}'
|
|
746
766
|
|
747
767
|
raise 'Wheel index must be non negative' if wheel < 0
|
748
768
|
raise "Only up and down supported :dir (#{dir})" unless [:up, :down].include?(dir)
|
749
|
-
|
750
|
-
if ENV['OS'] == 'ios4'
|
751
|
-
playback "wheel_#{dir}", :query => "#{q} pickerTable index:#{wheel}"
|
752
|
-
elsif ios7?
|
753
|
-
raise NotImplementedError
|
754
|
-
else
|
755
|
-
playback "wheel_#{dir}", :query => "#{q} pickerTableView index:#{wheel}"
|
756
|
-
end
|
757
|
-
|
769
|
+
raise NotImplementedError
|
758
770
|
end
|
759
771
|
|
760
772
|
# @!visibility private
|
@@ -939,9 +951,9 @@ arguments => '#{arguments}'
|
|
939
951
|
# @return {Calabash::Cucumber::Launcher} the launcher object in use
|
940
952
|
def start_test_server_in_background(args={})
|
941
953
|
stop_test_server
|
942
|
-
|
943
|
-
|
944
|
-
|
954
|
+
launcher = Calabash::Cucumber::Launcher.new
|
955
|
+
launcher.relaunch(args)
|
956
|
+
launcher
|
945
957
|
end
|
946
958
|
|
947
959
|
# Helper method to easily create page object instances from a cucumber execution context.
|
@@ -1006,23 +1018,6 @@ arguments => '#{arguments}'
|
|
1006
1018
|
tap_mark(label, *args)
|
1007
1019
|
end
|
1008
1020
|
|
1009
|
-
# taps a view with mark `hash_or_string`
|
1010
|
-
# @deprecated In later Calabash versions we will change the semantics of `tap` to take a general query
|
1011
|
-
# (instead of a 'mark' now). We're deprecating this now to prepare people for a breaking change.
|
1012
|
-
# @param {String} hash_or_string mark to pass to call `tap_mark(hash_or_string)`.
|
1013
|
-
# @return {Array<Hash>} array containing the serialized version of the tapped view.
|
1014
|
-
def tap(hash_or_string, *args)
|
1015
|
-
deprecation_msg = 'Use tap_mark instead. In later Calabash versions we will change the semantics of `tap` to take a general query.'
|
1016
|
-
_deprecated('0.10.0', deprecation_msg, :warn)
|
1017
|
-
if hash_or_string.is_a?(String)
|
1018
|
-
tap_mark(hash_or_string, *args)
|
1019
|
-
elsif hash_or_string.respond_to?(:[])
|
1020
|
-
wait_tap(hash_or_string[:query], hash_or_string)
|
1021
|
-
else
|
1022
|
-
raise(ArgumentError, "first parameter to tap must be a string or a hash. Was: #{hash_or_string.class}, #{hash_or_string}")
|
1023
|
-
end
|
1024
|
-
end
|
1025
|
-
|
1026
1021
|
# taps a view with mark `label`. Equivalent to `touch("* marked:'#{label}'")`
|
1027
1022
|
# @param {String} label the mark of the view to tap
|
1028
1023
|
# @param {Array} args optional additional arguments to pass to `touch`.
|
@@ -1038,38 +1033,48 @@ arguments => '#{arguments}'
|
|
1038
1033
|
query(q).map { |e| e['html'] }
|
1039
1034
|
end
|
1040
1035
|
|
1041
|
-
#
|
1036
|
+
# Sets the text value of the views matched by +uiquery+ to +txt+.
|
1042
1037
|
#
|
1043
|
-
#
|
1038
|
+
# You should always try to enter text "like the user would" using the
|
1039
|
+
# `keyboard_enter_text` method. There are cases, however, when this does
|
1040
|
+
# not work or is very slow.
|
1044
1041
|
#
|
1045
|
-
#
|
1042
|
+
# Please note that if you use this method, the UITextFieldDelegate and
|
1043
|
+
# UITextViewDelegate methods ***will not be called*** if you use this
|
1044
|
+
# method of text entry. This means that if you have UI elements that
|
1045
|
+
# respond to text changes, they ***will not be updated***.
|
1046
1046
|
#
|
1047
|
-
#
|
1048
|
-
#
|
1049
|
-
#
|
1050
|
-
#
|
1051
|
-
# - for text fields, implement a clear text button and touch it
|
1052
|
-
# - for text views, use touches to reveal text editing popup
|
1053
|
-
# see https://github.com/calabash/calabash-ios/issues/151
|
1054
|
-
# - use 'clear_text'
|
1055
|
-
# https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS-Ruby-API
|
1047
|
+
# UIAutomation's keyboard.typeString is incredibly buggy. Calabash goes
|
1048
|
+
# to great lengths to provide a stable typing interface. However, there
|
1049
|
+
# are cases where our patches cause problems. If your app crashes or
|
1050
|
+
# hangs when calling `keyboard_enter_text` there are a couple of options.
|
1056
1051
|
#
|
1057
|
-
#
|
1052
|
+
# 1. Try `fast_enter_text`. This may or may not cause delegate methods
|
1053
|
+
# to be called (see the note above).
|
1054
|
+
# 2. Call `keyboard.typeString` directly. This will bypass the Calabash
|
1055
|
+
# fixes (which sometimes cause hanging and/or crashes).
|
1056
|
+
#
|
1057
|
+
# ```
|
1058
|
+
# touch(" < touch a text field or text view > ")
|
1059
|
+
# wait_for_keyboard
|
1060
|
+
# uia("UIATarget.localTarget().frontMostApp().keyboard().typeString('your string')")
|
1061
|
+
# ```
|
1062
|
+
#
|
1063
|
+
# Please be aware that keyboard.typeString is prone to errors. We
|
1064
|
+
# recommend using `keyboard_enter_text` or `fast_enter_text` whenever
|
1065
|
+
# possible.
|
1066
|
+
#
|
1067
|
+
# One valid use of this method is on WebViews. Find examples in the
|
1068
|
+
# [CalWebApp features/steps/set_text_steps.rb](https://github.com/calabash/ios-webview-test-app/blob/master/CalWebViewApp/features/steps/set_text_steps.rb).
|
1069
|
+
#
|
1070
|
+
# @param [String] uiquery used to find the text input views
|
1071
|
+
# @param [String] txt the new text
|
1072
|
+
#
|
1073
|
+
# @raise[RuntimeError] If the +uiquery+ finds no matching queries or finds
|
1058
1074
|
# a view that does not respond to the objc selector 'setText'
|
1075
|
+
#
|
1076
|
+
# @return [Array<String>] The text fields that were modified.
|
1059
1077
|
def set_text(uiquery, txt)
|
1060
|
-
msgs = ["'set_text' is deprecated and its behavior is now unpredictable",
|
1061
|
-
"* to enter text using the native keyboard use 'keyboard_enter_text'",
|
1062
|
-
"* to delete text use 'keyboard_enter_text('Delete')",
|
1063
|
-
'* to clear a text field or text view:',
|
1064
|
-
' - RECOMMENDED: use queries and touches to replicate what the user would do',
|
1065
|
-
' * for text fields, implement a clear text button and touch it',
|
1066
|
-
' * for text views, use touches to reveal text editing popup',
|
1067
|
-
' see https://github.com/calabash/calabash-ios/issues/151',
|
1068
|
-
" - use 'clear_text'",
|
1069
|
-
'https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS-Ruby-API']
|
1070
|
-
msg = msgs.join("\n")
|
1071
|
-
_deprecated('0.9.145', msg, :warn)
|
1072
|
-
|
1073
1078
|
text_fields_modified = map(uiquery, :setText, txt)
|
1074
1079
|
|
1075
1080
|
msg = "query '#{uiquery}' returned no matching views that respond to 'setText'"
|
@@ -1077,30 +1082,18 @@ arguments => '#{arguments}'
|
|
1077
1082
|
text_fields_modified
|
1078
1083
|
end
|
1079
1084
|
|
1080
|
-
#
|
1085
|
+
# Sets the text value of the views matched by +uiquery+ to <tt>''</tt>
|
1081
1086
|
# (the empty string)
|
1082
1087
|
#
|
1083
|
-
#
|
1084
|
-
#
|
1085
|
-
#
|
1086
|
-
# it is recommended that you instead do some combination of the following
|
1087
|
-
#
|
1088
|
-
# * use queries and touches to replicate with the user would
|
1089
|
-
# - for text fields, implement a clear text button and touch it
|
1090
|
-
# - for text views, use touches to reveal text editing popup
|
1091
|
-
# see https://github.com/calabash/calabash-ios/issues/151
|
1092
|
-
#
|
1093
|
-
# https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS-Ruby-API
|
1088
|
+
# Using this sparingly and with caution. We recommend using queries and
|
1089
|
+
# touches to replicate what the _user would do_.
|
1094
1090
|
#
|
1095
|
-
#
|
1096
|
-
# a _single_ view that does not respond to the objc selector 'setText'
|
1091
|
+
# @param [String] uiquery used to find the text input views
|
1097
1092
|
#
|
1098
|
-
#
|
1099
|
-
#
|
1100
|
-
#
|
1101
|
-
# > clear_text("view")
|
1093
|
+
# @raise[RuntimeError] If the +uiquery+ finds no matching queries or finds
|
1094
|
+
# a view that does not respond to the objc selector 'setText'
|
1102
1095
|
#
|
1103
|
-
#
|
1096
|
+
# @return [Array<String>] The text fields that were modified.
|
1104
1097
|
def clear_text(uiquery)
|
1105
1098
|
views_modified = map(uiquery, :setText, '')
|
1106
1099
|
msg = "query '#{uiquery}' returned no matching views that respond to 'setText'"
|
@@ -1108,7 +1101,6 @@ arguments => '#{arguments}'
|
|
1108
1101
|
views_modified
|
1109
1102
|
end
|
1110
1103
|
|
1111
|
-
|
1112
1104
|
# Sets user preference (NSUserDefaults) value of key `key` to `val`.
|
1113
1105
|
# @example
|
1114
1106
|
# set_user_pref 'foo', {lastname: "Krukow"}
|
@@ -1153,8 +1145,8 @@ arguments => '#{arguments}'
|
|
1153
1145
|
# @!visibility private
|
1154
1146
|
# @todo broken currently
|
1155
1147
|
def stop_test_server
|
1156
|
-
|
1157
|
-
|
1148
|
+
launcher = Calabash::Cucumber::Launcher.launcher_if_used
|
1149
|
+
launcher.stop if launcher
|
1158
1150
|
end
|
1159
1151
|
|
1160
1152
|
# @!visibility private
|
@@ -1182,15 +1174,19 @@ arguments => '#{arguments}'
|
|
1182
1174
|
# when starting the console.
|
1183
1175
|
# @return [Calabash::Cucumber::Launcher,nil] the currently active
|
1184
1176
|
# calabash launcher
|
1177
|
+
#
|
1178
|
+
# @raise [RuntimeError] This method is not available on the Xamarin Test
|
1179
|
+
# Cloud
|
1185
1180
|
def console_attach(uia_strategy = nil)
|
1186
|
-
|
1187
|
-
|
1181
|
+
if Calabash::Cucumber::Environment.xtc?
|
1182
|
+
raise "This method is not available on the Xamarin Test Cloud"
|
1183
|
+
end
|
1184
|
+
launcher.attach({:uia_strategy => uia_strategy})
|
1188
1185
|
end
|
1189
1186
|
|
1190
1187
|
# @!visibility private
|
1191
1188
|
def launcher
|
1192
|
-
|
1193
|
-
@calabash_launcher = Calabash::Cucumber::Launcher.launcher
|
1189
|
+
Calabash::Cucumber::Launcher.launcher
|
1194
1190
|
end
|
1195
1191
|
|
1196
1192
|
# @!visibility private
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'calabash-cucumber/utils/logging'
|
3
|
-
|
4
1
|
module Calabash
|
5
2
|
module Cucumber
|
6
3
|
|
@@ -9,8 +6,6 @@ module Calabash
|
|
9
6
|
# app that is running on the current device.
|
10
7
|
class Device
|
11
8
|
|
12
|
-
include Calabash::Cucumber::Logging
|
13
|
-
|
14
9
|
# @!visibility private
|
15
10
|
GESTALT_IPHONE = 'iPhone'
|
16
11
|
|
@@ -166,44 +161,27 @@ module Calabash
|
|
166
161
|
end
|
167
162
|
end
|
168
163
|
|
169
|
-
# Deprecated 0.16.2 server
|
170
|
-
@system = version_data['system']
|
171
|
-
|
172
|
-
# 0.16.2 server adds 'device_family' key.
|
173
|
-
unless @device_family
|
174
|
-
# Deprecated 0.16.2 server
|
175
|
-
simulator_device = version_data['simulator_device']
|
176
|
-
if @system == GESTALT_SIM_SYS
|
177
|
-
@device_family = simulator_device
|
178
|
-
else
|
179
|
-
@device_family = @system.split(/[\d,.]/).first
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
164
|
# 0.16.2 server adds 'ios_version' key
|
184
165
|
unless @ios_version
|
185
166
|
@ios_version = version_data['iOS_version']
|
186
167
|
end
|
187
|
-
|
188
|
-
# Deprecated 0.13.0
|
189
|
-
@iphone_4in = version_data['4inch']
|
190
168
|
end
|
191
169
|
|
192
170
|
# Is this device a simulator or physical device?
|
193
171
|
# @return [Boolean] true if this device is a simulator
|
194
172
|
def simulator?
|
195
|
-
|
196
|
-
|
197
|
-
|
173
|
+
details = simulator_details
|
174
|
+
if details
|
175
|
+
details != ""
|
198
176
|
else
|
199
|
-
|
177
|
+
false
|
200
178
|
end
|
201
179
|
end
|
202
180
|
|
203
181
|
# Is this device a device or simulator?
|
204
182
|
# @return [Boolean] true if this device is a physical device
|
205
183
|
def device?
|
206
|
-
|
184
|
+
!simulator?
|
207
185
|
end
|
208
186
|
|
209
187
|
# Is this device an iPhone?
|
@@ -290,19 +268,6 @@ module Calabash
|
|
290
268
|
ios_version_object.major == 5
|
291
269
|
end
|
292
270
|
|
293
|
-
# @deprecated 0.11.2 Replaced with screen_dimensions.
|
294
|
-
#
|
295
|
-
# The screen size of the device.
|
296
|
-
#
|
297
|
-
# @return [Hash] representation of the screen size
|
298
|
-
def screen_size
|
299
|
-
_deprecated('0.11.2', 'Replaced with screen_dimensions', :warn)
|
300
|
-
return screen_dimensions if screen_dimensions
|
301
|
-
return { :width => 768, :height => 1024 } if ipad?
|
302
|
-
return { :width => 320, :height => 568 } if iphone_4in?
|
303
|
-
{ :width => 320, :height => 480 }
|
304
|
-
end
|
305
|
-
|
306
271
|
# Is the app that is running an iPhone-only app emulated on an iPad?
|
307
272
|
#
|
308
273
|
# @note If the app is running in emulation mode, there will be a 1x or 2x
|
@@ -314,84 +279,6 @@ module Calabash
|
|
314
279
|
iphone_app_emulated_on_ipad
|
315
280
|
end
|
316
281
|
|
317
|
-
# @deprecated 0.9.169 replaced with `server_version`
|
318
|
-
#
|
319
|
-
# @see #server_version
|
320
|
-
#
|
321
|
-
# The version of the embedded Calabash server running in the app under
|
322
|
-
# test on this device.
|
323
|
-
# @see #server_version
|
324
|
-
# @return [String] the version of the embedded Calabash server
|
325
|
-
def framework_version
|
326
|
-
_deprecated('0.9.169', "use 'server_version', instead", :warn)
|
327
|
-
@server_version
|
328
|
-
end
|
329
|
-
|
330
|
-
# @deprecated 0.10.0 no replacement
|
331
|
-
def udid
|
332
|
-
_deprecated('0.10.0', 'no replacement', :warn)
|
333
|
-
@udid
|
334
|
-
end
|
335
|
-
|
336
|
-
# @deprecated 0.10.0 no replacement
|
337
|
-
def udid=(value)
|
338
|
-
_deprecated('0.10.0', 'no replacement', :warn)
|
339
|
-
@udid = value
|
340
|
-
end
|
341
|
-
|
342
|
-
# @deprecated 0.9.168 replaced with iphone_4in?
|
343
|
-
#
|
344
|
-
# @see #iphone_4in?
|
345
|
-
#
|
346
|
-
# Is this device an iPhone 5?
|
347
|
-
# @note Deprecated because the iPhone 5S reports as an iPhone6,*.
|
348
|
-
# @return [Boolean] true if this device is an iPhone 5
|
349
|
-
def iphone_5?
|
350
|
-
_deprecated('0.9.168', "use 'iphone_4in?' instead", :warn)
|
351
|
-
iphone_4in?
|
352
|
-
end
|
353
|
-
|
354
|
-
# @deprecated 0.13.1 - Call `iphone_4in?` instead.
|
355
|
-
#
|
356
|
-
# @see #iphone_4in?
|
357
|
-
#
|
358
|
-
# @note Deprecated after introducing new `form_factor` behavior.
|
359
|
-
# @return [Boolean] true if this device is an iPhone 5 or 5s
|
360
|
-
def iphone_4in
|
361
|
-
_deprecated('0.13.1', "use 'iphone_4in?' instead", :warn)
|
362
|
-
@iphone_4in
|
363
|
-
end
|
364
|
-
|
365
|
-
# @deprecated 0.16.2 No replacement.
|
366
|
-
#
|
367
|
-
# @example
|
368
|
-
# # simulator
|
369
|
-
# i386
|
370
|
-
# x86_64
|
371
|
-
#
|
372
|
-
# @example
|
373
|
-
# # examples from physical devices
|
374
|
-
# iPhone7,1
|
375
|
-
# iPhone5,2
|
376
|
-
#
|
377
|
-
# @attribute [r] system
|
378
|
-
# @return [String] The model of this device.
|
379
|
-
# this device.
|
380
|
-
attr_reader :system
|
381
|
-
|
382
|
-
# @deprecated 0.13.1 no replacement
|
383
|
-
#
|
384
|
-
# Indicates whether or not this device has a 4in screen.
|
385
|
-
# @attribute [r] iphone_4in
|
386
|
-
# @return [Boolean] `true` if this device has a 4in screen.
|
387
|
-
attr_reader :iphone_4in
|
388
|
-
|
389
|
-
# @deprecated 0.10.0 no replacement
|
390
|
-
#
|
391
|
-
# @!attribute [rw] udid
|
392
|
-
# @return [String] The udid of this device.
|
393
|
-
attr_accessor :udid
|
394
|
-
|
395
282
|
private
|
396
283
|
|
397
284
|
# @!visibility private
|