calabash-cucumber 0.18.2 → 0.19.0.pre1

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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/bin/calabash-ios +0 -16
  3. data/bin/calabash-ios-build.rb +0 -86
  4. data/bin/calabash-ios-helpers.rb +0 -65
  5. data/bin/calabash-ios-setup.rb +5 -119
  6. data/bin/calabash-ios-sim.rb +0 -37
  7. data/bin/frank-calabash +0 -1
  8. data/doc/calabash-ios-help.txt +0 -8
  9. data/dylibs/libCalabashDyn.dylib +0 -0
  10. data/dylibs/libCalabashDynSim.dylib +0 -0
  11. data/features-skeleton/support/01_launch.rb +3 -4
  12. data/features/step_definitions/calabash_steps.rb +1 -7
  13. data/lib/calabash-cucumber.rb +1 -2
  14. data/lib/calabash-cucumber/actions/instruments_actions.rb +2 -3
  15. data/lib/calabash-cucumber/core.rb +97 -101
  16. data/lib/calabash-cucumber/device.rb +5 -118
  17. data/lib/calabash-cucumber/environment.rb +109 -5
  18. data/lib/calabash-cucumber/environment_helpers.rb +4 -66
  19. data/lib/calabash-cucumber/http/http.rb +114 -0
  20. data/lib/calabash-cucumber/http_helpers.rb +3 -1
  21. data/lib/calabash-cucumber/ipad_1x_2x.rb +5 -7
  22. data/lib/calabash-cucumber/keyboard_helpers.rb +0 -44
  23. data/lib/calabash-cucumber/launcher.rb +425 -808
  24. data/lib/calabash-cucumber/logging.rb +2 -74
  25. data/lib/calabash-cucumber/operations.rb +0 -2
  26. data/lib/calabash-cucumber/rotation_helpers.rb +2 -82
  27. data/lib/calabash-cucumber/status_bar_helpers.rb +2 -8
  28. data/lib/calabash-cucumber/store/preferences.rb +2 -1
  29. data/lib/calabash-cucumber/uia.rb +4 -9
  30. data/lib/calabash-cucumber/version.rb +2 -2
  31. data/lib/calabash-cucumber/wait_helpers.rb +0 -2
  32. data/staticlib/calabash.framework.zip +0 -0
  33. data/staticlib/libFrankCalabash.a +0 -0
  34. metadata +13 -143
  35. data/lib/calabash-cucumber/actions/playback_actions.rb +0 -109
  36. data/lib/calabash-cucumber/deprecated.rb +0 -34
  37. data/lib/calabash-cucumber/launch/simulator_helper.rb +0 -62
  38. data/lib/calabash-cucumber/launch/simulator_launcher.rb +0 -617
  39. data/lib/calabash-cucumber/playback_helpers.rb +0 -225
  40. data/lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64 +0 -51
  41. data/lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64 +0 -51
  42. data/lib/calabash-cucumber/resources/cell_swipe_ios5_ipad.base64 +0 -74
  43. data/lib/calabash-cucumber/resources/cell_swipe_ios5_iphone.base64 +0 -74
  44. data/lib/calabash-cucumber/resources/double_tap_ios5_ipad.base64 +0 -15
  45. data/lib/calabash-cucumber/resources/double_tap_ios5_iphone.base64 +0 -15
  46. data/lib/calabash-cucumber/resources/double_tap_ios6_ipad.base64 +0 -22
  47. data/lib/calabash-cucumber/resources/double_tap_ios6_iphone.base64 +0 -22
  48. data/lib/calabash-cucumber/resources/pan_ios5_ipad.base64 +0 -199
  49. data/lib/calabash-cucumber/resources/pan_ios5_iphone.base64 +0 -199
  50. data/lib/calabash-cucumber/resources/pan_ios6_ipad.base64 +0 -206
  51. data/lib/calabash-cucumber/resources/pan_ios6_iphone.base64 +0 -206
  52. data/lib/calabash-cucumber/resources/pinch_in_ios4_ipad.base64 +0 -104
  53. data/lib/calabash-cucumber/resources/pinch_in_ios4_iphone.base64 +0 -104
  54. data/lib/calabash-cucumber/resources/pinch_in_ios5_ipad.base64 +0 -144
  55. data/lib/calabash-cucumber/resources/pinch_in_ios5_iphone.base64 +0 -144
  56. data/lib/calabash-cucumber/resources/pinch_in_ios6_ipad.base64 +0 -70
  57. data/lib/calabash-cucumber/resources/pinch_in_ios6_iphone.base64 +0 -70
  58. data/lib/calabash-cucumber/resources/pinch_out_ios5_ipad.base64 +0 -207
  59. data/lib/calabash-cucumber/resources/pinch_out_ios5_iphone.base64 +0 -207
  60. data/lib/calabash-cucumber/resources/pinch_out_ios6_ipad.base64 +0 -96
  61. data/lib/calabash-cucumber/resources/pinch_out_ios6_iphone.base64 +0 -96
  62. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_ipad.base64 +0 -2
  63. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_iphone.base64 +0 -2
  64. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_ipad.base64 +0 -2
  65. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_iphone.base64 +0 -2
  66. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_ipad.base64 +0 -2
  67. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_iphone.base64 +0 -2
  68. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_ipad.base64 +0 -2
  69. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_iphone.base64 +0 -2
  70. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_ipad.base64 +0 -2
  71. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_iphone.base64 +0 -2
  72. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_ipad.base64 +0 -2
  73. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_iphone.base64 +0 -2
  74. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_ipad.base64 +0 -2
  75. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_iphone.base64 +0 -2
  76. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_ipad.base64 +0 -2
  77. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_iphone.base64 +0 -2
  78. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_ipad.base64 +0 -2
  79. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_iphone.base64 +0 -2
  80. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_ipad.base64 +0 -2
  81. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_iphone.base64 +0 -2
  82. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_ipad.base64 +0 -2
  83. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_iphone.base64 +0 -2
  84. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_ipad.base64 +0 -2
  85. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_iphone.base64 +0 -2
  86. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_ipad.base64 +0 -2
  87. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_iphone.base64 +0 -2
  88. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_ipad.base64 +0 -2
  89. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_iphone.base64 +0 -2
  90. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_ipad.base64 +0 -2
  91. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_iphone.base64 +0 -2
  92. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_ipad.base64 +0 -2
  93. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_iphone.base64 +0 -2
  94. data/lib/calabash-cucumber/resources/swipe_down_ios5_ipad.base64 +0 -18
  95. data/lib/calabash-cucumber/resources/swipe_down_ios5_iphone.base64 +0 -31
  96. data/lib/calabash-cucumber/resources/swipe_down_ios6_ipad.base64 +0 -25
  97. data/lib/calabash-cucumber/resources/swipe_down_ios6_iphone.base64 +0 -25
  98. data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_ipad.base64 +0 -15
  99. data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_iphone.base64 +0 -15
  100. data/lib/calabash-cucumber/resources/swipe_left_ios4_ipad.base64 +0 -18
  101. data/lib/calabash-cucumber/resources/swipe_left_ios4_iphone.base64 +0 -18
  102. data/lib/calabash-cucumber/resources/swipe_left_ios5_ipad.base64 +0 -17
  103. data/lib/calabash-cucumber/resources/swipe_left_ios5_iphone.base64 +0 -34
  104. data/lib/calabash-cucumber/resources/swipe_left_ios6_ipad.base64 +0 -28
  105. data/lib/calabash-cucumber/resources/swipe_left_ios6_iphone.base64 +0 -28
  106. data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_ipad.base64 +0 -17
  107. data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_iphone.base64 +0 -17
  108. data/lib/calabash-cucumber/resources/swipe_right_ios4_ipad.base64 +0 -13
  109. data/lib/calabash-cucumber/resources/swipe_right_ios4_iphone.base64 +0 -13
  110. data/lib/calabash-cucumber/resources/swipe_right_ios5_ipad.base64 +0 -17
  111. data/lib/calabash-cucumber/resources/swipe_right_ios5_iphone.base64 +0 -17
  112. data/lib/calabash-cucumber/resources/swipe_right_ios6_ipad.base64 +0 -25
  113. data/lib/calabash-cucumber/resources/swipe_right_ios6_iphone.base64 +0 -25
  114. data/lib/calabash-cucumber/resources/swipe_up_ios5_ipad.base64 +0 -34
  115. data/lib/calabash-cucumber/resources/swipe_up_ios5_iphone.base64 +0 -28
  116. data/lib/calabash-cucumber/resources/swipe_up_ios6_ipad.base64 +0 -25
  117. data/lib/calabash-cucumber/resources/swipe_up_ios6_iphone.base64 +0 -25
  118. data/lib/calabash-cucumber/resources/touch_done_ios4_ipad.base64 +0 -7
  119. data/lib/calabash-cucumber/resources/touch_done_ios4_iphone.base64 +0 -9
  120. data/lib/calabash-cucumber/resources/touch_done_ios5_ipad.base64 +0 -7
  121. data/lib/calabash-cucumber/resources/touch_done_ios5_iphone.base64 +0 -9
  122. data/lib/calabash-cucumber/resources/touch_hold_ios5_ipad.base64 +0 -9
  123. data/lib/calabash-cucumber/resources/touch_hold_ios5_iphone.base64 +0 -9
  124. data/lib/calabash-cucumber/resources/touch_hold_ios6_ipad.base64 +0 -9
  125. data/lib/calabash-cucumber/resources/touch_hold_ios6_iphone.base64 +0 -9
  126. data/lib/calabash-cucumber/resources/touch_ios4_ipad.base64 +0 -9
  127. data/lib/calabash-cucumber/resources/touch_ios4_iphone.base64 +0 -9
  128. data/lib/calabash-cucumber/resources/touch_ios5_ipad.base64 +0 -9
  129. data/lib/calabash-cucumber/resources/touch_ios5_iphone.base64 +0 -9
  130. data/lib/calabash-cucumber/resources/touch_ios7_ipad.base64 +0 -9
  131. data/lib/calabash-cucumber/resources/touch_ios7_iphone.base64 +0 -9
  132. data/lib/calabash-cucumber/resources/wheel_down_ios4_ipad.base64 +0 -159
  133. data/lib/calabash-cucumber/resources/wheel_down_ios4_iphone.base64 +0 -159
  134. data/lib/calabash-cucumber/resources/wheel_down_ios5_ipad.base64 +0 -156
  135. data/lib/calabash-cucumber/resources/wheel_down_ios5_iphone.base64 +0 -156
  136. data/lib/calabash-cucumber/resources/wheel_up_ios4_ipad.base64 +0 -166
  137. data/lib/calabash-cucumber/resources/wheel_up_ios4_iphone.base64 +0 -166
  138. data/lib/calabash-cucumber/resources/wheel_up_ios5_ipad.base64 +0 -156
  139. data/lib/calabash-cucumber/resources/wheel_up_ios5_iphone.base64 +0 -156
  140. data/lib/calabash-cucumber/utils/logging.rb +0 -111
  141. data/lib/calabash-cucumber/utils/plist_buddy.rb +0 -45
  142. data/lib/calabash-cucumber/utils/simulator_accessibility.rb +0 -334
  143. data/lib/calabash-cucumber/utils/xctools.rb +0 -101
  144. data/scripts/.irbrc +0 -64
  145. data/scripts/launch.rb +0 -48
