calabash-cucumber 0.9.24 → 0.9.25
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/calabash-ios-helpers.rb +7 -2
- data/bin/calabash-ios-setup.rb +2 -0
- data/lib/calabash-cucumber/operations.rb +5 -18
- data/lib/calabash-cucumber/version.rb +1 -1
- metadata +16 -17
- data/README.md +0 -182
data/bin/calabash-ios-helpers.rb
CHANGED
@@ -94,9 +94,14 @@ def calabash_submit(args)
|
|
94
94
|
|
95
95
|
feature_path = "features"
|
96
96
|
if args.length == 3
|
97
|
-
|
97
|
+
msg("Error") do
|
98
|
+
puts "You can't supply a path to features folder yet."
|
99
|
+
puts "You should cd into your project folder containing your features folder"
|
100
|
+
puts "and then run this command again"
|
101
|
+
end
|
102
|
+
exit 1
|
98
103
|
end
|
99
|
-
system ("zip -r -o #{archive_path} #{
|
104
|
+
system ("zip -r -o #{archive_path} #{feature_path}")
|
100
105
|
|
101
106
|
msg("Info") do
|
102
107
|
puts "Uploading ipa and features to www.lesspainful.com"
|
data/bin/calabash-ios-setup.rb
CHANGED
@@ -273,25 +273,12 @@ module Operations
|
|
273
273
|
#end
|
274
274
|
|
275
275
|
def screenshot
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
outfile = "#{ENV['SCREENSHOT_PATH_PREFIX']}_#{CALABASH_COUNT[:step_line]}.png"
|
281
|
-
if File.exist?filename
|
282
|
-
puts "converting screenshot: #{filename} to #{outfile}"
|
283
|
-
system("convert #{filename} #{outfile}")
|
284
|
-
else
|
285
|
-
raise "Error. Unable to screenshot for device #{ENV['UUID']}."
|
286
|
-
end
|
287
|
-
else
|
288
|
-
res = http({:method =>:get, :path => 'screenshot'})
|
289
|
-
path = "screenshot_#{CALABASH_COUNT[:step_line]}.png"
|
290
|
-
File.open(path,'wb') do |f|
|
291
|
-
f.write res
|
292
|
-
end
|
293
|
-
puts "Saved screenshot: #{path}"
|
276
|
+
res = http({:method =>:get, :path => 'screenshot'})
|
277
|
+
path = "screenshot_#{CALABASH_COUNT[:step_line]}.png"
|
278
|
+
File.open(path,'wb') do |f|
|
279
|
+
f.write res
|
294
280
|
end
|
281
|
+
puts "Saved screenshot: #{path}"
|
295
282
|
end
|
296
283
|
|
297
284
|
def map( query, method_name, *method_args )
|
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.25
|
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-03-
|
12
|
+
date: 2012-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
16
|
-
requirement: &
|
16
|
+
requirement: &70142197416520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70142197416520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70142197415940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70142197415940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: CFPropertyList
|
38
|
-
requirement: &
|
38
|
+
requirement: &70142197415400 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70142197415400
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sim_launcher
|
49
|
-
requirement: &
|
49
|
+
requirement: &70142197414680 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70142197414680
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: slowhandcuke
|
60
|
-
requirement: &
|
60
|
+
requirement: &70142197414020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70142197414020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: net-http-persistent
|
71
|
-
requirement: &
|
71
|
+
requirement: &70142197413560 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70142197413560
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: pbxproject
|
82
|
-
requirement: &
|
82
|
+
requirement: &70142197413000 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70142197413000
|
91
91
|
description: calabash-cucumber drives tests for native iOS apps. You must link your
|
92
92
|
app with calabash-ios-server framework to execute tests.
|
93
93
|
email:
|
@@ -102,7 +102,6 @@ files:
|
|
102
102
|
- Gemfile
|
103
103
|
- Gemfile.lock
|
104
104
|
- LICENSE
|
105
|
-
- README.md
|
106
105
|
- Rakefile
|
107
106
|
- bin/calabash-ios
|
108
107
|
- bin/calabash-ios-generate.rb
|
data/README.md
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
This guide explains how to setup and use Calabash for iOS.
|
2
|
-
=============================================================
|
3
|
-
|
4
|
-
*Note*: To use Calabash with your iOS app, you must first link your
|
5
|
-
app with the `calabash.framework` as described in the README in the
|
6
|
-
`../frameworks/` directory.
|
7
|
-
|
8
|
-
After completing this guide you will be able to run tests locally
|
9
|
-
against the iOS Simulator. You can also interactively explore the
|
10
|
-
sample application using the Ruby irb console.
|
11
|
-
|
12
|
-
Finally, you can run your Calabash tests on real physical,
|
13
|
-
non-jailbroken iOS devices (iPad, iPhone, iPod Touch) using the
|
14
|
-
LessPainful service at
|
15
|
-
|
16
|
-
(http://www.lesspainful.com)
|
17
|
-
|
18
|
-
The LessPainful service offers test reports that compares
|
19
|
-
test results and screenshots on multiple iDevices.
|
20
|
-
|
21
|
-
This guide takes approximately 5-10 minutes to complete.
|
22
|
-
|
23
|
-
Installing the client.
|
24
|
-
----------------------
|
25
|
-
|
26
|
-
### Prerequisites
|
27
|
-
|
28
|
-
You need to have Ruby 1.9.2+ installed, and a recent RubyGems
|
29
|
-
installation. I use RVM or rbenv to manage my Ruby installations.
|
30
|
-
|
31
|
-
For RVM, see:
|
32
|
-
|
33
|
-
[http://beginrescueend.com/](http://beginrescueend.com/)
|
34
|
-
|
35
|
-
For rbenv, see:
|
36
|
-
[https://github.com/sstephenson/rbenv](https://github.com/sstephenson/rbenv)
|
37
|
-
|
38
|
-
The rbenv project is probably the simpler of the two.
|
39
|
-
|
40
|
-
You also need XCode 4.x. This guide aims at XCode 4.2, but should
|
41
|
-
also work for XCode versions >= 4.0.
|
42
|
-
|
43
|
-
### Installation
|
44
|
-
|
45
|
-
* Make sure ruby and ruby gems is on your path.
|
46
|
-
|
47
|
-
krukow:~/examples$ ruby -v
|
48
|
-
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
|
49
|
-
krukow:~/examples$ gem -v
|
50
|
-
1.8.10
|
51
|
-
|
52
|
-
* Install `ilesspainfulclient-cucumber` gem version 0.1.3:
|
53
|
-
|
54
|
-
krukow:~/examples$ gem install ilesspainfulclient-cucumber
|
55
|
-
Fetching: ilesspainfulclient-cucumber-0.1.3.gem (100%)
|
56
|
-
Successfully installed ilesspainfulclient-cucumber-0.1.3
|
57
|
-
1 gem installed
|
58
|
-
|
59
|
-
Exploring the sample application.
|
60
|
-
---------------------------------
|
61
|
-
|
62
|
-
Download the sample app from github:
|
63
|
-
|
64
|
-
[LessPainful-ios-sample-app](https://github.com/LessPainful/LessPainful_ios_sample_app)
|
65
|
-
|
66
|
-
Let's say you've put the sample app in a into a working
|
67
|
-
directory, `examples`.
|
68
|
-
|
69
|
-
Open the XCode project: LPSimpleExample.xcodeproj using XCode.
|
70
|
-
|
71
|
-
Select the LPSimpleExample-LP and iPhone Simulator 4.3 or 5.0 scheme
|
72
|
-
under schemes.
|
73
|
-
|
74
|
-
![Selecting the right scheme](https://github.com/LessPainful/LessPainful_ios_client/raw/master/documentation/example-1.png "Selecting Scheme")
|
75
|
-
|
76
|
-
### Run it
|
77
|
-
CMD-R to run. Look at the log output and verify that you see:
|
78
|
-
|
79
|
-
LPSimpleExample[11298:13703] HTTPServer: Started HTTP server on port 37265
|
80
|
-
|
81
|
-
If that message is there, you're good to go.
|
82
|
-
|
83
|
-
### Play with it
|
84
|
-
|
85
|
-
The easy way is to just run one of the irb scripts: `irb_ios4.sh` or
|
86
|
-
`irb_ios5.sh`.
|
87
|
-
|
88
|
-
From this console you can explore your application interactively.
|
89
|
-
|
90
|
-
You can query, touch, scroll, etc from the irb session.
|
91
|
-
For example, notice that the sample app has a button: "Login".
|
92
|
-
|
93
|
-
### Query
|
94
|
-
If you're running the iOS5 iPhone simulator run `irb_ios5.sh` otherwise: `irb_ios4.sh`.
|
95
|
-
|
96
|
-
Now try this from the irb:
|
97
|
-
|
98
|
-
ruby-1.9.2-p290 :003 > query("button")
|
99
|
-
|
100
|
-
You should see something like this:
|
101
|
-
|
102
|
-
=> ["<UIRoundedRectButton: 0x6567e00; frame = (109 215; 73 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x6567ef0>>"]
|
103
|
-
|
104
|
-
The `query` function takes a string query as an argument. They query argument is similar to a css selector, for example we can do:
|
105
|
-
|
106
|
-
ruby-1.9.2-p290 :009 > query("button label")
|
107
|
-
=> ["<UIButtonLabel: 0x6624f40; frame = (16 9; 40 19); text = 'Login'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x6645ec0>>"]
|
108
|
-
|
109
|
-
It may also take parameters that are mapped to Objective-C selectors on the found object.
|
110
|
-
|
111
|
-
ruby-1.9.2-p290 :010 > query("button label", :text)
|
112
|
-
=> ["Login"]
|
113
|
-
|
114
|
-
### Touch
|
115
|
-
|
116
|
-
Anything that can be found using query can also be touched.
|
117
|
-
Try this while you watch the iOS Simulator:
|
118
|
-
|
119
|
-
ruby-1.9.2-p290 :011 > touch("button")
|
120
|
-
|
121
|
-
Notice that the button is touched (turns blue), although this button doesn't do anything.
|
122
|
-
|
123
|
-
You can also touch the tab bars:
|
124
|
-
|
125
|
-
ruby-1.9.2-p290 :016 > touch("tabBarButton index:1")
|
126
|
-
|
127
|
-
The filter: `index:1` means that it is the second tab-bar button that should be touched.
|
128
|
-
|
129
|
-
### Accessibility
|
130
|
-
|
131
|
-
In general UI views are found using accessibility labels. To use those in the simulator they must be enabled.
|
132
|
-
|
133
|
-
* Press the "home-screen" button in the iOS Simulator
|
134
|
-
* Scroll left and open the Settings app insied iOS Simulator
|
135
|
-
* Select `General` > `Accessibility` > `Accessibility Inspector` : On.
|
136
|
-
* Re-run the sample app from XCode.
|
137
|
-
|
138
|
-
In your irb session try this:
|
139
|
-
|
140
|
-
ruby-1.9.2-p290 :025 > query("view marked:'switch'")
|
141
|
-
|
142
|
-
This command finds a view with accessibility label 'switch' (not that we use single quotes to delimit the accessibility label.
|
143
|
-
|
144
|
-
In general, many views have accessibility labels that "make sense". For example the tab bar buttons have accessibility labels:
|
145
|
-
|
146
|
-
ruby-1.9.2-p290 :029 > touch("tabBarButton marked:'second'")
|
147
|
-
|
148
|
-
To control accessibility labels on your views use:
|
149
|
-
`isAccessibilityElement = YES, and accessibilityLabel = @"somelbl";` This can be done in interface builder or programmatically:
|
150
|
-
|
151
|
-
(void) viewDidLoad {
|
152
|
-
[super viewDidLoad];
|
153
|
-
self.uiswitch.isAccessibilityElement = YES;
|
154
|
-
self.uiswitch.accessibilityLabel = @"switch";
|
155
|
-
}
|
156
|
-
|
157
|
-
### Advanced commands
|
158
|
-
|
159
|
-
Surprisingly, these commands are enough to navigate fairly many iOS apps. However, there are many more commands available. Consult the file `documentation/GherkinAPI.txt` for examples of how to use these.
|
160
|
-
|
161
|
-
|
162
|
-
### Working with your app
|
163
|
-
|
164
|
-
Now you're ready to work with your app.
|
165
|
-
|
166
|
-
You should download the LessPainful-ios-server project from Github:
|
167
|
-
|
168
|
-
[LessPainful-ios-server](https://github.com/LessPainful/LessPainful_ios_server)
|
169
|
-
|
170
|
-
Read the `README` from that project, and follow the instructions on
|
171
|
-
how to run LessPainful on your project.
|
172
|
-
|
173
|
-
License
|
174
|
-
=======
|
175
|
-
LessPainful-ios-client
|
176
|
-
Copyright (c) Karl Krukow. All rights reserved.
|
177
|
-
The use and distribution terms for this software are covered by the
|
178
|
-
Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
|
179
|
-
which can be found in the file epl-v10.html at the root of this distribution.
|
180
|
-
By using this software in any fashion, you are agreeing to be bound by
|
181
|
-
the terms of this license.
|
182
|
-
You must not remove this notice, or any other, from this software.
|