calabash 2.0.0.pre11 → 2.0.0.prelegacy
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/README.md +17 -5
- data/bin/calabash +4 -3
- data/lib/calabash/android/adb.rb +37 -34
- data/lib/calabash/android/application.rb +1 -1
- data/lib/calabash/android/build/builder.rb +1 -1
- data/lib/calabash/android/build/java_keystore.rb +1 -1
- data/lib/calabash/android/build/resigner.rb +1 -1
- data/lib/calabash/android/device.rb +46 -204
- data/lib/calabash/android/environment.rb +1 -14
- data/lib/calabash/android/gestures.rb +22 -6
- data/lib/calabash/android/interactions.rb +17 -14
- data/lib/calabash/android/legacy.rb +141 -4
- data/lib/calabash/android/lib/.irbrc +1 -9
- data/lib/calabash/android/lib/AndroidManifest.xml +2 -23
- data/lib/calabash/android/lib/TestServer.apk +0 -0
- data/lib/calabash/android/life_cycle.rb +3 -3
- data/lib/calabash/android/orientation.rb +8 -8
- data/lib/calabash/android/physical_buttons.rb +16 -19
- data/lib/calabash/android/server.rb +1 -6
- data/lib/calabash/android/text.rb +12 -12
- data/lib/calabash/android.rb +26 -92
- data/lib/calabash/application.rb +0 -3
- data/lib/calabash/cli/generate.rb +18 -8
- data/lib/calabash/cli/helpers.rb +9 -4
- data/lib/calabash/cli/run.rb +1 -1
- data/lib/calabash/console_helpers.rb +11 -179
- data/lib/calabash/device.rb +19 -4
- data/lib/calabash/gestures.rb +198 -292
- data/lib/calabash/http/retriable_client.rb +3 -18
- data/lib/calabash/http.rb +0 -1
- data/lib/calabash/interactions.rb +40 -3
- data/lib/calabash/ios/conditions.rb +1 -1
- data/lib/calabash/ios/console_helpers.rb +2 -2
- data/lib/calabash/ios/date_picker.rb +8 -10
- data/lib/calabash/ios/device/device_implementation.rb +21 -9
- data/lib/calabash/ios/device/gestures_mixin.rb +55 -53
- data/lib/calabash/ios/device/keyboard_mixin.rb +0 -21
- data/lib/calabash/ios/device/rotation_mixin.rb +65 -3
- data/lib/calabash/ios/device/text_mixin.rb +21 -0
- data/lib/calabash/ios/device.rb +1 -0
- data/lib/calabash/ios/gestures.rb +90 -24
- data/lib/calabash/ios/interactions.rb +6 -1
- data/lib/calabash/ios/lib/.irbrc +2 -9
- data/lib/calabash/ios/orientation.rb +8 -8
- data/lib/calabash/ios/runtime.rb +14 -14
- data/lib/calabash/ios/scroll.rb +17 -25
- data/lib/calabash/ios/slider.rb +18 -11
- data/lib/calabash/ios/text.rb +74 -20
- data/lib/calabash/ios/uia.rb +1 -1
- data/lib/calabash/ios.rb +16 -77
- data/lib/calabash/legacy.rb +6 -9
- data/lib/calabash/lib/skeleton/{Gemfile.skeleton → Gemfile} +0 -0
- data/lib/calabash/lib/skeleton/config/{cucumber.yml.skeleton → cucumber.yml} +0 -0
- data/lib/calabash/lib/skeleton/features/{sample.feature.skeleton → sample.feature} +0 -0
- data/lib/calabash/lib/skeleton/features/step_definitions/{sample_steps.rb.skeleton → calabash_steps.rb} +8 -8
- data/lib/calabash/lib/skeleton/features/support/{dry_run.rb.skeleton → dry_run.rb} +5 -2
- data/lib/calabash/lib/skeleton/features/support/{env.rb.skeleton → env.rb} +8 -2
- data/lib/calabash/lib/skeleton/features/support/hooks.rb +83 -0
- data/lib/calabash/life_cycle.rb +8 -16
- data/lib/calabash/location.rb +15 -14
- data/lib/calabash/orientation.rb +8 -8
- data/lib/calabash/page.rb +4 -1
- data/lib/calabash/screenshot.rb +3 -3
- data/lib/calabash/text.rb +19 -31
- data/lib/calabash/utility.rb +8 -41
- data/lib/calabash/version.rb +1 -1
- data/lib/calabash/wait.rb +192 -177
- data/lib/calabash.rb +10 -53
- metadata +32 -43
- data/lib/calabash/android/device/helper_application.rb +0 -95
- data/lib/calabash/android/lib/HelperApplication.apk +0 -0
- data/lib/calabash/android/lib/HelperApplicationTestServer.apk +0 -0
- data/lib/calabash/android/web.rb +0 -12
- data/lib/calabash/http/forwarding_client.rb +0 -23
- data/lib/calabash/internal.rb +0 -48
- data/lib/calabash/ios/automator/automator.rb +0 -217
- data/lib/calabash/ios/automator/coordinates.rb +0 -37
- data/lib/calabash/ios/automator/device_agent.rb +0 -379
- data/lib/calabash/ios/automator.rb +0 -9
- data/lib/calabash/ios/legacy.rb +0 -6
- data/lib/calabash/ios/web.rb +0 -10
- data/lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton +0 -34
- data/lib/calabash/retry.rb +0 -33
- data/lib/calabash/stubs.rb +0 -21
- data/lib/calabash/web.rb +0 -44
data/lib/calabash/screenshot.rb
CHANGED
@@ -38,7 +38,7 @@ module Calabash
|
|
38
38
|
# If the name given is an absolute path, then Calabash will save the
|
39
39
|
# screenshot to the absolute directory given.
|
40
40
|
#
|
41
|
-
# If the name given starts with ./ (e.g. `
|
41
|
+
# If the name given starts with ./ (e.g. `screenshot('./foo.png')`) then
|
42
42
|
# the filename will be saved relative to the current working directory.
|
43
43
|
#
|
44
44
|
# If the file specified by `name` has no extension then the filename will
|
@@ -49,11 +49,11 @@ module Calabash
|
|
49
49
|
# @param [String] name Name of the screenshot.
|
50
50
|
# @return [String] Path to the screenshot
|
51
51
|
def screenshot(name=nil)
|
52
|
-
|
52
|
+
Device.default.screenshot(name)
|
53
53
|
end
|
54
54
|
|
55
55
|
# Takes a screenshot and embeds it in the test report. This method is only
|
56
|
-
# available/useful when running in the context of
|
56
|
+
# available/useful when running in the context of cucumber.
|
57
57
|
# @see Screenshot#screenshot
|
58
58
|
def screenshot_embed(name=nil)
|
59
59
|
path = screenshot(name)
|
data/lib/calabash/text.rb
CHANGED
@@ -4,19 +4,13 @@ module Calabash
|
|
4
4
|
module Text
|
5
5
|
# Enter `text` into the currently focused view.
|
6
6
|
#
|
7
|
-
# @see Calabash::Text#enter_text_in
|
8
|
-
#
|
9
7
|
# @param [String] text The text to type.
|
10
8
|
# @raise [RuntimeError] if the text cannot be typed.
|
11
9
|
def enter_text(text)
|
12
10
|
_enter_text(text.to_s)
|
13
11
|
end
|
14
12
|
|
15
|
-
# Enter `text` into
|
16
|
-
#
|
17
|
-
# @example
|
18
|
-
# cal.enter_text_in({id: 'edit'}, "Hello World")
|
19
|
-
#
|
13
|
+
# Enter `text` into `query`.
|
20
14
|
# @see Calabash::Text#enter_text
|
21
15
|
#
|
22
16
|
# @param [String] text The text to type.
|
@@ -27,18 +21,11 @@ module Calabash
|
|
27
21
|
end
|
28
22
|
|
29
23
|
# Clears the text of the currently focused view.
|
30
|
-
#
|
31
|
-
# @see Calabash::Text#clear_text_in
|
32
|
-
#
|
33
24
|
def clear_text
|
34
25
|
_clear_text
|
35
26
|
end
|
36
27
|
|
37
|
-
# Clears the text
|
38
|
-
#
|
39
|
-
# @example
|
40
|
-
# cal.clear_text_in({id: 'edit'})
|
41
|
-
#
|
28
|
+
# Clears the text `view`
|
42
29
|
# @see Calabash::Text#clear_text
|
43
30
|
#
|
44
31
|
# @param [String, Hash, Calabash::Query] query A query describing the view
|
@@ -69,10 +56,10 @@ module Calabash
|
|
69
56
|
# See http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html
|
70
57
|
#
|
71
58
|
# @example
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
59
|
+
# tap_keyboard_action_key(:search)
|
60
|
+
# tap_keyboard_action_key(:send)
|
61
|
+
# tap_keyboard_action_key(:next)
|
62
|
+
# tap_keyboard_action_key(:previous)
|
76
63
|
#
|
77
64
|
# Notice that, for Android, Calabash does not ensure that this particular action key is
|
78
65
|
# actually available on the current keyboard.
|
@@ -92,13 +79,13 @@ module Calabash
|
|
92
79
|
# Escapes single quotes in `string`.
|
93
80
|
#
|
94
81
|
# @example
|
95
|
-
#
|
82
|
+
# escape_single_quotes("Let's get this done.")
|
96
83
|
# => "Let\\'s get this done."
|
97
84
|
#
|
98
85
|
# @example
|
99
|
-
#
|
86
|
+
# query("* text:'#{escape_single_quotes("Let's go")}'")
|
100
87
|
# # Equivalent to
|
101
|
-
#
|
88
|
+
# query("* text:'Let\\'s go'")
|
102
89
|
#
|
103
90
|
# @param [String] string The string to escape.
|
104
91
|
# @return [String] A string with its single quotes properly escaped.
|
@@ -122,7 +109,7 @@ module Calabash
|
|
122
109
|
# @param [Number] timeout How long to wait for the keyboard.
|
123
110
|
# @raise [Calabash::Wait::TimeoutError] Raises error if no keyboard
|
124
111
|
# appears.
|
125
|
-
def wait_for_keyboard(timeout
|
112
|
+
def wait_for_keyboard(timeout=nil)
|
126
113
|
keyboard_timeout = keyboard_wait_timeout(timeout)
|
127
114
|
message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to appear"
|
128
115
|
wait_for(message, timeout: keyboard_timeout) do
|
@@ -137,7 +124,7 @@ module Calabash
|
|
137
124
|
# @param [Number] timeout How log to wait for the keyboard to disappear.
|
138
125
|
# @raise [Calabash::Wait::TimeoutError] Raises error if any keyboard is
|
139
126
|
# visible after the `timeout`.
|
140
|
-
def wait_for_no_keyboard(timeout
|
127
|
+
def wait_for_no_keyboard(timeout=nil)
|
141
128
|
keyboard_timeout = keyboard_wait_timeout(timeout)
|
142
129
|
message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear"
|
143
130
|
wait_for(message, timeout: keyboard_timeout) do
|
@@ -145,32 +132,33 @@ module Calabash
|
|
145
132
|
end
|
146
133
|
end
|
147
134
|
|
148
|
-
|
135
|
+
# @!visibility private
|
136
|
+
def _enter_text(text)
|
149
137
|
abstract_method!
|
150
138
|
end
|
151
139
|
|
152
140
|
# @!visibility private
|
153
|
-
|
141
|
+
def _enter_text_in(view, text)
|
154
142
|
abstract_method!
|
155
143
|
end
|
156
144
|
|
157
145
|
# @!visibility private
|
158
|
-
|
146
|
+
def _clear_text
|
159
147
|
abstract_method!
|
160
148
|
end
|
161
149
|
|
162
150
|
# @!visibility private
|
163
|
-
|
151
|
+
def _clear_text_in(view)
|
164
152
|
abstract_method!
|
165
153
|
end
|
166
154
|
|
167
155
|
# @!visibility private
|
168
|
-
|
156
|
+
def _tap_keyboard_action_key(action_key)
|
169
157
|
abstract_method!
|
170
158
|
end
|
171
159
|
|
172
160
|
# @!visibility private
|
173
|
-
|
161
|
+
def _keyboard_visible?
|
174
162
|
abstract_method!
|
175
163
|
end
|
176
164
|
|
@@ -180,7 +168,7 @@ module Calabash
|
|
180
168
|
end
|
181
169
|
|
182
170
|
# @!visibility private
|
183
|
-
|
171
|
+
def keyboard_wait_timeout(timeout)
|
184
172
|
if timeout.nil?
|
185
173
|
Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT
|
186
174
|
else
|
data/lib/calabash/utility.rb
CHANGED
@@ -7,15 +7,16 @@ module Calabash
|
|
7
7
|
|
8
8
|
# Utility methods for testing.
|
9
9
|
module Utility
|
10
|
+
|
10
11
|
# @!visibility private
|
11
|
-
def abstract_method!
|
12
|
-
method_name
|
12
|
+
def abstract_method!
|
13
|
+
method_name = if Kernel.method_defined?(:caller_locations)
|
13
14
|
caller_locations.first.label
|
14
15
|
else
|
15
16
|
caller.first[/\`(.*)\'/, 1]
|
16
17
|
end
|
17
18
|
|
18
|
-
raise AbstractMethodError.new("Abstract method '#{method_name
|
19
|
+
raise AbstractMethodError.new("Abstract method '#{method_name}'")
|
19
20
|
end
|
20
21
|
|
21
22
|
# @!visibility private
|
@@ -26,8 +27,8 @@ module Calabash
|
|
26
27
|
#
|
27
28
|
# @example
|
28
29
|
# # These are equivalent.
|
29
|
-
#
|
30
|
-
#
|
30
|
+
# pan("*", percent(20, 50), percent(20, 100))
|
31
|
+
# pan("*", {x: 20, y: 50}, {x: 20, y: 100})
|
31
32
|
#
|
32
33
|
# @param [Number] x The value of the x percent.
|
33
34
|
# @param [Number] y The value of the y percent.
|
@@ -43,8 +44,8 @@ module Calabash
|
|
43
44
|
#
|
44
45
|
# @example
|
45
46
|
# # These are equivalent.
|
46
|
-
#
|
47
|
-
#
|
47
|
+
# tap_coordinate(coordinate(20, 50)
|
48
|
+
# tap_coordinate({x: 20, y: 50})
|
48
49
|
#
|
49
50
|
# @param [Number] x The value of the x.
|
50
51
|
# @param [Number] y The value of the y.
|
@@ -54,39 +55,5 @@ module Calabash
|
|
54
55
|
end
|
55
56
|
|
56
57
|
alias_method :coord, :coordinate
|
57
|
-
|
58
|
-
# @!visibility private
|
59
|
-
# Sets the default values for a hash. The hash is not mutated by duplicated
|
60
|
-
#
|
61
|
-
# @example
|
62
|
-
# default_hash_values({a: 'b'}, {a: 'q', b: 'c'}) # => {a: 'b', b: 'c'}
|
63
|
-
#
|
64
|
-
# @notice
|
65
|
-
# This method does not overwrite nil
|
66
|
-
def self.default_hash_values(hash, defaults)
|
67
|
-
res = hash.dup
|
68
|
-
|
69
|
-
defaults.each do |key, value|
|
70
|
-
unless res.key?(key)
|
71
|
-
res[key] = value
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
res
|
76
|
-
end
|
77
|
-
|
78
|
-
# @!visibility private
|
79
|
-
def self.used_bundler?
|
80
|
-
defined?(Bundler) && !ENV['BUNDLE_BIN_PATH'].nil?
|
81
|
-
end
|
82
|
-
|
83
|
-
# @!visibility private
|
84
|
-
def self.bundle_exec_prepend
|
85
|
-
if used_bundler?
|
86
|
-
'bundle exec '
|
87
|
-
else
|
88
|
-
''
|
89
|
-
end
|
90
|
-
end
|
91
58
|
end
|
92
59
|
end
|
data/lib/calabash/version.rb
CHANGED