@@ -2,13 +2,117 @@ module Calabash
2
2
  module Cucumber
3
3
  module Environment
4
4
 
5
- def self.device_target
6
- value = ENV["DEVICE_TARGET"]
5
+ require "run_loop"
7
6
 
8
- if value.nil? || value == ""
9
- nil
10
- else
7
+ # @!visibility private
8
+ DEFAULTS = {
9
+ # The endpoint of the app under test
10
+ :aut_endpoint => "http://127.0.0.1:37265/",
11
+ :http_connection_retries => 10,
12
+ :http_connection_timeout => 60
13
+ }
14
+
15
+ # @!visibility private
16
+ def self.xtc?
17
+ RunLoop::Environment.xtc?
18
+ end
19
+
20
+ # @!visibility private
21
+ def self.xcode
22
+ return nil if self.xtc?
23
+ @@xcode ||= RunLoop::Xcode.new
24
+ end
25
+
26
+ # @!visibility private
27
+ def self.simctl
28
+ return nil if self.xtc?
29
+ @@simctl ||= RunLoop::SimControl.new
30
+ end
31
+
32
+ # @!visibility private
33
+ def self.instruments
34
+ return nil if self.xtc?
35
+ @@instruments ||= RunLoop::Instruments.new
36
+ end
37
+
38
+ # @!visibility private
39
+ def self.device_endpoint
40
+ value = RunLoop::Environment.device_endpoint
41
+ if value
11
42
  value
