calabash-cucumber 0.9.132 → 0.9.133
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.
- data/.gitignore +3 -1
- data/bin/calabash-ios +1 -0
- data/bin/calabash-ios-setup.rb +15 -56
- data/calabash-cucumber.gemspec +1 -1
- data/lib/calabash-cucumber/core.rb +34 -7
- data/lib/calabash-cucumber/version.rb +2 -2
- data/lib/calabash-cucumber/wait_helpers.rb +3 -1
- data/scripts/.irbrc +1 -1
- metadata +4 -2
data/.gitignore
CHANGED
data/bin/calabash-ios
CHANGED
@@ -15,6 +15,7 @@ require File.join(File.dirname(__FILE__),"calabash-ios-build")
|
|
15
15
|
@features_dir = File.join(FileUtils.pwd, "features")
|
16
16
|
@source_dir = File.join(File.dirname(__FILE__), '..', 'features-skeleton')
|
17
17
|
@script_dir = File.join(File.dirname(__FILE__), '..', 'scripts')
|
18
|
+
@framework_dir = File.join(File.dirname(__FILE__), '..', 'staticlib')
|
18
19
|
|
19
20
|
if (ARGV.length == 0)
|
20
21
|
print_usage
|
data/bin/calabash-ios-setup.rb
CHANGED
@@ -94,47 +94,9 @@ def download_calabash(project_path)
|
|
94
94
|
##Download calabash.framework
|
95
95
|
if not File.directory?(File.join(project_path, file))
|
96
96
|
msg("Info") do
|
97
|
-
zip_file = "calabash.framework
|
98
|
-
|
99
|
-
|
100
|
-
require 'uri'
|
101
|
-
|
102
|
-
uri = URI.parse "http://cloud.github.com/downloads/calabash/calabash-ios/#{zip_file}"
|
103
|
-
success = false
|
104
|
-
if has_proxy?
|
105
|
-
proxy_url = proxy
|
106
|
-
connection = Net::HTTP::Proxy(proxy_url[0], proxy_url[1])
|
107
|
-
else
|
108
|
-
connection = Net::HTTP
|
109
|
-
end
|
110
|
-
begin
|
111
|
-
connection.start(uri.host, uri.port) do |http|
|
112
|
-
request = Net::HTTP::Get.new uri.request_uri
|
113
|
-
|
114
|
-
http.request request do |response|
|
115
|
-
if response.code == '200'
|
116
|
-
open zip_file, 'wb' do |io|
|
117
|
-
response.read_body do |chunk|
|
118
|
-
print "."
|
119
|
-
io.write chunk
|
120
|
-
end
|
121
|
-
end
|
122
|
-
success = true
|
123
|
-
else
|
124
|
-
puts "Got bad response code #{response.code}."
|
125
|
-
puts "Aborting..."
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
rescue SocketError => e
|
130
|
-
msg("Error") do
|
131
|
-
puts "Exception: #{e}"
|
132
|
-
puts "Unable to download Calabash. Please check connection."
|
133
|
-
end
|
134
|
-
exit 1
|
135
|
-
end
|
136
|
-
if success
|
137
|
-
puts "\nDownload done: #{file}. Unzipping..."
|
97
|
+
zip_file = File.join(@framework_dir,"calabash.framework.zip")
|
98
|
+
|
99
|
+
if File.exist?(zip_file)
|
138
100
|
if not system("unzip -C -K -o -q -d #{project_path} #{zip_file} -x __MACOSX/* calabash.framework/.DS_Store")
|
139
101
|
msg("Error") do
|
140
102
|
puts "Unable to unzip file: #{zip_file}"
|
@@ -142,8 +104,8 @@ def download_calabash(project_path)
|
|
142
104
|
end
|
143
105
|
exit 1
|
144
106
|
end
|
145
|
-
FileUtils.rm(zip_file)
|
146
107
|
else
|
108
|
+
puts "Inconsistent gem state: Cannot find framework: #{zip_file}"
|
147
109
|
exit 0
|
148
110
|
end
|
149
111
|
end
|
@@ -174,28 +136,25 @@ def setup_project(project_name, project_path, path)
|
|
174
136
|
exit 1
|
175
137
|
end
|
176
138
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
139
|
+
FileUtils.cd project_path do
|
140
|
+
##Backup
|
141
|
+
if File.exists? "#{proj_file}.bak"
|
142
|
+
msg("Error") do
|
143
|
+
puts "Backup file already exists. #{proj_file}.bak"
|
144
|
+
puts "For safety, I won't overwrite this file."
|
145
|
+
puts "You must manually move this file, if you want to"
|
146
|
+
puts "Run calabash-ios setup again."
|
147
|
+
end
|
148
|
+
exit 1
|
186
149
|
end
|
187
|
-
exit 1
|
188
150
|
end
|
189
151
|
|
190
|
-
|
152
|
+
download_calabash(project_path)
|
191
153
|
|
192
154
|
msg("Info") do
|
193
155
|
puts "Setting up project file for calabash-ios."
|
194
156
|
end
|
195
157
|
|
196
|
-
|
197
|
-
FileUtils.cd pwd
|
198
|
-
|
199
158
|
##Backup
|
200
159
|
msg("Info") do
|
201
160
|
puts "Making backup of project file: #{proj_file}"
|
data/calabash-cucumber.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = "http://calaba.sh"
|
12
12
|
s.summary = %q{Client for calabash-ios-server for automated functional testing on iOS}
|
13
13
|
s.description = %q{calabash-cucumber drives tests for native iOS apps. You must link your app with calabash-ios-server framework to execute tests.}
|
14
|
-
s.files = `git ls-files`.split("\n")
|
14
|
+
s.files = `git ls-files`.split("\n").concat(["staticlib/calabash.framework.zip"])
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
s.executables = "calabash-ios"
|
17
17
|
s.require_paths = ["lib"]
|
@@ -45,14 +45,42 @@ module Calabash
|
|
45
45
|
args = args[0]
|
46
46
|
end
|
47
47
|
end
|
48
|
-
map(q, :
|
48
|
+
map(q, :query, *args)
|
49
49
|
end
|
50
50
|
|
51
51
|
def query_all(uiquery, *args)
|
52
|
-
|
52
|
+
puts "query_all is deprecated. Use the new all/visible feature."
|
53
|
+
puts "see: https://github.com/calabash/calabash-ios/wiki/05-Query-syntax"
|
54
|
+
map("all #{uiquery}", :query, *args)
|
53
55
|
end
|
54
56
|
|
55
57
|
def touch(uiquery, options={})
|
58
|
+
if (uiquery.is_a?(Array))
|
59
|
+
raise "No elements to touch in array" if uiquery.empty?
|
60
|
+
uiquery = uiquery.first
|
61
|
+
end
|
62
|
+
if (uiquery.is_a?(Hash))
|
63
|
+
offset_x = 0
|
64
|
+
offset_y = 0
|
65
|
+
if options[:offset]
|
66
|
+
offset_x += options[:offset][:x] || 0
|
67
|
+
offset_y += options[:offset][:y] || 0
|
68
|
+
end
|
69
|
+
x = offset_x
|
70
|
+
y = offset_y
|
71
|
+
rect = uiquery["rect"] || uiquery[:rect]
|
72
|
+
if rect
|
73
|
+
x += rect['center_x'] || rect[:center_x] || rect[:x] || 0
|
74
|
+
y += rect['center_y'] || rect[:center_y] || rect[:y] || 0
|
75
|
+
else
|
76
|
+
x += uiquery['center_x'] || uiquery[:center_x] || uiquery[:x] || 0
|
77
|
+
y += uiquery['center_y'] || uiquery[:center_y] || uiquery[:y] || 0
|
78
|
+
end
|
79
|
+
|
80
|
+
options[:offset] = {:x => x, :y => y}
|
81
|
+
return touch(nil, options)
|
82
|
+
end
|
83
|
+
|
56
84
|
options[:query] = uiquery
|
57
85
|
views_touched = playback("touch", options)
|
58
86
|
unless uiquery.nil?
|
@@ -278,7 +306,7 @@ module Calabash
|
|
278
306
|
end
|
279
307
|
|
280
308
|
|
281
|
-
def load_recording(recording,rec_dir)
|
309
|
+
def load_recording(recording, rec_dir)
|
282
310
|
data = nil
|
283
311
|
if (File.exists?(recording))
|
284
312
|
data = File.read(recording)
|
@@ -315,13 +343,13 @@ EOF
|
|
315
343
|
rec_dir = ENV['PLAYBACK_DIR'] || "#{Dir.pwd}/playback"
|
316
344
|
|
317
345
|
recording = recording_name_for(recording_name, os, device)
|
318
|
-
data = load_recording(recording,rec_dir)
|
346
|
+
data = load_recording(recording, rec_dir)
|
319
347
|
|
320
348
|
if data.nil? and os=="ios6"
|
321
349
|
recording = recording_name_for(recording_name, "ios5", device)
|
322
350
|
end
|
323
351
|
|
324
|
-
data = load_recording(recording,rec_dir)
|
352
|
+
data = load_recording(recording, rec_dir)
|
325
353
|
|
326
354
|
if data.nil?
|
327
355
|
screenshot_and_raise "Playback not found: #{recording} (searched for #{recording} in #{Dir.pwd}, #{rec_dir}, #{DATA_PATH}/resources"
|
@@ -450,7 +478,7 @@ EOF
|
|
450
478
|
end
|
451
479
|
app_bundle_path = Calabash::Cucumber::SimulatorHelper.app_bundle_or_raise(path)
|
452
480
|
|
453
|
-
@ios_device
|
481
|
+
@ios_device = RunLoop.run(:app => app_bundle_path)
|
454
482
|
end
|
455
483
|
|
456
484
|
def send_uia_command(opts ={})
|
@@ -464,7 +492,6 @@ EOF
|
|
464
492
|
end
|
465
493
|
|
466
494
|
|
467
|
-
|
468
495
|
def http(options, data=nil)
|
469
496
|
options[:uri] = url_for(options[:path])
|
470
497
|
options[:method] = options[:method] || :get
|
@@ -32,7 +32,9 @@ module Calabash
|
|
32
32
|
retry_frequency = options_or_timeout[:retry_frequency] || 0.2
|
33
33
|
post_timeout = options_or_timeout[:post_timeout] || 0.1
|
34
34
|
timeout_message = options_or_timeout[:timeout_message]
|
35
|
-
|
35
|
+
if options_or_timeout.key?(:screenshot_on_error)
|
36
|
+
screenshot_on_error = options_or_timeout[:screenshot_on_error]
|
37
|
+
end
|
36
38
|
end
|
37
39
|
|
38
40
|
begin
|
data/scripts/.irbrc
CHANGED
@@ -18,7 +18,7 @@ require 'calabash-cucumber/operations'
|
|
18
18
|
require 'calabash-cucumber/launch/simulator_helper'
|
19
19
|
SIM=Calabash::Cucumber::SimulatorHelper
|
20
20
|
|
21
|
-
|
21
|
+
extend Calabash::Cucumber::Operations
|
22
22
|
|
23
23
|
def embed(x,y=nil,z=nil)
|
24
24
|
puts "Screenshot at #{x}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.133
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -298,6 +298,7 @@ files:
|
|
298
298
|
- scripts/data/clients.plist
|
299
299
|
- scripts/data/com.apple.Accessibility.plist
|
300
300
|
- scripts/reset_simulator.scpt
|
301
|
+
- staticlib/calabash.framework.zip
|
301
302
|
homepage: http://calaba.sh
|
302
303
|
licenses: []
|
303
304
|
post_install_message:
|
@@ -324,3 +325,4 @@ specification_version: 3
|
|
324
325
|
summary: Client for calabash-ios-server for automated functional testing on iOS
|
325
326
|
test_files:
|
326
327
|
- features/step_definitions/calabash_steps.rb
|
328
|
+
has_rdoc:
|