zucchini-ios 0.5.4 → 0.5.5
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/lib/config.rb +0 -4
- data/lib/feature.rb +9 -3
- data/lib/runner.rb +11 -1
- data/lib/uia/base.coffee +2 -1
- data/lib/version.rb +1 -1
- data/spec/lib/feature_spec.rb +32 -0
- data/spec/sample_setup/support/config.yml +0 -1
- data/spec/sample_setup/support/lib/helpers.coffee +3 -0
- data/templates/project/features/support/config.yml +0 -1
- data/templates/project/features/support/lib/helpers.coffee +3 -0
- metadata +8 -3
data/lib/config.rb
CHANGED
data/lib/feature.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Zucchini::Feature
|
2
2
|
attr_accessor :path
|
3
3
|
attr_accessor :device
|
4
|
+
attr_accessor :template
|
4
5
|
attr_accessor :stats
|
5
6
|
|
6
7
|
attr_reader :succeeded
|
@@ -45,9 +46,14 @@ class Zucchini::Feature
|
|
45
46
|
def compile_js
|
46
47
|
zucchini_base_path = File.expand_path("#{File.dirname(__FILE__)}/..")
|
47
48
|
|
48
|
-
feature_text = File.open("#{@path}/feature.zucchini").read.gsub(
|
49
|
+
feature_text = File.open("#{@path}/feature.zucchini").read.gsub(/\#.+[\z\n]?/,"").gsub(/\n/, "\\n")
|
49
50
|
File.open("#{run_data_path}/feature.coffee", "w+") { |f| f.write("Zucchini.run('#{feature_text}')") }
|
50
|
-
|
51
|
+
|
52
|
+
cs_paths = "#{zucchini_base_path}/lib/uia #{@path}/../support/screens"
|
53
|
+
cs_paths += " #{@path}/../support/lib" if File.exists?("#{@path}/../support/lib")
|
54
|
+
cs_paths += " #{run_data_path}/feature.coffee"
|
55
|
+
|
56
|
+
`coffee -o #{run_data_path} -j #{run_data_path}/feature.js -c #{cs_paths}`
|
51
57
|
end
|
52
58
|
|
53
59
|
def collect
|
@@ -58,7 +64,7 @@ class Zucchini::Feature
|
|
58
64
|
device_params = (@device[:name] == "iOS Simulator") ? "" : "-w #{@device[:udid]}"
|
59
65
|
|
60
66
|
begin
|
61
|
-
out = `instruments #{device_params} -t #{
|
67
|
+
out = `instruments #{device_params} -t #{@template} #{Zucchini::Config.app} -e UIASCRIPT #{run_data_path}/feature.js -e UIARESULTSPATH #{run_data_path} 2>&1`
|
62
68
|
puts out
|
63
69
|
# Hack. Instruments don't issue error return codes when JS exceptions occur
|
64
70
|
raise "Instruments run error" if (out.match /JavaScript error/) || (out.match /Instruments\ .{0,5}\ Error\ :/ )
|
data/lib/runner.rb
CHANGED
@@ -16,6 +16,8 @@ class Zucchini::Runner < Clamp::Command
|
|
16
16
|
raise "ZUCCHINI_DEVICE environment variable not set" unless ENV['ZUCCHINI_DEVICE']
|
17
17
|
@device = Zucchini::Config.device(ENV['ZUCCHINI_DEVICE'])
|
18
18
|
|
19
|
+
@template = detect_template
|
20
|
+
|
19
21
|
exit run
|
20
22
|
end
|
21
23
|
|
@@ -23,7 +25,8 @@ class Zucchini::Runner < Clamp::Command
|
|
23
25
|
compare_threads = {}
|
24
26
|
|
25
27
|
features.each do |f|
|
26
|
-
f.device
|
28
|
+
f.device = @device
|
29
|
+
f.template = @template
|
27
30
|
|
28
31
|
if collect? then f.collect
|
29
32
|
elsif compare? then f.compare
|
@@ -64,4 +67,11 @@ class Zucchini::Runner < Clamp::Command
|
|
64
67
|
def detection_error(path)
|
65
68
|
"#{path} is not a feature directory"
|
66
69
|
end
|
70
|
+
|
71
|
+
def detect_template
|
72
|
+
path = `xcode-select -print-path`.gsub(/\n/, '')
|
73
|
+
path += "/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate"
|
74
|
+
raise "Instruments template at #{path} does not exist" unless File.exists? path
|
75
|
+
path
|
76
|
+
end
|
67
77
|
end
|
data/lib/uia/base.coffee
CHANGED
data/lib/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Zucchini::Feature do
|
4
|
+
let(:path) { './spec/sample_setup/feature_one' }
|
5
|
+
let(:feature) { Zucchini::Feature.new(path) }
|
6
|
+
|
7
|
+
after(:all) { FileUtils.rm_rf Dir.glob("#{path}/run_data/feature.*") }
|
8
|
+
|
9
|
+
describe "#compile_js" do
|
10
|
+
before { feature.compile_js }
|
11
|
+
|
12
|
+
it "should strip comments from the feature file" do
|
13
|
+
File.read("#{feature.run_data_path}/feature.coffee").index('#').should be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "feature.js output" do
|
17
|
+
subject { File.read("#{feature.run_data_path}/feature.js") }
|
18
|
+
|
19
|
+
it "should include screen definitions" do
|
20
|
+
should match /SplashScreen = \(function/
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should include Zucchini runtime" do
|
24
|
+
should match /Zucchini.run = /
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should include custom libraries from support/lib" do
|
28
|
+
should match /Helpers.example = /
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: zucchini-ios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Vasily Mikhaylichenko
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date:
|
15
|
+
date: 2012-04-03 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: clamp
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/uia/screen.coffee
|
77
77
|
- lib/version.rb
|
78
78
|
- spec/lib/config_spec.rb
|
79
|
+
- spec/lib/feature_spec.rb
|
79
80
|
- spec/lib/generator_spec.rb
|
80
81
|
- spec/lib/report_spec.rb
|
81
82
|
- spec/lib/runner_spec.rb
|
@@ -91,6 +92,7 @@ files:
|
|
91
92
|
- spec/sample_setup/feature_two/reference/retina_ios5/06_sign up_spinner_error.png
|
92
93
|
- spec/sample_setup/feature_two/run_data/Run 1/06_sign up_spinner.png
|
93
94
|
- spec/sample_setup/support/config.yml
|
95
|
+
- spec/sample_setup/support/lib/helpers.coffee
|
94
96
|
- spec/sample_setup/support/masks/retina_ios5.png
|
95
97
|
- spec/sample_setup/support/screens/splash.coffee
|
96
98
|
- spec/spec_helper.rb
|
@@ -101,6 +103,7 @@ files:
|
|
101
103
|
- templates/feature/run_data/.gitignore
|
102
104
|
- templates/feature/setup.rb
|
103
105
|
- templates/project/features/support/config.yml
|
106
|
+
- templates/project/features/support/lib/helpers.coffee
|
104
107
|
- templates/project/features/support/masks/ipad_ios5.png
|
105
108
|
- templates/project/features/support/masks/low_ios4.png
|
106
109
|
- templates/project/features/support/masks/retina_ios5.png
|
@@ -129,12 +132,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
132
|
requirements: []
|
130
133
|
|
131
134
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.8.
|
135
|
+
rubygems_version: 1.8.15
|
133
136
|
signing_key:
|
134
137
|
specification_version: 3
|
135
138
|
summary: Functional testing framework for iOS-powered devices
|
136
139
|
test_files:
|
137
140
|
- spec/lib/config_spec.rb
|
141
|
+
- spec/lib/feature_spec.rb
|
138
142
|
- spec/lib/generator_spec.rb
|
139
143
|
- spec/lib/report_spec.rb
|
140
144
|
- spec/lib/runner_spec.rb
|
@@ -150,6 +154,7 @@ test_files:
|
|
150
154
|
- spec/sample_setup/feature_two/reference/retina_ios5/06_sign up_spinner_error.png
|
151
155
|
- spec/sample_setup/feature_two/run_data/Run 1/06_sign up_spinner.png
|
152
156
|
- spec/sample_setup/support/config.yml
|
157
|
+
- spec/sample_setup/support/lib/helpers.coffee
|
153
158
|
- spec/sample_setup/support/masks/retina_ios5.png
|
154
159
|
- spec/sample_setup/support/screens/splash.coffee
|
155
160
|
- spec/spec_helper.rb
|