43
+ else
44
+ DEFAULTS[:aut_endpoint]
45
+ end
46
+ end
47
+
48
+ # @!visibility private
49
+ def self.http_connection_retries
50
+ value = ENV["MAX_CONNECT_RETRIES"]
51
+ if value && value != ""
52
+ value.to_i
53
+ else
54
+ DEFAULTS[:http_connection_retries]
55
+ end
56
+ end
57
+
58
+ # @!visibility private
59
+ def self.http_connection_timeout
60
+ value = ENV["CONNECTION_TIMEOUT"]
61
+ if value && value != ""
62
+ value.to_i
63
+ else
64
+ DEFAULTS[:http_connection_timeout]
65
+ end
66
+ end
67
+
68
+ # @!visibility private
69
+ def self.reset_between_scenarios?
70
+ ENV["RESET_BETWEEN_SCENARIOS"] == "1"
71
+ end
72
+
73
+ # @!visibility private
74
+ def self.quit_app_after_scenario?
75
+ value = ENV["QUIT_APP_AFTER_SCENARIO"]
76
+
77
+ if value == "0"
78
+ false
79
+ elsif value == "1"
80
+ true
81
+ else
82
+ !self.no_stop?
83
+ end
84
+ end
85
+
86
+ private
87
+
88
+ # @visibility private
89
+ # @deprecated 0.19.0 - replaced with QUIT_APP_AFTER_SCENARIO
90
+ #
91
+ # Silently deprecated. Deprecate in 0.20.0.
92
+ def self.no_stop?
93
+ value = ENV["NO_STOP"]
94
+ if value
95
+ return_value = value == "1"
96
+
97
+ =begin
98
+ if return_value
99
+ replacement = "$ QUIT_APP_AFTER_SCENARIO=0"
100
+ else
101
+ replacement = "$ QUIT_APP_AFTER_SCENARIO=1"
102
+ end
103
+ RunLoop.deprecated("0.19.0",
104
+ %Q{The 'NO_STOP' env variable has been been replaced with: QUIT_APP_AFTER_SCENARIO
105
+
106
+ Please replace NO_STOP with QUIT_APP_AFTER_SCENARIO.
107
+
108
+ #{replacement}
109
+
110
+ The default behavior is to quit the app after each scenario.
111
+ })
112
+ =end
113
+ return_value
114
+ else
115
+ false
12
116
  end
