calabash-cucumber-ios-cn 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +4 -0
- data/LICENSE +29 -0
- data/README.md +1 -0
- data/calabash-cucumber-ios-cn.gemspec +21 -0
- data/features/step_definitions/calabash_steps.rb +467 -0
- data/lib/calabash-cucumber-ios-cn.rb +2 -0
- data/lib/calabash-cucumber-ios-cn/calabash_steps.rb +1 -0
- data/lib/calabash-cucumber-ios-cn/version.rb +10 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NmJhMDMxYmJkNjNlOThkMjFlZmRhMDI0NzQ4NGNlNjI3ZmE4ODY5Mw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTg4ZjM3ZTdkMDFmMGM1ZDdlMGQxOGY2NzkxYWFjZDhlYWMxMzgzZA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGNjMzEwNzI1MzkxMGJhNWM3ZGZlY2EzYTU4MThhMDE3MzY5NWRlNmE0MjE2
|
10
|
+
MGE2MmY0ZDY3MTg4YjkyNDExMjgzYzRiOWFjOTkzMWFlZDkxMjNlOTc0YmRi
|
11
|
+
MGM0Mjk2NzZmZGI1NGFmMmU0MmQ1MzU0NDgxNjkyMDExOWNlMjA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTRmNTdlMDA5NTNmNGU0ZWMyZGE2NzRlNWRlNDZiNGUzOTg4ZWM5MzkzOGY2
|
14
|
+
ZDM5YmU0MzdjNWNiMjgzYjYzMzlhZTVhMzU1ZTUzNzRiMGI2OTIzODE2YTJj
|
15
|
+
MjBlMTE3ZWRlNzdjMGQ2Y2U1ZTllNDAzODg0ZjdhYjViYTI3NTY=
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (c) 2014 Li Jie. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions are
|
5
|
+
met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
12
|
+
the documentation and/or other materials provided with the
|
13
|
+
distribution.
|
14
|
+
|
15
|
+
3. Neither the name of Infrae nor the names of its contributors may
|
16
|
+
be used to endorse or promote products derived from this software
|
17
|
+
without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INFRAE OR
|
23
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
24
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
26
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
27
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
28
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Chinese translation of calabash-cucumber.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "calabash-cucumber-ios-cn/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "calabash-cucumber-ios-cn"
|
7
|
+
s.version = Calabash::Cucumber::IOS::CN::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Li Jie"]
|
10
|
+
s.email = ["cpunion@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/cpunion/calabash-cucumber-ios-cn"
|
12
|
+
s.summary = %q{Chinese translation of calabash-cucumber}
|
13
|
+
s.description = %q{Chinese translation of calabash-cucumber.}
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.licenses = ["BSD"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency 'calabash-cucumber', '~> 0.9', '>= 0.9.168'
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,467 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
Given /^应用正在运行$/ do
|
4
|
+
macro 'the app is running'
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
# -- Touch --#
|
9
|
+
Then /^I (?:press|touch) on screen (\d+) from the left and (\d+) from the top$/ do |x, y|
|
10
|
+
touch(nil, {:offset => {:x => x.to_i, :y => y.to_i}})
|
11
|
+
sleep(STEP_PAUSE)
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^I (?:press|touch) "([^\"]*)"$/ do |name|
|
15
|
+
touch("view marked:'#{name}'")
|
16
|
+
sleep(STEP_PAUSE)
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^I (?:press|touch) (\d+)% right and (\d+)% down from "([^\"]*)" $/ do |x,y,name|
|
20
|
+
raise "This step is not yet implemented on iOS"
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^I (?:press|touch) button number (\d+)$/ do |index|
|
24
|
+
index = index.to_i
|
25
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
26
|
+
touch("button index:#{index-1}")
|
27
|
+
sleep(STEP_PAUSE)
|
28
|
+
end
|
29
|
+
|
30
|
+
Then /^I (?:press|touch) the "([^\"]*)" button$/ do |name|
|
31
|
+
touch("button marked:'#{name}'")
|
32
|
+
sleep(STEP_PAUSE)
|
33
|
+
end
|
34
|
+
|
35
|
+
Then /^I (?:press|touch) (?:input|text) field number (\d+)$/ do |index|
|
36
|
+
index = index.to_i
|
37
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
38
|
+
touch("textField index:#{index-1}")
|
39
|
+
sleep(STEP_PAUSE)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
Then /^I (?:press|touch) the "([^\"]*)" (?:input|text) field$/ do |name|
|
44
|
+
placeholder_query = "textField placeholder:'#{name}'"
|
45
|
+
marked_query = "textField marked:'#{name}'"
|
46
|
+
if !query(placeholder_query).empty?
|
47
|
+
touch(placeholder_query)
|
48
|
+
elsif !query(marked_query).empty?
|
49
|
+
touch(marked_query)
|
50
|
+
else
|
51
|
+
screenshot_and_raise "could not find text field with placeholder '#{name}' or marked as '#{name}'"
|
52
|
+
end
|
53
|
+
sleep(STEP_PAUSE)
|
54
|
+
end
|
55
|
+
|
56
|
+
#Note in tables views: this means visible cell index!
|
57
|
+
Then /^I (?:press|touch) list item number (\d+)$/ do |index|
|
58
|
+
index = index.to_i
|
59
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
60
|
+
touch("tableViewCell index:#{index-1}")
|
61
|
+
sleep(STEP_PAUSE)
|
62
|
+
end
|
63
|
+
|
64
|
+
Then /^I (?:press|touch) list item "([^\"]*)"$/ do |cell_name|
|
65
|
+
if
|
66
|
+
query("tableViewCell marked:'#{cell_name}'").empty?
|
67
|
+
then
|
68
|
+
touch("tableViewCell text:'#{cell_name}'")
|
69
|
+
else
|
70
|
+
touch("tableViewCell marked:'#{cell_name}'")
|
71
|
+
end
|
72
|
+
sleep(STEP_PAUSE)
|
73
|
+
end
|
74
|
+
|
75
|
+
Then /^I toggle the switch$/ do
|
76
|
+
touch("switch")
|
77
|
+
sleep(STEP_PAUSE)
|
78
|
+
end
|
79
|
+
|
80
|
+
Then /^I toggle the "([^\"]*)" switch$/ do |name|
|
81
|
+
touch("switch marked:'#{name}'")
|
82
|
+
sleep(STEP_PAUSE)
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /^I touch (?:the)? user location$/ do
|
86
|
+
touch("view:'MKUserLocationView'")
|
87
|
+
sleep(STEP_PAUSE)
|
88
|
+
end
|
89
|
+
|
90
|
+
Then /^I (?:touch|press) (?:done|search)$/ do
|
91
|
+
done
|
92
|
+
sleep(STEP_PAUSE)
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
## -- Entering text -- ##
|
97
|
+
|
98
|
+
Then /^I enter "([^\"]*)" into the "([^\"]*)" field$/ do |text_to_type, field_name|
|
99
|
+
touch("textField marked:'#{field_name}'")
|
100
|
+
wait_for_keyboard()
|
101
|
+
keyboard_enter_text text_to_type
|
102
|
+
sleep(STEP_PAUSE)
|
103
|
+
end
|
104
|
+
|
105
|
+
Then /^I enter "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
|
106
|
+
touch("textField marked:'#{field_name}'")
|
107
|
+
wait_for_keyboard()
|
108
|
+
keyboard_enter_text text_to_type
|
109
|
+
sleep(STEP_PAUSE)
|
110
|
+
end
|
111
|
+
|
112
|
+
# alias
|
113
|
+
Then /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |text_field, text_to_type|
|
114
|
+
macro %Q|I enter "#{text_to_type}" into the "#{text_field}" text field|
|
115
|
+
end
|
116
|
+
|
117
|
+
Then /^I use the native keyboard to enter "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
|
118
|
+
macro %Q|I touch the "#{field_name}" text field|
|
119
|
+
wait_for_keyboard()
|
120
|
+
keyboard_enter_text(text_to_type)
|
121
|
+
sleep(STEP_PAUSE)
|
122
|
+
end
|
123
|
+
|
124
|
+
Then /^I fill in text fields as follows:$/ do |table|
|
125
|
+
table.hashes.each do |row|
|
126
|
+
macro %Q|I enter "#{row['text']}" into the "#{row['field']}" text field|
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
Then /^I enter "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text, index|
|
131
|
+
index = index.to_i
|
132
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
133
|
+
touch("textField index:#{index-1}")
|
134
|
+
wait_for_keyboard()
|
135
|
+
keyboard_enter_text text
|
136
|
+
sleep(STEP_PAUSE)
|
137
|
+
end
|
138
|
+
|
139
|
+
Then /^I use the native keyboard to enter "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text_to_type, index|
|
140
|
+
idx = index.to_i
|
141
|
+
macro %Q|I touch text field number #{idx}|
|
142
|
+
wait_for_keyboard()
|
143
|
+
keyboard_enter_text(text_to_type)
|
144
|
+
sleep(STEP_PAUSE)
|
145
|
+
end
|
146
|
+
|
147
|
+
When /^I clear "([^\"]*)"$/ do |name|
|
148
|
+
msg = "When I clear <name>' will be deprecated because it is ambiguous - what should be cleared?"
|
149
|
+
_deprecated('0.9.151', msg, :warn)
|
150
|
+
clear_text("textField marked:'#{name}'")
|
151
|
+
end
|
152
|
+
|
153
|
+
Then /^I clear (?:input|text) field number (\d+)$/ do |index|
|
154
|
+
index = index.to_i
|
155
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
156
|
+
clear_text("textField index:#{index-1}")
|
157
|
+
end
|
158
|
+
|
159
|
+
# -- See -- #
|
160
|
+
Then /^I wait to see "([^\"]*)"$/ do |expected_mark|
|
161
|
+
wait_for(WAIT_TIMEOUT) { view_with_mark_exists( expected_mark ) }
|
162
|
+
end
|
163
|
+
|
164
|
+
Then /^I wait until I don't see "([^\"]*)"$/ do |expected_mark|
|
165
|
+
sleep 1## wait for previous screen to disappear
|
166
|
+
wait_for(WAIT_TIMEOUT) { not element_exists( "view marked:'#{expected_mark}'" )}
|
167
|
+
end
|
168
|
+
|
169
|
+
Then /^I wait to not see "([^\"]*)"$/ do |expected_mark|
|
170
|
+
macro %Q|I wait until I don't see "#{expected_mark}"|
|
171
|
+
end
|
172
|
+
|
173
|
+
Then /^I wait for "([^\"]*)" to appear$/ do |name|
|
174
|
+
macro %Q|I wait to see "#{name}"|
|
175
|
+
end
|
176
|
+
|
177
|
+
Then /^I wait for the "([^\"]*)" button to appear$/ do |name|
|
178
|
+
wait_for(WAIT_TIMEOUT) { element_exists( "button marked:'#{name}'" ) }
|
179
|
+
end
|
180
|
+
|
181
|
+
Then /^I wait to see a navigation bar titled "([^\"]*)"$/ do |expected_mark|
|
182
|
+
msg = "waited for '#{WAIT_TIMEOUT}' seconds but did not see the navbar with title '#{expected_mark}'"
|
183
|
+
wait_for(:timeout => WAIT_TIMEOUT,
|
184
|
+
:timeout_message => msg ) do
|
185
|
+
all_items = query("navigationItemView marked:'#{expected_mark}'")
|
186
|
+
button_items = query("navigationItemButtonView")
|
187
|
+
non_button_items = all_items.delete_if { |item| button_items.include?(item) }
|
188
|
+
!non_button_items.empty?
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
Then /^I wait for the "([^\"]*)" (?:input|text) field$/ do |placeholder_or_view_mark|
|
193
|
+
wait_for(WAIT_TIMEOUT) {
|
194
|
+
element_exists( "textField placeholder:'#{placeholder_or_view_mark}'") ||
|
195
|
+
element_exists( "textField marked:'#{placeholder_or_view_mark}'")
|
196
|
+
}
|
197
|
+
end
|
198
|
+
|
199
|
+
Then /^I wait for (\d+) (?:input|text) field(?:s)?$/ do |count|
|
200
|
+
count = count.to_i
|
201
|
+
wait_for(WAIT_TIMEOUT) { query(:textField).count >= count }
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
Then /^I wait$/ do
|
206
|
+
sleep 2
|
207
|
+
end
|
208
|
+
|
209
|
+
Then /^I wait and wait$/ do
|
210
|
+
sleep 4
|
211
|
+
end
|
212
|
+
|
213
|
+
Then /^I wait and wait and wait...$/ do
|
214
|
+
sleep 10
|
215
|
+
end
|
216
|
+
|
217
|
+
When /^I wait for ([\d\.]+) second(?:s)?$/ do |num_seconds|
|
218
|
+
num_seconds = num_seconds.to_f
|
219
|
+
sleep num_seconds
|
220
|
+
end
|
221
|
+
|
222
|
+
|
223
|
+
Then /^I go back$/ do
|
224
|
+
touch("navigationItemButtonView first")
|
225
|
+
sleep(STEP_PAUSE)
|
226
|
+
end
|
227
|
+
|
228
|
+
Then /^(?:I\s)?take (?:picture|screenshot)$/ do
|
229
|
+
sleep(STEP_PAUSE)
|
230
|
+
screenshot_embed
|
231
|
+
end
|
232
|
+
|
233
|
+
Then /^I swipe (left|right|up|down)$/ do |dir|
|
234
|
+
swipe(dir)
|
235
|
+
sleep(STEP_PAUSE)
|
236
|
+
end
|
237
|
+
|
238
|
+
Then /^I swipe (left|right|up|down) on number (\d+)$/ do |dir, index|
|
239
|
+
index = index.to_i
|
240
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
241
|
+
swipe(dir, {:query => "scrollView index:#{index-1}"})
|
242
|
+
sleep(STEP_PAUSE)
|
243
|
+
end
|
244
|
+
|
245
|
+
Then /^I swipe (left|right|up|down) on number (\d+) at x (\d+) and y (\d+)$/ do |dir, index, x, y|
|
246
|
+
index = index.to_i
|
247
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
248
|
+
swipe(dir, {:offset => {:x => x.to_i, :y => y.to_i}, :query => "scrollView index:#{index-1}"})
|
249
|
+
sleep(STEP_PAUSE)
|
250
|
+
end
|
251
|
+
|
252
|
+
Then /^I swipe (left|right|up|down) on "([^\"]*)"$/ do |dir, mark|
|
253
|
+
swipe(dir, {:query => "view marked:'#{mark}'"})
|
254
|
+
sleep(STEP_PAUSE)
|
255
|
+
end
|
256
|
+
|
257
|
+
Then /^I swipe on cell number (\d+)$/ do |index|
|
258
|
+
index = index.to_i
|
259
|
+
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
|
260
|
+
cell_swipe({:query => "tableViewCell index:#{index-1}"})
|
261
|
+
sleep(STEP_PAUSE)
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
##pinch##
|
266
|
+
Then /^I pinch to zoom (in|out)$/ do |in_out|
|
267
|
+
pinch(in_out)
|
268
|
+
sleep(STEP_PAUSE)
|
269
|
+
end
|
270
|
+
|
271
|
+
Then /^I pinch to zoom (in|out) on "([^\"]*)"$/ do |in_out, name|
|
272
|
+
pinch(in_out,{:query => "view marked:'#{name}'"})
|
273
|
+
sleep(STEP_PAUSE)
|
274
|
+
end
|
275
|
+
|
276
|
+
# Note "up/left/right" seems to be missing on the web base
|
277
|
+
Then /^I scroll (left|right|up|down)$/ do |dir|
|
278
|
+
scroll("scrollView index:0", dir)
|
279
|
+
sleep(STEP_PAUSE)
|
280
|
+
end
|
281
|
+
|
282
|
+
Then /^I scroll (left|right|up|down) on "([^\"]*)"$/ do |dir,name|
|
283
|
+
scroll("view marked:'#{name}'", dir)
|
284
|
+
sleep(STEP_PAUSE)
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
### Playback ###
|
290
|
+
Then /^I playback recording "([^\"]*)"$/ do |filename|
|
291
|
+
playback(filename)
|
292
|
+
sleep(STEP_PAUSE)
|
293
|
+
end
|
294
|
+
|
295
|
+
Then /^I playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
|
296
|
+
playback(filename, {:query => "view marked:'#{name}'"})
|
297
|
+
sleep(STEP_PAUSE)
|
298
|
+
end
|
299
|
+
|
300
|
+
Then /^I playback recording "([^\"]*)" on "([^\"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
|
301
|
+
x = x.to_i
|
302
|
+
y = y.to_i
|
303
|
+
playback(filename, {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y}})
|
304
|
+
sleep(STEP_PAUSE)
|
305
|
+
end
|
306
|
+
|
307
|
+
Then /^I reverse playback recording "([^\"]*)"$/ do |filename|
|
308
|
+
playback(filename, {:reverse => true})
|
309
|
+
sleep(STEP_PAUSE)
|
310
|
+
end
|
311
|
+
|
312
|
+
Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
|
313
|
+
playback(filename, {:query => "view marked:'#{name}'",:reverse => true})
|
314
|
+
sleep(STEP_PAUSE)
|
315
|
+
end
|
316
|
+
|
317
|
+
Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)" with offset (\d+),(\d+)$/ do |filename, name, x, y|
|
318
|
+
x = x.to_i
|
319
|
+
y = y.to_i
|
320
|
+
playback(filename, {:query => "view marked:'#{name}'", :offset => {:x => x, :y => y},:reverse => true})
|
321
|
+
sleep(STEP_PAUSE)
|
322
|
+
end
|
323
|
+
|
324
|
+
|
325
|
+
### Device orientation ###
|
326
|
+
Then /^I rotate device (left|right)$/ do |dir|
|
327
|
+
dir = dir.to_sym
|
328
|
+
rotate(dir)
|
329
|
+
sleep(5)#SERVO wait
|
330
|
+
end
|
331
|
+
|
332
|
+
Then /^I send app to background for (\d+) seconds$/ do |secs|
|
333
|
+
secs = secs.to_f
|
334
|
+
send_app_to_background(secs)
|
335
|
+
sleep(secs+10)
|
336
|
+
end
|
337
|
+
|
338
|
+
### Assertions ###
|
339
|
+
Then /^I should see "([^\"]*)"$/ do |expected_mark|
|
340
|
+
res = (element_exists( "view marked:'#{expected_mark}'" ) or
|
341
|
+
element_exists( "view text:'#{expected_mark}'"))
|
342
|
+
if not res
|
343
|
+
screenshot_and_raise "No element found with mark or text: #{expected_mark}"
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
Then /^I should not see "([^\"]*)"$/ do |expected_mark|
|
348
|
+
res = query("view marked:'#{expected_mark}'")
|
349
|
+
res.concat query("view text:'#{expected_mark}'")
|
350
|
+
unless res.empty?
|
351
|
+
screenshot_and_raise "Expected no element with text nor accessibilityLabel: #{expected_mark}, found #{res.join(", ")}"
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
Then /^I should see a "([^\"]*)" button$/ do |expected_mark|
|
356
|
+
check_element_exists("button marked:'#{expected_mark}'")
|
357
|
+
end
|
358
|
+
Then /^I should not see a "([^\"]*)" button$/ do |expected_mark|
|
359
|
+
check_element_does_not_exist("button marked:'#{expected_mark}'")
|
360
|
+
end
|
361
|
+
|
362
|
+
Then /^I don't see the text "([^\"]*)"$/ do |text|
|
363
|
+
macro %Q|I should not see "#{text}"|
|
364
|
+
end
|
365
|
+
Then /^I don't see the "([^\"]*)"$/ do |text|
|
366
|
+
macro %Q|I should not see "#{text}"|
|
367
|
+
end
|
368
|
+
|
369
|
+
Then /^I see the text "([^\"]*)"$/ do |text|
|
370
|
+
macro %Q|I should see "#{text}"|
|
371
|
+
end
|
372
|
+
Then /^I see the "([^\"]*)"$/ do |text|
|
373
|
+
macro %Q|I should see "#{text}"|
|
374
|
+
end
|
375
|
+
|
376
|
+
Then /^I (?:should)? see text starting with "([^\"]*)"$/ do |text|
|
377
|
+
res = query("view {text BEGINSWITH '#{text}'}").empty?
|
378
|
+
if res
|
379
|
+
screenshot_and_raise "No text found starting with: #{text}"
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
Then /^I (?:should)? see text containing "([^\"]*)"$/ do |text|
|
384
|
+
res = query("view {text LIKE '*#{text}*'}").empty?
|
385
|
+
if res
|
386
|
+
screenshot_and_raise "No text found containing: #{text}"
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
Then /^I (?:should)? see text ending with "([^\"]*)"$/ do |text|
|
391
|
+
res = query("view {text ENDSWITH '#{text}'}").empty?
|
392
|
+
if res
|
393
|
+
screenshot_and_raise "No text found ending with: #{text}"
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
Then /^I see (\d+) (?:input|text) field(?:s)?$/ do |count|
|
398
|
+
count = count.to_i
|
399
|
+
cnt = query(:textField).count
|
400
|
+
if cnt < count
|
401
|
+
screenshot_and_raise "Expected at least #{count} text/input fields, found #{cnt}"
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
Then /^I should see a "([^\"]*)" (?:input|text) field$/ do |expected_mark|
|
406
|
+
res = element_exists("textField placeholder:'#{expected_mark}'") ||
|
407
|
+
element_exists("textField marked:'#{expected_mark}'")
|
408
|
+
unless res
|
409
|
+
screenshot_and_raise "Expected textfield with placeholder or accessibilityLabel: #{expected_mark}"
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
Then /^I should not see a "([^\"]*)" (?:input|text) field$/ do |expected_mark|
|
414
|
+
res = query("textField placeholder:'#{expected_mark}'")
|
415
|
+
res.concat query("textField marked:'#{expected_mark}'")
|
416
|
+
unless res.empty?
|
417
|
+
screenshot_and_raise "Expected no textfield with placeholder nor accessibilityLabel: #{expected_mark}, found #{res}"
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
|
422
|
+
Then /^I should see a map$/ do
|
423
|
+
check_element_exists("view:'MKMapView'")
|
424
|
+
end
|
425
|
+
|
426
|
+
Then /^I should see (?:the)? user location$/ do
|
427
|
+
check_element_exists("view:'MKUserLocationView'")
|
428
|
+
end
|
429
|
+
|
430
|
+
### Date Picker ###
|
431
|
+
|
432
|
+
# time_str can be in any format that Time can parse
|
433
|
+
Then(/^I change the date picker time to "([^"]*)"$/) do |time_str|
|
434
|
+
target_time = Time.parse(time_str)
|
435
|
+
current_date = date_time_from_picker()
|
436
|
+
current_date = DateTime.new(current_date.year,
|
437
|
+
current_date.mon,
|
438
|
+
current_date.day,
|
439
|
+
target_time.hour,
|
440
|
+
target_time.min,
|
441
|
+
0,
|
442
|
+
target_time.gmt_offset)
|
443
|
+
picker_set_date_time current_date
|
444
|
+
sleep(STEP_PAUSE)
|
445
|
+
end
|
446
|
+
|
447
|
+
# date_str can be in any format that Date can parse
|
448
|
+
Then(/^I change the date picker date to "([^"]*)"$/) do |date_str|
|
449
|
+
target_date = Date.parse(date_str)
|
450
|
+
current_time = date_time_from_picker()
|
451
|
+
date_time = DateTime.new(target_date.year,
|
452
|
+
target_date.mon,
|
453
|
+
target_date.day,
|
454
|
+
current_time.hour,
|
455
|
+
current_time.min,
|
456
|
+
0,
|
457
|
+
Time.now.sec,
|
458
|
+
current_time.offset)
|
459
|
+
picker_set_date_time date_time
|
460
|
+
sleep(STEP_PAUSE)
|
461
|
+
end
|
462
|
+
|
463
|
+
# date_str can be in any format that Date can parse
|
464
|
+
Then(/^I change the date picker date to "([^"]*)" at "([^"]*)"$/) do |date_str, time_str|
|
465
|
+
macro %Q|I change the date picker time to "#{time_str}"|
|
466
|
+
macro %Q|I change the date picker date to "#{date_str}"|
|
467
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','..','features','step_definitions',"calabash_steps")
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: calabash-cucumber-ios-cn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Li Jie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: calabash-cucumber
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.168
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.9'
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.168
|
33
|
+
description: Chinese translation of calabash-cucumber.
|
34
|
+
email:
|
35
|
+
- cpunion@gmail.com
|
36
|
+
executables: []
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- Gemfile
|
41
|
+
- LICENSE
|
42
|
+
- README.md
|
43
|
+
- calabash-cucumber-ios-cn.gemspec
|
44
|
+
- features/step_definitions/calabash_steps.rb
|
45
|
+
- lib/calabash-cucumber-ios-cn.rb
|
46
|
+
- lib/calabash-cucumber-ios-cn/calabash_steps.rb
|
47
|
+
- lib/calabash-cucumber-ios-cn/version.rb
|
48
|
+
homepage: http://github.com/cpunion/calabash-cucumber-ios-cn
|
49
|
+
licenses:
|
50
|
+
- BSD
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.2.2
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Chinese translation of calabash-cucumber
|
72
|
+
test_files:
|
73
|
+
- features/step_definitions/calabash_steps.rb
|