calabash-cucumber 0.9.17 → 0.9.19
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/Gemfile +1 -1
- data/Gemfile.lock +28 -15
- data/bin/calabash-ios +52 -0
- data/bin/calabash-ios-generate.rb +26 -0
- data/bin/calabash-ios-helpers.rb +62 -0
- data/bin/calabash-ios-setup.rb +328 -0
- data/bin/calabash-ios-sim.rb +88 -0
- data/bin/iphonesim +0 -0
- data/calabash-cucumber.gemspec +5 -2
- data/doc/calabash-ios-help.txt +45 -0
- data/features-skeleton/support/launch.rb +55 -0
- data/lib/calabash-cucumber/calabash_helper.rb +13 -0
- data/lib/calabash-cucumber/calabash_steps.rb +2 -2
- data/lib/calabash-cucumber/launch/simulator_helper.rb +167 -0
- data/lib/calabash-cucumber/version.rb +1 -1
- data/scripts/data/.GlobalPreferences.plist +0 -0
- data/scripts/data/com.apple.Accessibility.plist +0 -0
- data/scripts/reset_simulator.scpt +0 -0
- metadata +52 -18
- data/bin/calabash +0 -76
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,36 +1,49 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
calabash-cucumber (0.9.
|
4
|
+
calabash-cucumber (0.9.18)
|
5
|
+
CFPropertyList
|
5
6
|
cucumber
|
6
7
|
json
|
7
8
|
net-http-persistent
|
8
|
-
|
9
|
+
pbxproject
|
10
|
+
sim_launcher
|
11
|
+
slowhandcuke
|
9
12
|
|
10
13
|
GEM
|
11
14
|
remote: http://rubygems.org/
|
12
15
|
specs:
|
16
|
+
CFPropertyList (2.0.17)
|
17
|
+
libxml-ruby (>= 1.1.0)
|
18
|
+
rake (>= 0.7.0)
|
13
19
|
builder (3.0.0)
|
14
|
-
cucumber (1.1.
|
20
|
+
cucumber (1.1.9)
|
15
21
|
builder (>= 2.1.2)
|
16
22
|
diff-lcs (>= 1.1.2)
|
17
|
-
gherkin (~> 2.
|
23
|
+
gherkin (~> 2.9.0)
|
18
24
|
json (>= 1.4.6)
|
19
25
|
term-ansicolor (>= 1.0.6)
|
20
26
|
diff-lcs (1.1.3)
|
21
|
-
gherkin (2.
|
27
|
+
gherkin (2.9.0)
|
22
28
|
json (>= 1.4.6)
|
23
|
-
json (1.6.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
json (1.6.5)
|
30
|
+
libxml-ruby (2.2.2)
|
31
|
+
net-http-persistent (2.5.2)
|
32
|
+
pbxproject (0.2.4)
|
33
|
+
rack (1.4.1)
|
34
|
+
rack-protection (1.2.0)
|
35
|
+
rack
|
36
|
+
rake (0.9.2.2)
|
37
|
+
sim_launcher (0.3.7)
|
38
|
+
sinatra
|
39
|
+
sinatra (1.3.2)
|
40
|
+
rack (~> 1.3, >= 1.3.6)
|
41
|
+
rack-protection (~> 1.2)
|
42
|
+
tilt (~> 1.3, >= 1.3.3)
|
43
|
+
slowhandcuke (0.0.3)
|
44
|
+
cucumber
|
33
45
|
term-ansicolor (1.0.7)
|
46
|
+
tilt (1.3.3)
|
34
47
|
|
35
48
|
PLATFORMS
|
36
49
|
ruby
|
data/bin/calabash-ios
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'CFPropertyList'
|
5
|
+
require 'rexml/document'
|
6
|
+
require 'pbxproject'
|
7
|
+
require File.join(File.dirname(__FILE__),"calabash-ios-helpers")
|
8
|
+
require File.join(File.dirname(__FILE__),"calabash-ios-generate")
|
9
|
+
require File.join(File.dirname(__FILE__),"calabash-ios-setup")
|
10
|
+
require File.join(File.dirname(__FILE__),"calabash-ios-sim")
|
11
|
+
|
12
|
+
@features_dir = File.join(FileUtils.pwd, "features")
|
13
|
+
@source_dir = File.join(File.dirname(__FILE__), '..', 'features-skeleton')
|
14
|
+
@iphonesim = File.absolute_path(File.join(File.dirname(__FILE__), 'iphonesim'))
|
15
|
+
@script_dir = File.join(File.dirname(__FILE__), '..', 'scripts')
|
16
|
+
|
17
|
+
if (ARGV.length == 0)
|
18
|
+
print_usage
|
19
|
+
exit 0
|
20
|
+
end
|
21
|
+
cmd = ARGV.shift
|
22
|
+
if cmd == 'help'
|
23
|
+
print_help
|
24
|
+
exit 0
|
25
|
+
elsif cmd == 'gen'
|
26
|
+
calabash_scaffold
|
27
|
+
elsif cmd == 'setup'
|
28
|
+
calabash_setup(ARGV)
|
29
|
+
exit 0
|
30
|
+
elsif cmd == 'sim'
|
31
|
+
if ARGV.length == 0
|
32
|
+
print_usage
|
33
|
+
exit 0
|
34
|
+
end
|
35
|
+
subcmd = ARGV.shift
|
36
|
+
|
37
|
+
if subcmd == 'reset'
|
38
|
+
calabash_sim_reset
|
39
|
+
elsif subcmd == 'acc'
|
40
|
+
calabash_sim_accessibility
|
41
|
+
elsif subcmd == 'locale'
|
42
|
+
calabash_sim_locale(ARGV)
|
43
|
+
elsif subcmd == 'device'
|
44
|
+
calabash_sim_device(ARGV)
|
45
|
+
else
|
46
|
+
print_usage
|
47
|
+
end
|
48
|
+
else
|
49
|
+
print_usage
|
50
|
+
end
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
def calabash_scaffold
|
3
|
+
if File.exists?(@features_dir)
|
4
|
+
puts "A features directory already exists. Stopping..."
|
5
|
+
#puts "Run calabash-ios update for update instructions."
|
6
|
+
exit 1
|
7
|
+
end
|
8
|
+
msg("Question") do
|
9
|
+
puts "I'm about to create a subdirectory called features."
|
10
|
+
puts "features will contain all your calabash tests."
|
11
|
+
puts "Please hit return to confirm that's what you want."
|
12
|
+
end
|
13
|
+
exit 2 unless STDIN.gets.chomp == ''
|
14
|
+
|
15
|
+
FileUtils.cp_r(@source_dir, @features_dir)
|
16
|
+
FileUtils.mv "#{@features_dir}/.irbrc", "."
|
17
|
+
FileUtils.mv "#{@features_dir}/irb_ios4.sh", "."
|
18
|
+
FileUtils.mv "#{@features_dir}/irb_ios5.sh", "."
|
19
|
+
|
20
|
+
msg("Info") do
|
21
|
+
puts "features subdirectory created. \n"
|
22
|
+
puts "Try executing \n\nDEVICE=iphone OS=ios5 cucumber"
|
23
|
+
puts "\n (replace ios5 with ios4 if running iOS 4.x simulator.\nReplace iphone with ipad if running iPad simulator.).\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
def msg(title, &block)
|
2
|
+
puts "\n" + "-"*10 + title + "-"*10
|
3
|
+
block.call
|
4
|
+
puts "-"*10 + "-------" + "-"*10 + "\n"
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
def print_usage
|
9
|
+
puts <<EOF
|
10
|
+
Usage: calabash-ios <command-name> [parameters]
|
11
|
+
<command-name> can be one of
|
12
|
+
help
|
13
|
+
prints more detailed help information.
|
14
|
+
gen
|
15
|
+
generate a features folder structure.
|
16
|
+
setup (EXPERIMENTAL)
|
17
|
+
setup your XCode project for calabash-ios)
|
18
|
+
sim locale [lang] [regional]?
|
19
|
+
change locale and regional settings in all iOS Simulators
|
20
|
+
sim reset
|
21
|
+
reset content and settings in all iOS Simulators
|
22
|
+
sim acc
|
23
|
+
enable accessibility in all iOS Simulators
|
24
|
+
sim device [iPad, iPhone, iPhone_Retina]
|
25
|
+
change the default iOS Simulator device.
|
26
|
+
EOF
|
27
|
+
end
|
28
|
+
def print_help
|
29
|
+
file = File.join(File.dirname(__FILE__), '..', 'doc', 'calabash-ios-help.txt')
|
30
|
+
system("less #{file}")
|
31
|
+
end
|
32
|
+
|
33
|
+
def ensure_correct_path(args)
|
34
|
+
dir_to_search = nil
|
35
|
+
if args.length == 1
|
36
|
+
dir_to_search = args[0]
|
37
|
+
if not Dir.exists?(dir_to_search)
|
38
|
+
puts "Path: #{dir_to_search} is not a directory."
|
39
|
+
puts "It should be your project directory (i.e., the one containing your <projectname.xcodeproject>)."
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
else
|
43
|
+
dir_to_search = "."
|
44
|
+
end
|
45
|
+
|
46
|
+
project_files = Dir.foreach(dir_to_search).find_all { |x| /\.xcodeproj$/.match(x) }
|
47
|
+
if project_files.empty?
|
48
|
+
puts "Found no *.xcodeproj files in dir #{dir_to_search}."
|
49
|
+
puts "Please run calabash-ios setup <project path>"
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
if project_files.count > 1
|
53
|
+
puts "Found several *.xcodeproj files in dir #{dir_to_search}."
|
54
|
+
puts "Found: #{project_files.join("\n")}"
|
55
|
+
puts "We don't yet support this. Please setup calabash manually."
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
return dir_to_search,project_files
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
####
|
@@ -0,0 +1,328 @@
|
|
1
|
+
def dup_scheme(project_name, pbx_dir)
|
2
|
+
|
3
|
+
userdata_dirs = Dir.foreach("#{pbx_dir}/xcuserdata").find_all { |x|
|
4
|
+
/\.xcuserdatad$/.match(x)
|
5
|
+
}
|
6
|
+
|
7
|
+
userdata_dirs.each do |userdata_dir|
|
8
|
+
scheme_to_find = Regexp.new(Regexp.escape("#{project_name}.xcscheme"))
|
9
|
+
cal_scheme_to_find = Regexp.new(Regexp.escape("#{project_name}-cal.xcscheme"))
|
10
|
+
schemes = Dir.foreach("#{pbx_dir}/xcuserdata/#{userdata_dir}/xcschemes")
|
11
|
+
scheme = schemes.find do |scheme|
|
12
|
+
scheme_to_find.match(scheme)
|
13
|
+
end
|
14
|
+
cal_scheme = schemes.find do |scheme|
|
15
|
+
cal_scheme_to_find.match(scheme)
|
16
|
+
end
|
17
|
+
|
18
|
+
if scheme.nil?
|
19
|
+
puts "-"*10 + "Warning" + "-"*10
|
20
|
+
puts "Unable to find scheme: #{project_name}.xcscheme."
|
21
|
+
puts "You must manually create a scheme."
|
22
|
+
puts "Make sure your scheme uses the Calabash build configuration."
|
23
|
+
puts "-"*10 + "-------" + "-"*10
|
24
|
+
else
|
25
|
+
if not cal_scheme.nil?
|
26
|
+
msg("Warning") do
|
27
|
+
puts "Scheme: #{project_name}-cal.xcscheme already exists."
|
28
|
+
puts "Will not try to duplicate #{project_name}.xcscheme."
|
29
|
+
end
|
30
|
+
else
|
31
|
+
msg("Action") do
|
32
|
+
puts "Duplicating scheme #{project_name}.xcscheme as #{project_name}-cal.xcscheme"
|
33
|
+
|
34
|
+
doc = REXML::Document.new(File.new("#{pbx_dir}/xcuserdata/#{userdata_dir}/xcschemes/#{scheme}"))
|
35
|
+
doc.elements.each("Scheme/LaunchAction") do |la|
|
36
|
+
la.attributes["buildConfiguration"] = "Calabash"
|
37
|
+
end
|
38
|
+
doc.write(File.open("#{pbx_dir}/xcuserdata/#{userdata_dir}/xcschemes/#{project_name}-cal.xcscheme", "w"))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def calabash_setup(args)
|
48
|
+
puts "Checking if Xcode is running..."
|
49
|
+
res = `ps x -o pid,command | grep -v grep | grep Xcode.app/Contents/MacOS/Xcode`
|
50
|
+
if res==""
|
51
|
+
puts "Xcode not running."
|
52
|
+
project_name, project_path, xpath = find_project_files(args)
|
53
|
+
setup_project(project_name, project_path, xpath)
|
54
|
+
dup_scheme(project_name, xpath)
|
55
|
+
msg("Setup done") do
|
56
|
+
|
57
|
+
puts "Please validate by running the #{project_name}-cal scheme"
|
58
|
+
puts "from Xcode."
|
59
|
+
puts "When starting the iOS Simulator using the"
|
60
|
+
puts "new scheme: #{project_name}-cal, you should see:\n"
|
61
|
+
puts ' "Started LPHTTP server on port 37265"'
|
62
|
+
puts "\nin the application log in Xcode."
|
63
|
+
puts "\n\n"
|
64
|
+
puts "After validating, you can generate a features folder:"
|
65
|
+
puts "Go to your project (the dir containing the .xcodeproj file)."
|
66
|
+
puts "Then run calabash-ios gen"
|
67
|
+
puts "(if you don't already have a features folder)."
|
68
|
+
end
|
69
|
+
|
70
|
+
else
|
71
|
+
puts "Xcode is running. We'll be changing the project file so we'd better stop it."
|
72
|
+
puts "Shall I stop Xcode? Please answer yes (y) or no (n)"
|
73
|
+
answer = STDIN.gets.chomp
|
74
|
+
if (answer == 'yes' or answer == 'y')
|
75
|
+
res.split("\n").each do |line|
|
76
|
+
pid = line.split(" ")[0]
|
77
|
+
if system("kill #{pid}")
|
78
|
+
puts "Stopped XCode. Retrying... "
|
79
|
+
calabash_setup(args)
|
80
|
+
else
|
81
|
+
puts "Killing Xcode seemed to fail :( Aborting..."
|
82
|
+
end
|
83
|
+
end
|
84
|
+
else
|
85
|
+
puts "Please stop Xcode and try again."
|
86
|
+
exit(0)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def find_project_files(args)
|
92
|
+
dir_to_search, project_files = ensure_correct_path(args)
|
93
|
+
|
94
|
+
xc_project_file = project_files[0]
|
95
|
+
project_name = xc_project_file.split(".xcodeproj")[0]
|
96
|
+
puts "Found Project: #{project_name}"
|
97
|
+
pbx_dir = "#{dir_to_search}/#{xc_project_file}"
|
98
|
+
pbx_files = Dir.foreach(pbx_dir).find_all { |x| /\.pbxproj$/.match(x) }
|
99
|
+
if pbx_files.empty?
|
100
|
+
puts "Found no *.pbxproj files in dir #{xc_project_file}."
|
101
|
+
puts "Please setup calabash manually."
|
102
|
+
exit 1
|
103
|
+
elsif pbx_files.count > 1
|
104
|
+
puts "Found several *.pbxproj files in dir #{xc_project_file}."
|
105
|
+
puts "Found: #{pbx_files.join("\n")}"
|
106
|
+
puts "We don't yet support this. Please setup calabash manually."
|
107
|
+
exit 1
|
108
|
+
end
|
109
|
+
|
110
|
+
return project_name, dir_to_search, File.expand_path("#{dir_to_search}/#{xc_project_file}")
|
111
|
+
end
|
112
|
+
|
113
|
+
def setup_project(project_name, project_path, path)
|
114
|
+
##Ensure exists and parse
|
115
|
+
proj_file = "#{path}/project.pbxproj"
|
116
|
+
if not File.exists?(proj_file)
|
117
|
+
msg("Error") do
|
118
|
+
puts "Directory #{path} doesn't contain #{proj_file}"
|
119
|
+
end
|
120
|
+
exit 1
|
121
|
+
end
|
122
|
+
pbx = PBXProject::PBXProject.new(:file => proj_file)
|
123
|
+
pbx.parse
|
124
|
+
|
125
|
+
pwd = FileUtils.pwd
|
126
|
+
FileUtils.cd project_path
|
127
|
+
##Backup
|
128
|
+
msg("Info") do
|
129
|
+
puts "Making backup of project file: #{proj_file}.bak"
|
130
|
+
if File.exists? "#{proj_file}.bak"
|
131
|
+
msg("Error") do
|
132
|
+
puts "Backup file already exists. #{proj_file}.bak"
|
133
|
+
puts "For safety, I won't overwrite this file."
|
134
|
+
puts "You must manually move this file, if you want to"
|
135
|
+
puts "Run calabash-ios setup again."
|
136
|
+
end
|
137
|
+
exit 1
|
138
|
+
end
|
139
|
+
FileUtils.cp(proj_file, "#{proj_file}.bak")
|
140
|
+
end
|
141
|
+
file = 'calabash.framework'
|
142
|
+
##Download calabash.framework
|
143
|
+
if not Dir.exists?(File.join(project_path, file))
|
144
|
+
msg("Info") do
|
145
|
+
zip_file = 'calabash.framework-0.9.15.zip'
|
146
|
+
puts "Did not find calabash.framework. I'll download the latest version...'"
|
147
|
+
puts "https://raw.github.com/calabash/calabash-ios/master/frameworks/#{zip_file}"
|
148
|
+
require 'uri'
|
149
|
+
require 'net/https'
|
150
|
+
|
151
|
+
uri = URI.parse "https://raw.github.com/calabash/calabash-ios/master/frameworks/#{zip_file}"
|
152
|
+
|
153
|
+
Net::HTTP.start(uri.host, uri.port,
|
154
|
+
:use_ssl => uri.scheme == 'https') do |http|
|
155
|
+
request = Net::HTTP::Get.new uri.request_uri
|
156
|
+
|
157
|
+
http.request request do |response|
|
158
|
+
open zip_file, 'wb' do |io|
|
159
|
+
response.read_body do |chunk|
|
160
|
+
print "."
|
161
|
+
io.write chunk
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
puts "\nDownload done: #{file}. Unzipping..."
|
167
|
+
if not system("unzip -C -K -o -q -d #{project_path} #{zip_file}")
|
168
|
+
msg("Error") do
|
169
|
+
puts "Unable to unzip file: #{zip_file}"
|
170
|
+
puts "You must install manually."
|
171
|
+
end
|
172
|
+
exit 1
|
173
|
+
end
|
174
|
+
FileUtils.rm(zip_file)
|
175
|
+
end
|
176
|
+
|
177
|
+
else
|
178
|
+
puts "Found calabash.framework. Will not download."
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
file_ref = pbx.sections['PBXFileReference'].find do |fr|
|
183
|
+
/calabash\.framework/.match(fr.path)
|
184
|
+
end
|
185
|
+
|
186
|
+
if file_ref
|
187
|
+
msg("Error") do
|
188
|
+
puts "Your project already contains a file reference to calabash.framework."
|
189
|
+
puts "I was not expecting this. Aborting."
|
190
|
+
end
|
191
|
+
exit 1
|
192
|
+
end
|
193
|
+
|
194
|
+
msg("Info") do
|
195
|
+
puts "Setting up project file for calabash-ios."
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
## Augment
|
200
|
+
f = PBXProject::PBXTypes::PBXFileReference.new(:path => file, :lastKnownFileType => "wrapper.framework", :sourceTree => '"<group>"')
|
201
|
+
f.comment = "calabash.framework"
|
202
|
+
pbx.add_item f
|
203
|
+
bf = PBXProject::PBXTypes::PBXBuildFile.new(:comment => "calabash.framework in Frameworks", :fileRef => f.guid)
|
204
|
+
bf.comment = "calabash.framework in Frameworks"
|
205
|
+
pbx.add_item bf
|
206
|
+
|
207
|
+
group = pbx.find_item :name => "Frameworks", :type => PBXProject::PBXTypes::PBXGroup
|
208
|
+
group.add_children f
|
209
|
+
|
210
|
+
build_phase_entry = PBXProject::PBXTypes::BasicValue.new(:value => bf.guid, :comment => bf.comment)
|
211
|
+
pbx.sections['PBXFrameworksBuildPhase'][0].files << build_phase_entry
|
212
|
+
|
213
|
+
|
214
|
+
#TODO first check if already linking with CFNetwork
|
215
|
+
cfnet = pbx.find_item :name => "CFNetwork.framework", :type => PBXProject::PBXTypes::PBXFileReference
|
216
|
+
|
217
|
+
unless cfnet
|
218
|
+
f = PBXProject::PBXTypes::PBXFileReference.new(:path => "System/Library/Frameworks/CFNetwork.framework", :lastKnownFileType => "wrapper.framework", :sourceTree => 'SDKROOT')
|
219
|
+
f.comment = "CFNetwork.framework"
|
220
|
+
f.name = f.comment
|
221
|
+
pbx.add_item f
|
222
|
+
bf = PBXProject::PBXTypes::PBXBuildFile.new(:comment => "CFNetwork.framework in Frameworks", :fileRef => f.guid)
|
223
|
+
bf.comment = "CFNetwork.framework in Frameworks"
|
224
|
+
pbx.add_item bf
|
225
|
+
group.add_children f
|
226
|
+
build_phase_entry = PBXProject::PBXTypes::BasicValue.new(:value => bf.guid, :comment => bf.comment)
|
227
|
+
pbx.sections['PBXFrameworksBuildPhase'][0].files << build_phase_entry
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
targets = pbx.sections['PBXNativeTarget']
|
232
|
+
target = nil
|
233
|
+
if targets.count == 0
|
234
|
+
msg("Error") do
|
235
|
+
puts "Unable to find targets in project."
|
236
|
+
puts "Aborting..."
|
237
|
+
end
|
238
|
+
exit 1
|
239
|
+
elsif (targets.count == 1)
|
240
|
+
target = targets[0]
|
241
|
+
else
|
242
|
+
preferred_target = targets.find { |t| t.name.value == project_name }
|
243
|
+
msg("Question") do
|
244
|
+
puts "You have several targets..."
|
245
|
+
puts (targets.map { |t| t.name.value }).join("\n")
|
246
|
+
|
247
|
+
found = nil
|
248
|
+
until found do
|
249
|
+
puts "Please specify which is your production app target."
|
250
|
+
puts "Please enter target name."
|
251
|
+
puts "Hit Enter for default choice: #{preferred_target.name.value}" unless preferred_target.nil?
|
252
|
+
answer = STDIN.gets.chomp
|
253
|
+
if (preferred_target and answer == '')
|
254
|
+
target = preferred_target
|
255
|
+
found = true
|
256
|
+
else
|
257
|
+
target = found = targets.find { |t| t.name.value == answer }
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
|
264
|
+
bc_list_id = target.buildConfigurationList.value
|
265
|
+
bc_list = pbx.find_item :guid => bc_list_id, :type => PBXProject::PBXTypes::XCConfigurationList
|
266
|
+
bc_ref = bc_list.buildConfigurations.find { |bc| bc.comment =="Debug" }
|
267
|
+
bc_id = bc_ref.value
|
268
|
+
bc = pbx.find_item :guid => bc_id, :type => PBXProject::PBXTypes::XCBuildConfiguration
|
269
|
+
cal_build_settings = bc.buildSettings.clone
|
270
|
+
|
271
|
+
|
272
|
+
bc.buildSettings.each do |k, v|
|
273
|
+
cal_build_settings[k] = v.clone
|
274
|
+
end
|
275
|
+
|
276
|
+
project_bc_id = pbx.sections['PBXProject'][0].buildConfigurationList.value
|
277
|
+
project_bc_list = pbx.find_item :guid => project_bc_id, :type => PBXProject::PBXTypes::XCConfigurationList
|
278
|
+
project_bc_ref = project_bc_list.buildConfigurations.find { |bc| bc.comment =="Debug" }
|
279
|
+
project_bc_id = project_bc_ref.value
|
280
|
+
project_bc = pbx.find_item :guid => project_bc_id, :type => PBXProject::PBXTypes::XCBuildConfiguration
|
281
|
+
project_cal_build_settings = project_bc.buildSettings.clone
|
282
|
+
project_bc.buildSettings.each do |k, v|
|
283
|
+
project_cal_build_settings[k] = v.clone
|
284
|
+
end
|
285
|
+
|
286
|
+
|
287
|
+
ld_flags = cal_build_settings['OTHER_LDFLAGS'] || []
|
288
|
+
ld_flags << PBXProject::PBXTypes::BasicValue.new(:value => '"-force_load"')
|
289
|
+
ld_flags << PBXProject::PBXTypes::BasicValue.new(:value => '"$(SRCROOT)/calabash.framework/calabash"')
|
290
|
+
ld_flags << PBXProject::PBXTypes::BasicValue.new(:value => '"-lstdc++"')
|
291
|
+
|
292
|
+
|
293
|
+
cal_build_settings['OTHER_LDFLAGS'] = ld_flags
|
294
|
+
|
295
|
+
cal_bc = PBXProject::PBXTypes::XCBuildConfiguration.new(:name => "Calabash")
|
296
|
+
cal_bc.buildSettings = cal_build_settings
|
297
|
+
cal_bc.comment = "Calabash"
|
298
|
+
|
299
|
+
project_cal_bc = PBXProject::PBXTypes::XCBuildConfiguration.new(:name => "Calabash")
|
300
|
+
project_cal_bc.buildSettings = project_cal_build_settings
|
301
|
+
project_cal_bc.comment = "Calabash"
|
302
|
+
|
303
|
+
bc_list.buildConfigurations << PBXProject::PBXTypes::BasicValue.new(:value => cal_bc.guid, :comment => "Calabash")
|
304
|
+
project_bc_list.buildConfigurations << PBXProject::PBXTypes::BasicValue.new(:value => project_cal_bc.guid, :comment => "Calabash")
|
305
|
+
FileUtils.cd pwd
|
306
|
+
|
307
|
+
|
308
|
+
pbx.sections['XCBuildConfiguration']<<project_cal_bc
|
309
|
+
pbx.sections['XCBuildConfiguration']<<cal_bc
|
310
|
+
|
311
|
+
pbx.sections['XCBuildConfiguration'].each do |bc|
|
312
|
+
sp = bc.buildSettings["FRAMEWORK_SEARCH_PATHS"] || []
|
313
|
+
if not sp.is_a?Array
|
314
|
+
sp = [sp]
|
315
|
+
end
|
316
|
+
inherit = sp.find { |x| x.value == '"$(inherited)"' }
|
317
|
+
srcroot = sp.find { |x| p x.value;x.value == "\"$(SRCROOT)\""}
|
318
|
+
p srcroot
|
319
|
+
sp << PBXProject::PBXTypes::BasicValue.new(:value => '"$(inherited)"') unless inherit
|
320
|
+
sp << PBXProject::PBXTypes::BasicValue.new(:value => "\"$(SRCROOT)\"") unless srcroot
|
321
|
+
bc.buildSettings["FRAMEWORK_SEARCH_PATHS"] = sp
|
322
|
+
end
|
323
|
+
|
324
|
+
pbx.write_to :file => proj_file
|
325
|
+
|
326
|
+
end
|
327
|
+
|
328
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
def quit_sim
|
2
|
+
`echo 'application "iPhone Simulator" quit' | osascript`
|
3
|
+
end
|
4
|
+
def calabash_sim_reset
|
5
|
+
reset_script = File.absolute_path("#{@script_dir}/reset_simulator.scpt")
|
6
|
+
sdks = `#{@iphonesim} showsdks`.split("\n")
|
7
|
+
sdks.each do |sdk_path_str|
|
8
|
+
sdk_path = sdk_path_str.split(" ")
|
9
|
+
`#{@iphonesim} launch DUMMY_APP #{sdk_path[0]} ipad 2> /dev/null`
|
10
|
+
system("osascript #{reset_script}")
|
11
|
+
`#{@iphonesim} launch DUMMY_APP #{sdk_path[0]} iphone 2> /dev/null`
|
12
|
+
system("osascript #{reset_script}")
|
13
|
+
end
|
14
|
+
|
15
|
+
quit_sim
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def calabash_sim_accessibility
|
20
|
+
dirs = Dir.glob(File.join(File.expand_path("~/Library"),"Application Support","iPhone Simulator","*.*","Library","Preferences"))
|
21
|
+
dirs.each do |sim_pref_dir|
|
22
|
+
fp = File.absolute_path("#{@script_dir}/data/")
|
23
|
+
FileUtils.cp("#{fp}/com.apple.Accessibility.plist", sim_pref_dir)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def calabash_sim_locale(args)
|
28
|
+
|
29
|
+
prefs_path = File.absolute_path("#{@script_dir}/data/.GlobalPreferences.plist")
|
30
|
+
plist = CFPropertyList::List.new(:file => prefs_path)
|
31
|
+
hash = CFPropertyList.native_types(plist.value)
|
32
|
+
|
33
|
+
|
34
|
+
if args.length == 0
|
35
|
+
print_usage
|
36
|
+
puts "Options: \n"
|
37
|
+
puts hash['AppleLanguages'].join("\n")
|
38
|
+
exit 0
|
39
|
+
end
|
40
|
+
lang = args.shift
|
41
|
+
reg = nil
|
42
|
+
if args.length == 1
|
43
|
+
reg = args.shift
|
44
|
+
end
|
45
|
+
|
46
|
+
langs = hash['AppleLanguages']
|
47
|
+
lang_index = langs.find_index {|l| l == lang}
|
48
|
+
|
49
|
+
if lang_index.nil?
|
50
|
+
puts "Unable to find #{lang}..."
|
51
|
+
puts "Options:\n#{langs.join("\n")}"
|
52
|
+
exit 0
|
53
|
+
end
|
54
|
+
|
55
|
+
langs[0],langs[lang_index] = langs[lang_index],langs[0]
|
56
|
+
|
57
|
+
|
58
|
+
if reg
|
59
|
+
hash['AppleLocale'] = reg
|
60
|
+
end
|
61
|
+
res_plist = CFPropertyList::List.new
|
62
|
+
res_plist.value = CFPropertyList.guess(hash)
|
63
|
+
dirs = Dir.glob(File.join(File.expand_path("~/Library"),"Application Support","iPhone Simulator","*.*","Library","Preferences"))
|
64
|
+
dirs.each do |sim_pref_dir|
|
65
|
+
res_plist.save("#{sim_pref_dir}/.GlobalPreferences.plist", CFPropertyList::List::FORMAT_BINARY)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def calabash_sim_device(args)
|
73
|
+
quit_sim
|
74
|
+
options = ["iPad", "iPhone", "iPhone_Retina"]
|
75
|
+
if args.length != 1 or not options.find {|x| x == args[0]}
|
76
|
+
print_usage
|
77
|
+
puts "Unrecognized args: #{args}"
|
78
|
+
puts "should be one of #{options}"
|
79
|
+
exit(0)
|
80
|
+
end
|
81
|
+
path =File.join(File.expand_path("~/Library"),"Preferences","com.apple.iphonesimulator.plist")
|
82
|
+
plist = CFPropertyList::List.new(:file => path)
|
83
|
+
hash = CFPropertyList.native_types(plist.value)
|
84
|
+
hash['SimulateDevice'] = args[0].gsub("iPhone_Retina","iPhone (Retina)")
|
85
|
+
plist.value = CFPropertyList.guess(hash)
|
86
|
+
plist.save(path, CFPropertyList::List::FORMAT_BINARY)
|
87
|
+
end
|
88
|
+
|
data/bin/iphonesim
ADDED
Binary file
|
data/calabash-cucumber.gemspec
CHANGED
@@ -13,12 +13,15 @@ Gem::Specification.new do |s|
|
|
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
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
-
s.executables =
|
16
|
+
s.executables = "calabash-ios"
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
19
|
s.add_dependency( "cucumber" )
|
20
|
-
s.add_dependency( "rspec", ["~> 2.7.0"] )
|
21
20
|
s.add_dependency( "json" )
|
21
|
+
s.add_dependency( "CFPropertyList" )
|
22
|
+
s.add_dependency( "sim_launcher" )
|
22
23
|
s.add_dependency( "slowhandcuke" )
|
23
24
|
s.add_dependency( "net-http-persistent" )
|
25
|
+
s.add_dependency( "pbxproject" )
|
26
|
+
|
24
27
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Usage: calabash-ios <command-name> [parameters]
|
2
|
+
<command-name> can be one of
|
3
|
+
help
|
4
|
+
gen
|
5
|
+
setup [path]? (Note: EXPERIMENTAL)
|
6
|
+
sim locale [lang] [regional]?
|
7
|
+
sim reset (Note: EXPERIMENTAL)
|
8
|
+
sim acc
|
9
|
+
sim device [iPad, iPhone, iPhone_Retina]
|
10
|
+
|
11
|
+
Commands:
|
12
|
+
gen creates a skeleton features dir. This is usually used once when
|
13
|
+
setting up calabash to ensure that the features folder contains
|
14
|
+
the right step definitions and environment to run with cucumber.
|
15
|
+
|
16
|
+
setup [path]? (EXPERIMENTAL) Automates setting up your iOS Xcode project
|
17
|
+
with calabash-io-server. It will download calabash.framework
|
18
|
+
and modifying you Xcode project file.
|
19
|
+
The parameter [path] is optional (default is the current dir).
|
20
|
+
If specified [path] should be the path to your iOS Xcode project
|
21
|
+
(i.e., the folder which contains projectname.xcodeproj).
|
22
|
+
|
23
|
+
The following modifications are made
|
24
|
+
- add the calabash.framework to your Frameworks folder
|
25
|
+
- add $(SRCROOT) to framework search path
|
26
|
+
- link with calabash.framework (target can be chosen)
|
27
|
+
- create a new Build configuration: Calabash
|
28
|
+
- ensure calabash.framework is loaded in Calabash configuration
|
29
|
+
- create a new scheme name project-cal
|
30
|
+
|
31
|
+
Your Xcode project file will be backed up as project.pbxproj.bak.
|
32
|
+
The backup is placed in the .xcodeproj folder for your project.
|
33
|
+
If something goes wrong. Close Xcode and copy project.pbxproj.bak
|
34
|
+
to project.pbxproj inside your .xcodeproj folder.
|
35
|
+
|
36
|
+
sim locale [lang] [regional]? Changes the regional settings
|
37
|
+
for the iOS Simulators. You must ensure the correct format
|
38
|
+
for the optional regional parameter, for example,
|
39
|
+
da_DK, en_US.
|
40
|
+
|
41
|
+
sim reset (EXPERIMENTAL) Will select "Reset Content and Settings"
|
42
|
+
in the iOS Simulators using AppleScript.
|
43
|
+
|
44
|
+
sim device [device] Will set the default iOS Simulator device.
|
45
|
+
[device] can be one of iPad, iPhone, iPhone_Retina.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
########################################
|
2
|
+
# #
|
3
|
+
# Important Note #
|
4
|
+
# #
|
5
|
+
# When running calabash-ios tests at #
|
6
|
+
# www.lesspainful.com #
|
7
|
+
# this file will be overwritten by #
|
8
|
+
# a file which automates #
|
9
|
+
# app launch on devices. #
|
10
|
+
# #
|
11
|
+
# Don't rely on this file being #
|
12
|
+
# present when running at #
|
13
|
+
# lesspainful.com. #
|
14
|
+
# #
|
15
|
+
# Only put stuff here to automate #
|
16
|
+
# iOS Simulator. #
|
17
|
+
# #
|
18
|
+
# You can put your app bundle path #
|
19
|
+
# for automating simulator app start: #
|
20
|
+
# Uncomment APP_BUNDLE_PATH =.. #
|
21
|
+
# #
|
22
|
+
########################################
|
23
|
+
|
24
|
+
require 'calabash-cucumber/launch/simulator_helper'
|
25
|
+
|
26
|
+
# Uncomment and replace ?? appropriately
|
27
|
+
# This should point to your Simulator build
|
28
|
+
# which includes calabash framework
|
29
|
+
# this is usually the Calabash build configuration
|
30
|
+
# of your production target.
|
31
|
+
#APP_BUNDLE_PATH = "~/Library/Developer/Xcode/DerivedData/??/Build/Products/Calabash-iphonesimulator/??.app""
|
32
|
+
#
|
33
|
+
|
34
|
+
def relaunch
|
35
|
+
if ENV['NO_LAUNCH'].nil?
|
36
|
+
Calabash::Cucumber::SimulatorHelper.relaunch(app_path,ENV['SDK_VERSION'],ENV['DEVICE'])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def app_path
|
42
|
+
ENV['APP_BUNDLE_PATH'] || (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH)
|
43
|
+
end
|
44
|
+
|
45
|
+
##TODO Reset simulator between features!
|
46
|
+
|
47
|
+
Before do |scenario|
|
48
|
+
relaunch
|
49
|
+
end
|
50
|
+
|
51
|
+
at_exit do
|
52
|
+
if ENV['NO_LAUNCH'].nil?
|
53
|
+
Calabash::Cucumber::SimulatorHelper.stop
|
54
|
+
end
|
55
|
+
end
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
|
11
11
|
# -- Touch --#
|
12
12
|
Then /^I (?:press|touch) on screen (\d+) from the left and (\d+) from the top$/ do |x, y|
|
13
|
-
touch(nil, {:x => x.to_i, :y => y.to_i})
|
13
|
+
touch(nil, {:offset => {:x => x.to_i, :y => y.to_i}})
|
14
14
|
sleep(STEP_PAUSE)
|
15
15
|
end
|
16
16
|
|
@@ -281,7 +281,7 @@ Then /^I should not see "([^\"]*)"$/ do |expected_mark|
|
|
281
281
|
res = query("view marked:'#{expected_mark}'")
|
282
282
|
res.concat query("view text:'#{expected_mark}'")
|
283
283
|
unless res.empty?
|
284
|
-
screenshot_and_raise "Expected no element with text nor accessibilityLabel: #{expected_mark}, found #{res}"
|
284
|
+
screenshot_and_raise "Expected no element with text nor accessibilityLabel: #{expected_mark}, found #{res.join(", ")}"
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'net/http/persistent'
|
2
|
+
require 'sim_launcher'
|
3
|
+
require 'CFPropertyList'
|
4
|
+
|
5
|
+
module Calabash
|
6
|
+
module Cucumber
|
7
|
+
|
8
|
+
module SimulatorHelper
|
9
|
+
|
10
|
+
DEFAULT_DERIVED_DATA = File.expand_path("~/Library/Developer/Xcode/DerivedData/*/info.plist")
|
11
|
+
MAX_PING_ATTEMPTS = 5
|
12
|
+
|
13
|
+
def self.relaunch(path, sdk = nil, version = 'iphone')
|
14
|
+
|
15
|
+
app_bundle_path = app_bundle_or_raise(path)
|
16
|
+
ensure_connectivity(app_bundle_path, sdk, version)
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.stop
|
21
|
+
simulator = SimLauncher::Simulator.new
|
22
|
+
simulator.quit_simulator
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def self.derived_data_dir_for_project
|
27
|
+
dir = project_dir
|
28
|
+
|
29
|
+
info_plist = Dir.glob(DEFAULT_DERIVED_DATA).find { |plist_file|
|
30
|
+
plist = CFPropertyList::List.new(:file => plist_file)
|
31
|
+
hash = CFPropertyList.native_types(plist.value)
|
32
|
+
ws_dir = File.dirname(hash['WorkspacePath']).downcase
|
33
|
+
p_dir = dir.downcase
|
34
|
+
ws_dir == p_dir
|
35
|
+
}
|
36
|
+
File.dirname(info_plist) unless info_plist.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.project_dir
|
40
|
+
File.expand_path(ENV['PROJECT_DIR'] || Dir.pwd)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.app_bundle_or_raise(path)
|
44
|
+
dd_dir = derived_data_dir_for_project
|
45
|
+
app_bundles = Dir.glob(File.join(dd_dir, "Build", "Products", "*", "*.app"))
|
46
|
+
bundle_path = nil
|
47
|
+
|
48
|
+
if path and not Dir.exist?(path)
|
49
|
+
puts "Unable to find .app bundle at #{path}"
|
50
|
+
if dd_dir.nil?
|
51
|
+
raise "Unable to find Project for #{project_dir} in #{%x[ls #{DEFAULT_DERIVED_DATA}]}"
|
52
|
+
end
|
53
|
+
if app_bundles.empty?
|
54
|
+
raise "Can't find build in #{dd_dir}/Build/Products/*/*.app'. Have you built your app for simulator?"
|
55
|
+
end
|
56
|
+
msg = "Try setting APP_BUNDLE_PATH in features/support/launch.rb to one of:\n\n"
|
57
|
+
msg << app_bundles.join("\n")
|
58
|
+
raise msg
|
59
|
+
elsif path
|
60
|
+
bundle_path = path
|
61
|
+
else
|
62
|
+
sim_dirs = Dir.glob(File.join(dd_dir, "Build", "Products", "*-iphonesimulator", "*.app"))
|
63
|
+
if sim_dirs.empty?
|
64
|
+
msg = ["Unable to auto detect APP_BUNDLE_PATH."]
|
65
|
+
msg << "Have you built your app for simulator?."
|
66
|
+
msg << "Searched dir: #{dd_dir}/Build/Products"
|
67
|
+
msg << "Please build your app from Xcode"
|
68
|
+
msg << "You should build the -cal scheme or your calabash target."
|
69
|
+
msg << ""
|
70
|
+
msg << "Alternatively, specify APP_BUNDLE_PATH in features/support/launch.rb"
|
71
|
+
msg << "This should point to the location of your built app linked with calabash.\n"
|
72
|
+
raise msg.join("\n")
|
73
|
+
end
|
74
|
+
preferred_dir = find_preferred_dir(sim_dirs)
|
75
|
+
if preferred_dir.nil?
|
76
|
+
msg = ["Error... Unable to find APP_BUNDLE_PATH."]
|
77
|
+
msg << "Cannot find a built app that is linked with calabash.framework"
|
78
|
+
msg << "Please build your app from Xcode"
|
79
|
+
msg << "You should build the -cal scheme or your calabash target."
|
80
|
+
msg << ""
|
81
|
+
msg << "Alternatively, specify APP_BUNDLE_PATH in features/support/launch.rb"
|
82
|
+
msg << "This should point to the location of your built app linked with calabash.\n"
|
83
|
+
raise msg.join("\n")
|
84
|
+
end
|
85
|
+
puts("-"*37)
|
86
|
+
puts "Auto detected APP_BUNDLE_PATH:\n\n"
|
87
|
+
|
88
|
+
puts "APP_BUNDLE_PATH=#{preferred_dir || sim_dirs[0]}\n\n"
|
89
|
+
puts "Please verify!"
|
90
|
+
puts "If this is wrong please set it as APP_BUNDLE_PATH in features/support/launch.rb\n"
|
91
|
+
puts("-"*37)
|
92
|
+
bundle_path = sim_dirs[0]
|
93
|
+
end
|
94
|
+
bundle_path
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.find_preferred_dir(sim_dirs)
|
98
|
+
|
99
|
+
pref = sim_dirs.find do |d|
|
100
|
+
out = `otool #{d}/* -o | grep CalabashServer`
|
101
|
+
/CalabashServer/.match(out)
|
102
|
+
end
|
103
|
+
|
104
|
+
if pref.nil?
|
105
|
+
pref = sim_dirs.find {|d| /Calabash-iphonesimulator/.match(d)}
|
106
|
+
end
|
107
|
+
pref
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.ensure_connectivity(app_bundle_path, sdk, version)
|
111
|
+
begin
|
112
|
+
Timeout::timeout(15) do
|
113
|
+
connected = false
|
114
|
+
until connected
|
115
|
+
simulator = launch(app_bundle_path, sdk, version)
|
116
|
+
num_pings = 0
|
117
|
+
until connected or (num_pings == MAX_PING_ATTEMPTS)
|
118
|
+
begin
|
119
|
+
connected = (ping_app == '405')
|
120
|
+
rescue Exception => e
|
121
|
+
if (num_pings > 2) then p e end
|
122
|
+
ensure
|
123
|
+
num_pings += 1
|
124
|
+
unless connected
|
125
|
+
sleep 1
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
rescue
|
132
|
+
msg = "Unable to make connection to Calabash Server at #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}\n"
|
133
|
+
msg << "Make sure you've' linked correctly with calabash.framework and set Other Linker Flags.\n"
|
134
|
+
msg << "See: http://github.com/calabash/calabash-ios"
|
135
|
+
raise msg
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
def self.launch(app_bundle_path, sdk, version)
|
141
|
+
simulator = SimLauncher::Simulator.new
|
142
|
+
simulator.quit_simulator
|
143
|
+
simulator.launch_ios_app(app_bundle_path, sdk, version)
|
144
|
+
simulator
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.ping_app
|
148
|
+
url = URI.parse (ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/")
|
149
|
+
puts "Ping #{url}..."
|
150
|
+
http = Net::HTTP.new(url.host, url.port)
|
151
|
+
res = http.start do |sess|
|
152
|
+
sess.request Net::HTTP::Get.new url.path
|
153
|
+
end
|
154
|
+
status = res.code
|
155
|
+
begin
|
156
|
+
http.finish if http and http.started?
|
157
|
+
rescue Exception => e
|
158
|
+
puts "Finish #{e}"
|
159
|
+
end
|
160
|
+
status
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
Binary file
|
Binary file
|
Binary file
|
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.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
16
|
-
requirement: &
|
16
|
+
requirement: &70257557882100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,32 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70257557882100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: json
|
27
|
+
requirement: &70257557881400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70257557881400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: CFPropertyList
|
38
|
+
requirement: &70257557880780 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70257557880780
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sim_launcher
|
49
|
+
requirement: &70257557880220 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70257557880220
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: slowhandcuke
|
49
|
-
requirement: &
|
60
|
+
requirement: &70257557878640 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,10 +65,21 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :runtime
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70257557878640
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: net-http-persistent
|
60
|
-
requirement: &
|
71
|
+
requirement: &70257557878060 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70257557878060
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: pbxproject
|
82
|
+
requirement: &70257557877640 !ruby/object:Gem::Requirement
|
61
83
|
none: false
|
62
84
|
requirements:
|
63
85
|
- - ! '>='
|
@@ -65,13 +87,13 @@ dependencies:
|
|
65
87
|
version: '0'
|
66
88
|
type: :runtime
|
67
89
|
prerelease: false
|
68
|
-
version_requirements: *
|
90
|
+
version_requirements: *70257557877640
|
69
91
|
description: calabash-cucumber drives tests for native iOS apps. You must link your
|
70
92
|
app with calabash-ios-server framework to execute tests.
|
71
93
|
email:
|
72
94
|
- karl@lesspainful.com
|
73
95
|
executables:
|
74
|
-
- calabash
|
96
|
+
- calabash-ios
|
75
97
|
extensions: []
|
76
98
|
extra_rdoc_files: []
|
77
99
|
files:
|
@@ -82,9 +104,15 @@ files:
|
|
82
104
|
- LICENSE
|
83
105
|
- README.md
|
84
106
|
- Rakefile
|
85
|
-
- bin/calabash
|
107
|
+
- bin/calabash-ios
|
108
|
+
- bin/calabash-ios-generate.rb
|
109
|
+
- bin/calabash-ios-helpers.rb
|
110
|
+
- bin/calabash-ios-setup.rb
|
111
|
+
- bin/calabash-ios-sim.rb
|
112
|
+
- bin/iphonesim
|
86
113
|
- calabash-cucumber.gemspec
|
87
114
|
- copy_resources.sh
|
115
|
+
- doc/calabash-ios-help.txt
|
88
116
|
- epl-v10.html
|
89
117
|
- features-skeleton/.irbrc
|
90
118
|
- features-skeleton/irb_ios4.sh
|
@@ -93,10 +121,13 @@ files:
|
|
93
121
|
- features-skeleton/step_definitions/calabash_steps.rb
|
94
122
|
- features-skeleton/support/env.rb
|
95
123
|
- features-skeleton/support/hooks.rb
|
124
|
+
- features-skeleton/support/launch.rb
|
96
125
|
- lib/calabash-cucumber.rb
|
126
|
+
- lib/calabash-cucumber/calabash_helper.rb
|
97
127
|
- lib/calabash-cucumber/calabash_steps.rb
|
98
128
|
- lib/calabash-cucumber/color_helper.rb
|
99
129
|
- lib/calabash-cucumber/cucumber.rb
|
130
|
+
- lib/calabash-cucumber/launch/simulator_helper.rb
|
100
131
|
- lib/calabash-cucumber/operations.rb
|
101
132
|
- lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64
|
102
133
|
- lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64
|
@@ -161,6 +192,9 @@ files:
|
|
161
192
|
- lib/calabash-cucumber/resources/touch_ios5_ipad.base64
|
162
193
|
- lib/calabash-cucumber/resources/touch_ios5_iphone.base64
|
163
194
|
- lib/calabash-cucumber/version.rb
|
195
|
+
- scripts/data/.GlobalPreferences.plist
|
196
|
+
- scripts/data/com.apple.Accessibility.plist
|
197
|
+
- scripts/reset_simulator.scpt
|
164
198
|
homepage: http://www.lesspainful.com/calabash
|
165
199
|
licenses: []
|
166
200
|
post_install_message:
|
data/bin/calabash
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
features_dir = File.join( FileUtils.pwd, "features" )
|
6
|
-
source_dir = File.join( File.dirname(__FILE__), '..', 'features-skeleton' )
|
7
|
-
|
8
|
-
if File.exists?( features_dir )
|
9
|
-
if (ARGV.length == 1 && ARGV[0] == 'update')
|
10
|
-
features_dir = File.join( FileUtils.pwd, "features_template")
|
11
|
-
if File.exists?( features_dir )
|
12
|
-
puts "Working directory #{features_dir} already exist."
|
13
|
-
puts "Please move it and run calabash update again to continue."
|
14
|
-
exit 2
|
15
|
-
end
|
16
|
-
FileUtils.cp_r( source_dir, features_dir)
|
17
|
-
puts <<EOS
|
18
|
-
|
19
|
-
----------- Instructions -----------
|
20
|
-
|
21
|
-
Copied files to #{features_dir}.
|
22
|
-
You must manually merge files from
|
23
|
-
|
24
|
-
features_template/step_definitions
|
25
|
-
features_template/support
|
26
|
-
|
27
|
-
To your ./features dir.
|
28
|
-
|
29
|
-
If you haven't edited any of the files:
|
30
|
-
|
31
|
-
features/support/env.rb
|
32
|
-
features/support/hooks.rb
|
33
|
-
features/step_definitions/ilesspainful_steps.rb
|
34
|
-
|
35
|
-
You can simply copy files from
|
36
|
-
|
37
|
-
features_template/step_definitions
|
38
|
-
features_template/support
|
39
|
-
|
40
|
-
to the corresponding dirs in features.
|
41
|
-
You must also delete: features/step_definitions/ilesspainful_steps.rb
|
42
|
-
|
43
|
-
Otherwise, if you have edited any of the files,
|
44
|
-
you must manually merge them with those of features_template.
|
45
|
-
|
46
|
-
It is important that you remove any reference to
|
47
|
-
the ilesspainfulclient-cucumber gem if present in your files.
|
48
|
-
|
49
|
-
When you are done, you should delete features_template.
|
50
|
-
|
51
|
-
If in doubt, contact Karl Krukow <karl@lesspainful.com>
|
52
|
-
-----------------------------------
|
53
|
-
EOS
|
54
|
-
exit
|
55
|
-
else
|
56
|
-
puts "A features directory already exists. I won't overwrite it. Giving up."
|
57
|
-
puts "Run calabash update for update instructions."
|
58
|
-
end
|
59
|
-
exit 1
|
60
|
-
else
|
61
|
-
puts "I'm about to create a subdirectory called features."
|
62
|
-
puts "features will contain all your calabash tests."
|
63
|
-
puts "Please hit return to confirm that's what you want."
|
64
|
-
exit 2 unless STDIN.gets.chomp == ''
|
65
|
-
|
66
|
-
FileUtils.cp_r( source_dir, features_dir )
|
67
|
-
FileUtils.mv "#{features_dir}/.irbrc", "."
|
68
|
-
FileUtils.mv "#{features_dir}/irb_ios4.sh", "."
|
69
|
-
FileUtils.mv "#{features_dir}/irb_ios5.sh", "."
|
70
|
-
|
71
|
-
puts "features subdirectory created. Try starting you app in the iOS simulator "
|
72
|
-
puts "using the Calabash target (see calabash-ios-server for how to create the target).\n"
|
73
|
-
puts "Then try executing \n\nSTEP_PAUSE=2 OS=ios5 DEVICE=iphone cucumber"
|
74
|
-
puts "\n (replace ios5 with ios4 if running iOS 4.x simulator.\nReplace iphone with ipad if running iPad simulator.).\n"
|
75
|
-
|
76
|
-
end
|