calabash-cucumber 0.9.163.pre7 → 0.9.163.pre8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 935fb322920c42a450cfed4c7007ec349410a7fc
|
4
|
+
data.tar.gz: 37c61285dbbfc659e4327d4f8a2154d20ad64198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f28162d1b34ed65dde3b08119cda37fa54860f6c57f79caf1095c37f1f360f13018c41b74f183018ed5686a5bef84de3a4e40f47220d3a06faef10177de6f6e6
|
7
|
+
data.tar.gz: cc0c773558508bf20ef69e526485a1c5e456d3fb09b29893da03e5784780aa88b0264d4238f96e3cfbf511c4b15f2b9374f9517f2c4168f08e3296c9fccc0039
|
data/calabash-cucumber.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_dependency( "geocoder", "~>1.1.8")
|
27
27
|
s.add_dependency( "httpclient","~> 2.3.3")
|
28
28
|
s.add_dependency( "bundler", "~> 1.1")
|
29
|
-
s.add_dependency( "run_loop", "~> 0.1.0.
|
29
|
+
s.add_dependency( "run_loop", "~> 0.1.0.pre7" )
|
30
30
|
s.add_dependency( "awesome_print")
|
31
31
|
s.add_dependency( "xamarin-test-cloud", "~> 0.9.25")
|
32
32
|
|
@@ -13,6 +13,11 @@ module Calabash
|
|
13
13
|
ENV['OS']=='ios7' || (launcher && launcher.device && launcher.device.ios7?)
|
14
14
|
end
|
15
15
|
|
16
|
+
|
17
|
+
|
18
|
+
# Deprecated - abstracted into
|
19
|
+
# actions/instruments_actions.rb - actions that can be performed under instruments
|
20
|
+
#
|
16
21
|
def touch_ios7(options)
|
17
22
|
ui_query = options[:query]
|
18
23
|
offset = options[:offset]
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'calabash-cucumber/core'
|
2
2
|
require 'calabash-cucumber/tests_helpers'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
module Calabash
|
5
6
|
module Cucumber
|
@@ -7,30 +8,31 @@ module Calabash
|
|
7
8
|
include Calabash::Cucumber::Core
|
8
9
|
include Calabash::Cucumber::TestsHelpers
|
9
10
|
|
10
|
-
|
11
11
|
class WaitError < RuntimeError
|
12
12
|
end
|
13
|
+
|
13
14
|
CALABASH_CONDITIONS = {:none_animating => "NONE_ANIMATING",
|
14
15
|
:no_network_indicator => "NO_NETWORK_INDICATOR"}
|
15
16
|
|
16
17
|
|
17
18
|
def wait_for(options_or_timeout=
|
18
|
-
{:timeout =>
|
19
|
-
:retry_frequency => 0.
|
20
|
-
:post_timeout => 0
|
19
|
+
{:timeout => 30,
|
20
|
+
:retry_frequency => 0.3,
|
21
|
+
:post_timeout => 0,
|
21
22
|
:timeout_message => 'Timed out waiting...',
|
22
23
|
:screenshot_on_error => true}, &block)
|
23
24
|
#note Hash is preferred, number acceptable for backwards compat
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
default_timeout = 30
|
26
|
+
timeout=options_or_timeout || default_timeout
|
27
|
+
post_timeout=0
|
28
|
+
retry_frequency=0.3
|
27
29
|
timeout_message = nil
|
28
30
|
screenshot_on_error = true
|
29
31
|
|
30
32
|
if options_or_timeout.is_a?(Hash)
|
31
|
-
timeout = options_or_timeout[:timeout] ||
|
32
|
-
retry_frequency = options_or_timeout[:retry_frequency] ||
|
33
|
-
post_timeout = options_or_timeout[:post_timeout] ||
|
33
|
+
timeout = options_or_timeout[:timeout] || default_timeout
|
34
|
+
retry_frequency = options_or_timeout[:retry_frequency] || retry_frequency
|
35
|
+
post_timeout = options_or_timeout[:post_timeout] || post_timeout
|
34
36
|
timeout_message = options_or_timeout[:timeout_message]
|
35
37
|
if options_or_timeout.key?(:screenshot_on_error)
|
36
38
|
screenshot_on_error = options_or_timeout[:screenshot_on_error]
|
@@ -38,36 +40,41 @@ module Calabash
|
|
38
40
|
end
|
39
41
|
|
40
42
|
begin
|
41
|
-
Timeout::timeout(timeout,WaitError) do
|
43
|
+
Timeout::timeout(timeout, WaitError) do
|
42
44
|
sleep(retry_frequency) until yield
|
43
45
|
end
|
44
46
|
sleep(post_timeout) if post_timeout > 0
|
45
47
|
rescue WaitError => e
|
46
48
|
msg = timeout_message || e
|
47
49
|
if screenshot_on_error
|
48
|
-
|
49
|
-
|
50
|
-
res = yield
|
51
|
-
# Validate after taking screenshot
|
52
|
-
if res
|
53
|
-
return res
|
54
|
-
else
|
55
|
-
embed(path)
|
56
|
-
raise msg
|
57
|
-
end
|
50
|
+
sleep(retry_frequency)
|
51
|
+
return screenshot_and_retry(msg, &block)
|
58
52
|
else
|
59
|
-
|
60
|
-
|
53
|
+
raise wait_error(msg)
|
54
|
+
end
|
61
55
|
rescue Exception => e
|
62
56
|
handle_error_with_options(e, nil, screenshot_on_error)
|
63
57
|
end
|
64
58
|
end
|
65
59
|
|
60
|
+
def screenshot_and_retry(msg, &block)
|
61
|
+
path = screenshot
|
62
|
+
res = yield
|
63
|
+
# Validate after taking screenshot
|
64
|
+
if res
|
65
|
+
FileUtils.rm_f(path)
|
66
|
+
return res
|
67
|
+
else
|
68
|
+
embed(path)
|
69
|
+
raise wait_error(msg)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
66
73
|
def wait_poll(opts, &block)
|
67
74
|
test = opts[:until]
|
68
75
|
if test.nil?
|
69
76
|
cond = opts[:until_exists]
|
70
|
-
raise
|
77
|
+
raise 'Must provide :until or :until_exists' unless cond
|
71
78
|
test = lambda { element_exists(cond) }
|
72
79
|
end
|
73
80
|
wait_for(opts) do
|
@@ -111,12 +118,12 @@ module Calabash
|
|
111
118
|
options[:condition] = target_condition
|
112
119
|
end
|
113
120
|
options[:condition] = options[:condition] || CALABASH_CONDITIONS[:none_animating]
|
114
|
-
options[:post_timeout] = options[:post_timeout] || 0
|
121
|
+
options[:post_timeout] = options[:post_timeout] || 0
|
115
122
|
options[:frequency] = options[:frequency] || 0.3
|
116
|
-
options[:retry_frequency] = options[:retry_frequency] || 0.3
|
123
|
+
retry_frequency = options[:retry_frequency] = options[:retry_frequency] || 0.3
|
117
124
|
options[:count] = options[:count] || 2
|
118
|
-
options[:timeout_message] = options[:timeout_message] || "Timeout waiting for condition (#{options[:condition]})"
|
119
|
-
options[:screenshot_on_error] = options[:screenshot_on_error] || true
|
125
|
+
timeout_message = options[:timeout_message] = options[:timeout_message] || "Timeout waiting for condition (#{options[:condition]})"
|
126
|
+
screenshot_on_error = options[:screenshot_on_error] = options[:screenshot_on_error] || true
|
120
127
|
|
121
128
|
begin
|
122
129
|
Timeout::timeout(options[:timeout],WaitError) do
|
@@ -130,7 +137,18 @@ module Calabash
|
|
130
137
|
sleep(options[:post_timeout]) if options[:post_timeout] > 0
|
131
138
|
end
|
132
139
|
rescue WaitError => e
|
133
|
-
|
140
|
+
msg = timeout_message || e
|
141
|
+
if screenshot_on_error
|
142
|
+
sleep(retry_frequency)
|
143
|
+
return screenshot_and_retry(msg) do
|
144
|
+
res = http({:method => :post, :path => 'condition'},
|
145
|
+
options)
|
146
|
+
res = JSON.parse(res)
|
147
|
+
res['outcome'] == 'SUCCESS'
|
148
|
+
end
|
149
|
+
else
|
150
|
+
raise wait_error(msg)
|
151
|
+
end
|
134
152
|
rescue Exception => e
|
135
153
|
handle_error_with_options(e,nil, options[:screenshot_on_error])
|
136
154
|
end
|
@@ -170,6 +188,10 @@ module Calabash
|
|
170
188
|
end
|
171
189
|
end
|
172
190
|
|
191
|
+
def wait_error(msg)
|
192
|
+
(msg.is_a?(String) ? WaitError.new(msg) : msg)
|
193
|
+
end
|
194
|
+
|
173
195
|
|
174
196
|
end
|
175
197
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.163.
|
4
|
+
version: 0.9.163.pre8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.1.0.
|
159
|
+
version: 0.1.0.pre7
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.1.0.
|
166
|
+
version: 0.1.0.pre7
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: awesome_print
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|