13
117
  end
14
118
  end
@@ -1,6 +1,5 @@
1
1
  require 'calabash-cucumber/device'
2
2
  require 'calabash-cucumber/launcher'
3
- require 'calabash-cucumber/utils/logging'
4
3
 
5
4
  module Calabash
6
5
  module Cucumber
@@ -13,8 +12,6 @@ module Calabash
13
12
  # be set.
14
13
  module EnvironmentHelpers
15
14
 
16
- include Calabash::Cucumber::Logging
17
-
18
15
  # Are the uia* methods available?
19
16
  #
20
17
  # @note
@@ -133,10 +130,6 @@ module Calabash
133
130
 
134
131
  # The iOS version on the device under test.
135
132
  #
136
- # @note
137
- # **WARNING:** The `OS` env variable has been deprecated and should
138
- # never be set.
139
- #
140
133
  # @raise [RuntimeError] If the server cannot be reached.
141
134
  # @return [RunLoop::Version] The version of the iOS running on the device.
142
135
  def ios_version
@@ -160,55 +153,30 @@ module Calabash
160
153
 
161
154
  # Is the device under test running iOS 5?
162
155
  #
163
- # @note
164
- # **WARNING:** The `OS` env variable has been deprecated and should
165
- # never be set.
166
- #
167
- # @note
168
- # **WARNING:* Setting the `OS` env variable will override the value returned
169
- # by querying the device.
170
156
  # @raise [RuntimeError] if the server cannot be reached
171
157
  # @return [Boolean] true if device under test is running iOS 5
