testautoi 0.9.143 → 0.9.144
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/testautoi +30 -5
- data/calabash-cucumber.gemspec +5 -4
- data/features-skeleton/support/01_launch.rb +3 -1
- data/lib/calabash-cucumber/core.rb +40 -19
- data/lib/calabash-cucumber/launch/simulator_helper.rb +2 -2
- data/lib/calabash-cucumber/launcher.rb +7 -3
- data/lib/calabash-cucumber/version.rb +2 -2
- data/scripts/launch.rb +9 -1
- data/testautoi.gemspecx +31 -0
- metadata +49 -16
data/bin/testautoi
CHANGED
@@ -120,11 +120,24 @@ def run(option)
|
|
120
120
|
#calabash_sim_location(['on', app_bundle_id])
|
121
121
|
if option == 'console'
|
122
122
|
Calabash::Cucumber::SimulatorHelper.relaunch(env["APP_BUNDLE_PATH"], @settings["sim_version"], @settings["sim_device"])
|
123
|
-
else
|
124
|
-
ENV["SDK_VERSION"] = @settings["sim_version"]
|
125
|
-
ENV["DEVICE"] = @settings["sim_device"]
|
126
123
|
end
|
124
|
+
# For Calabash
|
125
|
+
env["DEVICE"] = @settings["sim_device"]
|
126
|
+
env["SDK_VERSION"] = @settings["sim_version"]
|
127
|
+
# For Test Automation
|
128
|
+
env["DEVICE_ID"] = ""
|
129
|
+
env["DEVICE_CLASS"] = @settings["sim_device"]
|
130
|
+
env["DEVICE_VERSION"] = ENV["SDK_VERSION"]
|
131
|
+
env["DEVICE_TYPE"] = @settings["sim_device"]
|
132
|
+
env["DEVICE_SN"] = ""
|
127
133
|
else
|
134
|
+
# Use a device
|
135
|
+
dev = Device.new(device_udid)
|
136
|
+
env["DEVICE_ID"] = device_udid
|
137
|
+
env["DEVICE_CLASS"] = dev.device_class
|
138
|
+
env["DEVICE_VERSION"] = dev.product_version
|
139
|
+
env["DEVICE_TYPE"] = dev.product_type
|
140
|
+
env["DEVICE_SN"] = dev.serial_number
|
128
141
|
env["NO_LAUNCH"] = "1"
|
129
142
|
get_device_ip
|
130
143
|
if ENV["CLEAN_INSTALL"] == "1"
|
@@ -289,11 +302,11 @@ def get_build(version, sim)
|
|
289
302
|
mount_node = smb_connect(@settings["build_drop_location"],
|
290
303
|
@settings["build_drop_username"],
|
291
304
|
@settings["build_drop_password"])
|
292
|
-
if
|
305
|
+
if version == 'list'
|
293
306
|
# list build versions
|
294
307
|
branch_path = File.join(mount_node, @settings["build_drop_branch_dir"])
|
295
308
|
Dir.entries(branch_path).sort_by{|c| File.stat(File.join(branch_path,c)).ctime}.each do |d|
|
296
|
-
m = d.match(/^iPhone(\S+)$/)
|
309
|
+
m = d.match(/^(?:iPhone|iOSCorp)(\S+)$/)
|
297
310
|
if m != nil
|
298
311
|
puts m[1]
|
299
312
|
end
|
@@ -307,6 +320,9 @@ def get_build(version, sim)
|
|
307
320
|
else
|
308
321
|
# copy the version build
|
309
322
|
release_path = File.join(mount_node, @settings["build_drop_branch_dir"], "iPhone#{version}", "Instrumented", "ConcurMobile-cal", sim)
|
323
|
+
if not File.directory?(release_path)
|
324
|
+
release_path = File.join(mount_node, @settings["build_drop_branch_dir"], "iOSCorp#{version}", "Instrumented", "ConcurMobile-cal", sim)
|
325
|
+
end
|
310
326
|
end
|
311
327
|
raise "No builds found in #{release_path}" unless File.directory?(release_path)
|
312
328
|
build_dir = Dir.entries(release_path).reject{|d|d.start_with?('.')}.sort_by{|c| File.stat(File.join(release_path,c)).ctime}.last
|
@@ -691,6 +707,15 @@ elsif cmd == 'devices'
|
|
691
707
|
list_devices
|
692
708
|
exit 0
|
693
709
|
|
710
|
+
elsif cmd == 'device'
|
711
|
+
read_settings
|
712
|
+
option = ARGV.shift
|
713
|
+
if option == 'info'
|
714
|
+
udid = @settings["device_udid"].to_s
|
715
|
+
device_info(udid) if udid != ''
|
716
|
+
end
|
717
|
+
exit 0
|
718
|
+
|
694
719
|
elsif cmd == 'sim'
|
695
720
|
option = ARGV.shift
|
696
721
|
read_settings
|
data/calabash-cucumber.gemspec
CHANGED
@@ -16,15 +16,16 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = ["calabash-ios", "testautoi"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency( "cucumber" )
|
19
|
+
s.add_dependency( "cucumber", "~> 1.3.0" )
|
20
|
+
s.add_dependency( "calabash-common", "~> 0.0.1" )
|
20
21
|
s.add_dependency( "json" )
|
21
22
|
s.add_dependency( "CFPropertyList" )
|
22
23
|
s.add_dependency( "sim_launcher", "0.4.6")
|
23
24
|
s.add_dependency( "slowhandcuke" )
|
24
|
-
s.add_dependency( "location-one", "~>0.0.
|
25
|
-
s.add_dependency( "httpclient","2.3.
|
25
|
+
s.add_dependency( "location-one", "~>0.0.10")
|
26
|
+
s.add_dependency( "httpclient","~> 2.3.3")
|
26
27
|
s.add_dependency( "bundler", "~> 1.1")
|
27
|
-
s.add_dependency( "run_loop", "0.0.
|
28
|
+
s.add_dependency( "run_loop", "~> 0.0.11" )
|
28
29
|
s.add_dependency( "awesome_print")
|
29
30
|
|
30
31
|
end
|
@@ -42,5 +42,7 @@ end
|
|
42
42
|
|
43
43
|
at_exit do
|
44
44
|
launcher = Calabash::Cucumber::Launcher.new
|
45
|
-
|
45
|
+
if launcher.simulator_target?
|
46
|
+
Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
|
47
|
+
end
|
46
48
|
end
|
@@ -7,7 +7,10 @@ module Calabash
|
|
7
7
|
|
8
8
|
DATA_PATH = File.expand_path(File.dirname(__FILE__))
|
9
9
|
CAL_HTTP_RETRY_COUNT=3
|
10
|
-
RETRYABLE_ERRORS = [
|
10
|
+
RETRYABLE_ERRORS = [HTTPClient::TimeoutError,
|
11
|
+
HTTPClient::KeepAliveDisconnected,
|
12
|
+
Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED,
|
13
|
+
Errno::ETIMEDOUT]
|
11
14
|
|
12
15
|
def macro(txt)
|
13
16
|
if self.respond_to? :step
|
@@ -187,6 +190,31 @@ module Calabash
|
|
187
190
|
views_touched
|
188
191
|
end
|
189
192
|
|
193
|
+
|
194
|
+
def scroll_to_row_with_mark(row_id, options={:query => 'tableView',
|
195
|
+
:scroll_position => :middle,
|
196
|
+
:animate => true})
|
197
|
+
uiquery = options[:query] || 'tableView'
|
198
|
+
|
199
|
+
args = []
|
200
|
+
if options.has_key?(:scroll_position)
|
201
|
+
args << options[:scroll_position]
|
202
|
+
else
|
203
|
+
args << 'middle'
|
204
|
+
end
|
205
|
+
if options.has_key?(:animate)
|
206
|
+
args << options[:animate]
|
207
|
+
end
|
208
|
+
|
209
|
+
views_touched=map(uiquery, :scrollToRowWithMark, row_id, *args)
|
210
|
+
|
211
|
+
if views_touched.empty? or views_touched.member? '<VOID>'
|
212
|
+
msg = options[:failed_message] || "Unable to scroll: '#{uiquery}' to: #{options}"
|
213
|
+
screenshot_and_raise msg
|
214
|
+
end
|
215
|
+
views_touched
|
216
|
+
end
|
217
|
+
|
190
218
|
def pinch(in_out, options={})
|
191
219
|
file = "pinch_in"
|
192
220
|
if in_out.to_sym==:out
|
@@ -466,10 +494,11 @@ EOF
|
|
466
494
|
|
467
495
|
def calabash_exit
|
468
496
|
# Exiting the app shuts down the HTTP connection and generates ECONNREFUSED,
|
497
|
+
# or HTTPClient::KeepAliveDisconnected
|
469
498
|
# which needs to be suppressed.
|
470
499
|
begin
|
471
|
-
http({:method =>:post, :path => 'exit', :retryable_errors => RETRYABLE_ERRORS - [Errno::ECONNREFUSED]})
|
472
|
-
rescue Errno::ECONNREFUSED
|
500
|
+
http({:method =>:post, :path => 'exit', :retryable_errors => RETRYABLE_ERRORS - [Errno::ECONNREFUSED,HTTPClient::KeepAliveDisconnected]})
|
501
|
+
rescue Errno::ECONNREFUSED, HTTPClient::KeepAliveDisconnected
|
473
502
|
[]
|
474
503
|
end
|
475
504
|
end
|
@@ -548,6 +577,7 @@ EOF
|
|
548
577
|
end
|
549
578
|
|
550
579
|
def make_http_request(options)
|
580
|
+
|
551
581
|
body = nil
|
552
582
|
retryable_errors = options[:retryable_errors] || RETRYABLE_ERRORS
|
553
583
|
CAL_HTTP_RETRY_COUNT.times do |count|
|
@@ -561,29 +591,20 @@ EOF
|
|
561
591
|
body = @http.get(options[:uri], options[:body]).body
|
562
592
|
end
|
563
593
|
break
|
564
|
-
rescue
|
565
|
-
if count < CAL_HTTP_RETRY_COUNT-1
|
566
|
-
@http.reset_all
|
567
|
-
@http=nil
|
568
|
-
STDOUT.write "Waiting 5 secs before retry...\n"
|
569
|
-
sleep(5)
|
570
|
-
STDOUT.write "Retrying.. #{e.class}: (#{e})\n"
|
571
|
-
STDOUT.flush
|
594
|
+
rescue Exception => e
|
572
595
|
|
573
|
-
|
574
|
-
puts "Failing... #{e.class}"
|
575
|
-
raise e
|
576
|
-
end
|
596
|
+
if retryable_errors.include?(e) || retryable_errors.any?{|c| e.is_a?(c)}
|
577
597
|
|
578
|
-
rescue Exception => e
|
579
|
-
if retryable_errors.include?(e)
|
580
598
|
if count < CAL_HTTP_RETRY_COUNT-1
|
581
|
-
|
599
|
+
if e.is_a?(HTTPClient::TimeoutError)
|
600
|
+
sleep(3)
|
601
|
+
else
|
602
|
+
sleep(0.5)
|
603
|
+
end
|
582
604
|
@http.reset_all
|
583
605
|
@http=nil
|
584
606
|
STDOUT.write "Retrying.. #{e.class}: (#{e})\n"
|
585
607
|
STDOUT.flush
|
586
|
-
|
587
608
|
else
|
588
609
|
puts "Failing... #{e.class}"
|
589
610
|
raise e
|
@@ -226,10 +226,10 @@ module Calabash
|
|
226
226
|
end
|
227
227
|
end
|
228
228
|
rescue TimeoutErr => e
|
229
|
-
puts
|
229
|
+
puts 'Timed out...'
|
230
230
|
end
|
231
231
|
end
|
232
|
-
rescue e
|
232
|
+
rescue RuntimeError => e
|
233
233
|
p e
|
234
234
|
msg = "Unable to make connection to Calabash Server at #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}\n"
|
235
235
|
msg << "Make sure you've' linked correctly with calabash.framework and set Other Linker Flags.\n"
|
@@ -25,7 +25,7 @@ class Calabash::Cucumber::Launcher
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def device_target?
|
28
|
-
ENV['DEVICE_TARGET']
|
28
|
+
(ENV['DEVICE_TARGET'] != nil) && (not simulator_target?)
|
29
29
|
end
|
30
30
|
|
31
31
|
def simulator_target?
|
@@ -68,6 +68,10 @@ class Calabash::Cucumber::Launcher
|
|
68
68
|
|
69
69
|
if device_target?
|
70
70
|
default_args = {:app => ENV['BUNDLE_ID']}
|
71
|
+
target = ENV['DEVICE_TARGET']
|
72
|
+
if target != 'DEVICE'
|
73
|
+
default_args[:udid] = target
|
74
|
+
end
|
71
75
|
self.run_loop = RunLoop.run(default_args.merge(args))
|
72
76
|
else
|
73
77
|
|
@@ -119,7 +123,7 @@ class Calabash::Cucumber::Launcher
|
|
119
123
|
puts "Timed out...Retry.."
|
120
124
|
end
|
121
125
|
end
|
122
|
-
rescue e
|
126
|
+
rescue RuntimeError => e
|
123
127
|
p e
|
124
128
|
msg = "Unable to make connection to Calabash Server at #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}\n"
|
125
129
|
msg << "Make sure you don't have a firewall blocking traffic to #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}.\n"
|
@@ -132,7 +136,7 @@ class Calabash::Cucumber::Launcher
|
|
132
136
|
|
133
137
|
http = Net::HTTP.new(url.host, url.port)
|
134
138
|
res = http.start do |sess|
|
135
|
-
sess.request Net::HTTP::Get.new "version"
|
139
|
+
sess.request Net::HTTP::Get.new(ENV['CALABASH_VERSION_PATH'] || "version")
|
136
140
|
end
|
137
141
|
status = res.code
|
138
142
|
begin
|
data/scripts/launch.rb
CHANGED
@@ -22,6 +22,7 @@ require 'calabash-cucumber/launcher'
|
|
22
22
|
# However the recommended approach is to let Calabash find the app itself
|
23
23
|
# or set the environment variable APP_BUNDLE_PATH
|
24
24
|
|
25
|
+
|
25
26
|
Before do |scenario|
|
26
27
|
@calabash_launcher = Calabash::Cucumber::Launcher.new
|
27
28
|
unless @calabash_launcher.calabash_no_launch?
|
@@ -37,4 +38,11 @@ After do |scenario|
|
|
37
38
|
@calabash_launcher.stop
|
38
39
|
end
|
39
40
|
end
|
40
|
-
end
|
41
|
+
end
|
42
|
+
|
43
|
+
at_exit do
|
44
|
+
launcher = Calabash::Cucumber::Launcher.new
|
45
|
+
if launcher.simulator_target?
|
46
|
+
Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
|
47
|
+
end
|
48
|
+
end
|
data/testautoi.gemspecx
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "calabash-cucumber/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "testautoi"
|
7
|
+
s.version = Calabash::Cucumber::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["jimtsay"]
|
10
|
+
s.summary = %q{Summary}
|
11
|
+
s.description = %q{Description}
|
12
|
+
s.files = `git ls-files`.split("\n").concat(["staticlib/calabash.framework.zip"])
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = ["calabash-ios", "testautoi"]
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_dependency( "cucumber", "~> 1.3.0" )
|
18
|
+
s.add_dependency( "calabash-common", "~> 0.0.1" )
|
19
|
+
s.add_dependency( "json" )
|
20
|
+
s.add_dependency( "CFPropertyList" )
|
21
|
+
s.add_dependency( "sim_launcher", "0.4.6")
|
22
|
+
s.add_dependency( "slowhandcuke" )
|
23
|
+
s.add_dependency( "location-one", "~>0.0.10")
|
24
|
+
s.add_dependency( "httpclient","~> 2.3.3")
|
25
|
+
s.add_dependency( "bundler", "~> 1.1")
|
26
|
+
s.add_dependency( "run_loop", "~> 0.0.11" )
|
27
|
+
s.add_dependency( "awesome_print")
|
28
|
+
s.add_dependency( "rest-client" )
|
29
|
+
s.add_dependency( "nokogiri" )
|
30
|
+
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testautoi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.144
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,40 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.3.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: calabash-common
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.0.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.0.1
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: json
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +114,7 @@ dependencies:
|
|
98
114
|
requirements:
|
99
115
|
- - ~>
|
100
116
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.0.
|
117
|
+
version: 0.0.10
|
102
118
|
type: :runtime
|
103
119
|
prerelease: false
|
104
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,23 +122,23 @@ dependencies:
|
|
106
122
|
requirements:
|
107
123
|
- - ~>
|
108
124
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.0.
|
125
|
+
version: 0.0.10
|
110
126
|
- !ruby/object:Gem::Dependency
|
111
127
|
name: httpclient
|
112
128
|
requirement: !ruby/object:Gem::Requirement
|
113
129
|
none: false
|
114
130
|
requirements:
|
115
|
-
- -
|
131
|
+
- - ~>
|
116
132
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2.3.
|
133
|
+
version: 2.3.3
|
118
134
|
type: :runtime
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
121
137
|
none: false
|
122
138
|
requirements:
|
123
|
-
- -
|
139
|
+
- - ~>
|
124
140
|
- !ruby/object:Gem::Version
|
125
|
-
version: 2.3.
|
141
|
+
version: 2.3.3
|
126
142
|
- !ruby/object:Gem::Dependency
|
127
143
|
name: bundler
|
128
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,17 +160,17 @@ dependencies:
|
|
144
160
|
requirement: !ruby/object:Gem::Requirement
|
145
161
|
none: false
|
146
162
|
requirements:
|
147
|
-
- -
|
163
|
+
- - ~>
|
148
164
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.0.
|
165
|
+
version: 0.0.11
|
150
166
|
type: :runtime
|
151
167
|
prerelease: false
|
152
168
|
version_requirements: !ruby/object:Gem::Requirement
|
153
169
|
none: false
|
154
170
|
requirements:
|
155
|
-
- -
|
171
|
+
- - ~>
|
156
172
|
- !ruby/object:Gem::Version
|
157
|
-
version: 0.0.
|
173
|
+
version: 0.0.11
|
158
174
|
- !ruby/object:Gem::Dependency
|
159
175
|
name: awesome_print
|
160
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,6 +203,22 @@ dependencies:
|
|
187
203
|
- - ! '>='
|
188
204
|
- !ruby/object:Gem::Version
|
189
205
|
version: '0'
|
206
|
+
- !ruby/object:Gem::Dependency
|
207
|
+
name: nokogiri
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ! '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :runtime
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
190
222
|
description: Description
|
191
223
|
email:
|
192
224
|
executables:
|
@@ -322,6 +354,7 @@ files:
|
|
322
354
|
- scripts/data/com.apple.Accessibility.plist
|
323
355
|
- scripts/launch.rb
|
324
356
|
- scripts/reset_simulator.scpt
|
357
|
+
- testautoi.gemspecx
|
325
358
|
- staticlib/calabash.framework.zip
|
326
359
|
homepage:
|
327
360
|
licenses: []
|