172
158
  def ios5?
173
- _OS_ENV.eql?(_canonical_os_version(:ios5)) || _default_device_or_create().ios5?
159
+ _default_device_or_create.ios5?
174
160
  end
175
161
 
176
162
  # Is the device under test running iOS 6?
177
163
  #
178
- # @note
179
- # **WARNING:** The `OS` env variable has been deprecated and should
180
- # never be set.
181
- #
182
- # @note
183
- # **WARNING:* Setting the `OS` env variable will override the value returned
184
- # by querying the device.
185
164
  # @raise [RuntimeError] if the server cannot be reached
186
165
  # @return [Boolean] true if device under test is running iOS 6
187
166
  def ios6?
188
- _OS_ENV.eql?(_canonical_os_version(:ios6)) || _default_device_or_create().ios6?
167
+ _default_device_or_create.ios6?
189
168
  end
190
169
 
191
170
  # Is the device under test running iOS 7?
192
171
  #
193
- # @note
194
- # **WARNING:** The `OS` env variable has been deprecated and should
195
- # never be set.
196
- #
197
- # @note
198
- # **WARNING:* Setting the `OS` env variable will override the value returned
199
- # by querying the device.
200
172
  # @raise [RuntimeError] if the server cannot be reached
201
173
  # @return [Boolean] true if device under test is running iOS 7
202
174
  def ios7?
203
- _OS_ENV.eql?(_canonical_os_version(:ios7)) || _default_device_or_create().ios7?
175
+ _default_device_or_create.ios7?
204
176
  end
205
177
 
206
178
  # Is the device under test running iOS 8?
207
179
  #
208
- # @note
209
- # **WARNING:** The `OS` env variable has been deprecated and should
210
- # never be set.
211
- #
212
180
  # @raise [RuntimeError] if the server cannot be reached
213
181
  # @return [Boolean] true if device under test is running iOS 8
214
182
  def ios8?
@@ -217,10 +185,6 @@ module Calabash
217
185
 
218
186
  # Is the device under test running iOS 9?
219
187
  #
220
- # @note
221
- # **WARNING:** The `OS` env variable has been deprecated and should
222
- # never be set.
223
- #
224
188
  # @raise [RuntimeError] if the server cannot be reached
225
189
  # @return [Boolean] true if device under test is running iOS 9
226
190
  def ios9?
@@ -237,13 +201,6 @@ module Calabash
237
201
  _default_device_or_create.iphone_app_emulated_on_ipad?
238
202
  end
239
203
 
240
- # @deprecated 0.9.168 replaced with `iphone_4in?`
241
- # @see #iphone_4in?
242
- def iphone_5?
243
- _deprecated('0.9.168', "use 'iphone_4in?' instead", :warn)
244
- iphone_4in?
245
- end
246
-
247
204
  private
248
205
  # @!visibility private
249
206
  # Returns the device that is currently being tested against.
@@ -256,29 +213,10 @@ module Calabash
256
213
  def _default_device_or_create
257
214
  device = default_device
258
215
  if device.nil?
259
- device = Calabash::Cucumber::Device.new(nil, server_version())
216
+ device = Calabash::Cucumber::Device.new(nil, server_version)
260
217
  end
261
218
  device
262
219
  end
263
-
264
- # Returns the value of the environmental variable OS.
265
- #
266
- # @note
267
- # The `OS` env has been deprecated for some time. It should never be set.
268
- def _OS_ENV
269
- ENV['OS']
270
- end
271
-
272
- # @!visibility private
273
- CANONICAL_IOS_VERSIONS = {:ios5 => 'ios5',
274
- :ios6 => 'ios6',
275
- :ios7 => 'ios7'}
276
-
277
-
278
- # Returns the canonical value iOS versions as strings.
279
- def _canonical_os_version(key)
280
- CANONICAL_IOS_VERSIONS[key]
281
- end
282
220
  end
283
221
  end
284
222
  end
@@ -0,0 +1,114 @@
1
+ module Calabash
2
+ module Cucumber
3
+
4
+ # Raised when a connection to the embedded server cannot be made.
5
+ class ServerNotRespondingError < RuntimeError; end
6
+
7
+ # @!visibility private
8
+ class HTTP
9
+
10
+ require "json"
11
+ require "calabash-cucumber/environment"
12
+ require "run_loop"
13
+
14
+ # @!visibility private
15
+ def self.ping_app
16
+ endpoint = Calabash::Cucumber::Environment.device_endpoint
17
+ url = URI.parse(endpoint)
18
+
19
+ http = Net::HTTP.new(url.host, url.port)
20
+ response = http.start do |sess|
21
+ sess.request(Net::HTTP::Get.new("version"))
22
+ end
23
+
24
+ body = nil
25
+ success = response.is_a?(Net::HTTPSuccess)
26
+ if success
27
+ json = response.body
28
+ begin
29
+ body = JSON.parse(json)
30
+ rescue TypeError, JSON::ParserError => _
31
+ success = false
32
+ end
33
+ end
34
+
35
+ http.finish if http and http.started?
36
+
37
+ return success, body
38
+ end
39
+
40
+ # @!visibility private
41
+ def self.ensure_connectivity(options={})
42
+
43
+ default_options = {
44
+ :http_connection_retry => Calabash::Cucumber::Environment.http_connection_retries,
45
+ :http_connection_timeout => Calabash::Cucumber::Environment.http_connection_timeout
46
+ }
47
+
48
+ merged_options = default_options.merge(options)
49
+
50
+ max_retry_count = merged_options[:http_connection_retry]
51
+ timeout = merged_options[:http_connection_timeout]
52
+
53
+ start_time = Time.now
54
+ last_error = nil
55
+
56
+ max_retry_count.times do |try|
57
+ RunLoop.log_debug("Trying to connect to Calabash Server: #{try + 1} of #{max_retry_count}")
58
+
59
+ # Subtract the aggregate time we've spent thus far to make sure we're
60
+ # not exceeding the request timeout across retries.
61
+ time_diff = start_time + timeout - Time.now
62
+
63
+ if time_diff <= 0
64
+ break
65
+ end
66
+
67
+ begin
68
+ success, body = self.ping_app
69
+ return success, body if success
70
+ rescue => e
71
+ last_error = e
72
+ ensure
73
+ sleep(1)
74
+ end
75
+ end
76
+
77
+ self.raise_on_no_connectivity(last_error)
78
+ end
79
+
80
+ private
81
+
82
+ def self.raise_on_no_connectivity(last_error)
83
+ if Calabash::Cucumber::Environment.xtc?
84
+ raise Calabash::Cucumber::ServerNotRespondingError,
85
+ %Q[Could not connect to the Calabash Server.
86
+
87
+ #{last_error}
88
+
89
+ Please contact: testcloud-support@xamarin.com
90
+ ]
91
+ else
92
+ endpoint = Calabash::Cucumber::Environment.device_endpoint
93
+ raise Calabash::Cucumber::ServerNotRespondingError,
94
+ %Q[Could not connect to the Calabash Server @ #{endpoint}.
95
+
96
+ See these two guides for help.
97
+
98
+ * https://github.com/calabash/calabash-ios/wiki/Testing-on-Physical-Devices
99
+ * https://github.com/calabash/calabash-ios/wiki/Testing-on-iOS-Simulators
100
+
101
+ 1. Make sure your application is linked with Calabash.
102
+ 2. Make sure there is not a firewall blocking traffic on #{endpoint}.
103
+ 3. Make sure #{endpoint} is correct.
104
+
105
+ If your app is crashing at launch, find a crash report to determine the cause.
106
+
107
+ ]
108
+ end
109
+
110
+ end
111
+ end
112
+ end
113
+ end
114
+
@@ -6,6 +6,8 @@ module Calabash
6
6
  # @!visibility private
7
7
  module HTTPHelpers
8
8
 
9
+ require "calabash-cucumber/environment"
10
+
9
11
  # @!visibility private
10
12
  CAL_HTTP_RETRY_COUNT=3
11
13
 
@@ -33,7 +35,7 @@ module Calabash
33
35
 
34
36
  # @!visibility private
35
37
  def url_for(verb)
36
- url = URI.parse(ENV['DEVICE_ENDPOINT']|| "http://localhost:37265")
38
+ url = URI.parse(Calabash::Cucumber::Environment.device_endpoint)
37
39
  path = url.path
38
40
  if path.end_with? "/"
39
41
  path = "#{path}#{verb}"
@@ -206,13 +206,11 @@ module Calabash
206
206
  #
207
207
  # @example Here is an example of how to use this function in your `Before` launch hooks.
208
208
  # Before do |scenario|
209
- # @calabash_launcher = Calabash::Cucumber::Launcher.new
210
- # unless @calabash_launcher.calabash_no_launch?
211
- # @calabash_launcher.relaunch
212
- # @calabash_launcher.calabash_notify(self)
213
- # # ensure emulated apps are at 1x
214
- # ensure_ipad_emulation_1x
215
- # end
209
+ # launcher = Calabash::Cucumber::Launcher.new
210
+ # launcher.relaunch
211
+ # # ensure emulated apps are at 1x
212
+ # ensure_ipad_emulation_1x
213
+ #
216
214
  # # do other stuff to prepare the test environment
217
215
  # end
218
216
  #
@@ -1,13 +1,10 @@
1
1
  require 'calabash-cucumber/core'
2
2
  require 'calabash-cucumber/tests_helpers'
3
- require 'calabash-cucumber/playback_helpers'
4
3
  require 'calabash-cucumber/environment_helpers'
5
- require 'calabash-cucumber/utils/logging'
6
4
 
7
5
  module Calabash
8
6
  module Cucumber
9
7
 
10
-
11
8
  # Raised when there is a problem involving a keyboard mode. There are
12
9
  # three keyboard modes: docked, split, and undocked.
13
10
  #
@@ -52,7 +49,6 @@ module Calabash
52
49
  module KeyboardHelpers
53
50
 
54
51
  include Calabash::Cucumber::TestsHelpers
55
- include Calabash::Cucumber::Logging
56
52
 
57
53
  # @!visibility private
58
54
  KEYPLANE_NAMES = {
@@ -168,13 +164,6 @@ module Calabash
168
164
  end
169
165
  end
170
166
 
171
- # @deprecated 0.9.163 replaced with `wait_for_keyboard`
172
- # @see #wait_for_keyboard
173
- def await_keyboard
174
- _deprecated('0.9.163', "use 'wait_for_keyboard' instead", :warn)
175
- wait_for_keyboard
176
- end
177
-
178
167
  # @!visibility private
179
168
  # returns an array of possible ipad keyboard modes
180
169
  def _ipad_keyboard_modes
@@ -291,12 +280,6 @@ module Calabash
291
280
  # @option opts [Float] :wait_after_char ('POST_ENTER_KEYBOARD' or 0.05)
292
281
  # how long to wait after a character is typed.
293
282
  def keyboard_enter_char(chr, opts={})
294
- unless opts.is_a?(Hash)
295
- msg = "you should no longer pass a boolean as the second arg; pass {:should_screenshot => '#{opts}'} hash instead"
296
- _deprecated('0.9.163', msg, :warn)
297
- opts = {:should_screenshot => opts}
298
- end
299
-
300
283
  default_opts = {:should_screenshot => true,
301
284
  # introduce a small wait to avoid skipping characters
302
285
  # keep this as short as possible
@@ -450,33 +433,6 @@ module Calabash
450
433
  keyboard_enter_char 'Return'
451
434
  end
452
435
 
453
- # @deprecated 0.10.0 replaced with `tap_keyboard_action_key`
454
- # @see #tap_keyboard_action_key
455
- #
456
- # Touches the keyboard action key.
457
- #
458
- # The action key depends on the keyboard. Some examples include:
459
- #
460
- # * Return
461
- # * Next
462
- # * Go
463
- # * Join
464
- # * Search
465
- #
466
- # @note
467
- # Not all keyboards have an action key. For example, numeric keyboards
468
- # do not have an action key.
469
- #
470
- # @raise [RuntimeError] if the text cannot be typed.
471
- def done
472
- _deprecated("0.10.0",
473
- %Q{Use tap_keyboard_action_key
474
-
475
- The `done` method will be removed in 0.19.0
476
- }, :warn)
477
- tap_keyboard_action_key
478
- end
479
-
480
436
  # @!visibility private
481
437
  # Returns the current keyplane.
482
438
  def _current_keyplane