calabash-cucumber-ios-cn 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmJhMDMxYmJkNjNlOThkMjFlZmRhMDI0NzQ4NGNlNjI3ZmE4ODY5Mw==
4
+ ZmFiZDc2YzM1NjQ3ODNhNzg2MGIzZGUwZDU3ZTYwYTI2ZDE3ZjAyMA==
5
5
  data.tar.gz: !binary |-
6
- MTg4ZjM3ZTdkMDFmMGM1ZDdlMGQxOGY2NzkxYWFjZDhlYWMxMzgzZA==
6
+ NzVmYmE5ZmIxZmI5NzNiMGE0ZTIyNGJlZmM1NzExNjIwYWQzMjY4OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGNjMzEwNzI1MzkxMGJhNWM3ZGZlY2EzYTU4MThhMDE3MzY5NWRlNmE0MjE2
10
- MGE2MmY0ZDY3MTg4YjkyNDExMjgzYzRiOWFjOTkzMWFlZDkxMjNlOTc0YmRi
11
- MGM0Mjk2NzZmZGI1NGFmMmU0MmQ1MzU0NDgxNjkyMDExOWNlMjA=
9
+ MmMwNGI0MDQ3NmExOTNlYzIyYjY4OTFiNDEyN2NmN2Q1NzliZGEyY2I0Y2Rk
10
+ OTJmMTAyYzA5ODY1NWRlM2YyMDc5OWQ3N2RiYWE3MzFjZWY5Y2JhMTU1ZWEy
11
+ NzBhNzI5Y2NmMjA0NmUxZjFmODYzNDU5ZTBmMjVmMmY5MTIzMGE=
12
12
  data.tar.gz: !binary |-
13
- ZTRmNTdlMDA5NTNmNGU0ZWMyZGE2NzRlNWRlNDZiNGUzOTg4ZWM5MzkzOGY2
14
- ZDM5YmU0MzdjNWNiMjgzYjYzMzlhZTVhMzU1ZTUzNzRiMGI2OTIzODE2YTJj
15
- MjBlMTE3ZWRlNzdjMGQ2Y2U1ZTllNDAzODg0ZjdhYjViYTI3NTY=
13
+ NmQzNDUyZWYzZTdhYmE4M2IxMzY5MGZmNWE2Y2E0MzA1Y2QzYTkwOGEzODYy
14
+ OTE4YWRjMDEzMWE2ODI2YWFjY2ZhMTlmOWUyNjFiNDQzN2Q1ZTFmYmZhMTll
15
+ ZGIzY2M4NGIyMDhkYmE4ODIwNWY0MmFlYmZiZmRiOGFiNzljYjA=
@@ -1,467 +1,323 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  Given /^应用正在运行$/ do
4
- macro 'the app is running'
4
+ macro %Q|the app is running|
5
5
  end
6
6
 
7
-
8
7
  # -- 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)
8
+ Then /^我点按屏幕左(\d+)(\d+)$/ do |x, y|
9
+ macro %Q|I press on screen #{x} from the left and #{y} from the top|
12
10
  end
13
11
 
14
- Then /^I (?:press|touch) "([^\"]*)"$/ do |name|
15
- touch("view marked:'#{name}'")
16
- sleep(STEP_PAUSE)
12
+ Then /^我点按"([^\"]*)"$/ do |name|
13
+ macro %Q|I press "#{name}"|
17
14
  end
18
15
 
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"
16
+ Then /^我点按"([^\"]*)"右(\d+)%下(\d+)$/ do |x,y,name|
17
+ macro %Q|I press #{x}% right and #{y}% down from "#{name}"|
21
18
  end
22
19
 
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)
20
+ Then /^我点按第(\d+)个按钮$/ do |index|
21
+ macro %Q|I press button number #{index}|
28
22
  end
29
23
 
30
- Then /^I (?:press|touch) the "([^\"]*)" button$/ do |name|
31
- touch("button marked:'#{name}'")
32
- sleep(STEP_PAUSE)
24
+ Then /^我点按"([^\"]*)"按钮$/ do |name|
25
+ macro %Q|I press the "#{name}" button|
33
26
  end
34
27
 
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)
28
+ Then /^我点按第(\d+)个文本框$/ do |index|
29
+ macro %Q|I press text field number #{index}|
40
30
  end
41
31
 
42
32
 
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)
33
+ Then /^我点按文本框"([^\"]*)"$/ do |name|
34
+ macro %Q|I press the "#{name}" text field|
54
35
  end
55
36
 
56
37
  #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)
38
+ Then /^我点按第(\d+)个列表项$/ do |index|
39
+ macro %Q|I press list item number #{index}|
62
40
  end
63
41
 
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)
42
+ Then /^我点按列表项"([^\"]*)"$/ do |cell_name|
43
+ macro %Q|I press list item "#{cell_name}"|
73
44
  end
74
45
 
75
- Then /^I toggle the switch$/ do
76
- touch("switch")
77
- sleep(STEP_PAUSE)
46
+ Then /^我切换开关$/ do
47
+ macro %Q|I toggle the switch|
78
48
  end
79
49
 
80
- Then /^I toggle the "([^\"]*)" switch$/ do |name|
81
- touch("switch marked:'#{name}'")
82
- sleep(STEP_PAUSE)
50
+ Then /^我切换"([^\"]*)"开关$/ do |name|
51
+ macro %Q|I toggle the "#{name}" switch|
83
52
  end
84
53
 
85
- Then /^I touch (?:the)? user location$/ do
86
- touch("view:'MKUserLocationView'")
87
- sleep(STEP_PAUSE)
54
+ Then /^我点按用户的位置$/ do
55
+ macro %Q|I touch the user location|
88
56
  end
89
57
 
90
- Then /^I (?:touch|press) (?:done|search)$/ do
91
- done
92
- sleep(STEP_PAUSE)
58
+ Then /^我点按(?:完成|搜索|done|search)$/ do
59
+ macro %Q|I touch done|
93
60
  end
94
61
 
95
62
 
96
63
  ## -- Entering text -- ##
97
64
 
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)
65
+ Then /^我在"([^\"]*)"中输入"([^\"]*)"$/ do |text_to_type, field_name|
66
+ macro %Q|I enter "#{text_to_type}" into the "#{field_name}" field|
103
67
  end
104
68
 
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)
69
+ Then /^我在文本框"([^\"]*)"中输入"([^\"]*)"$/ do |text_to_type, field_name|
70
+ macro %Q|I enter "#{text_to_type}" into the "#{field_name}" text field|
110
71
  end
111
72
 
112
73
  # 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|
74
+ Then /^我在"([^\"]*)"中填写"([^\"]*)"$/ do |text_field, text_to_type|
75
+ macro %Q|I fill in "#{text_field}" with "#{text_to_type}"|
115
76
  end
116
77
 
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)
78
+ Then /^我用软键盘输入"([^\"]*)""([^\"]*)"文本框$/ do |text_to_type, field_name|
79
+ macro %Q|I use the native keyboard to enter "#{text_to_type}" into the "#{field_name}" text field|
122
80
  end
123
81
 
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
82
+ Then /^我在文本框中填写:$/ do |table|
83
+ step %Q|I fill in text fields as follows:|, table
128
84
  end
129
85
 
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)
86
+ Then /^我在第(\d+)个文本框中输入"([^\"]*)"$/ do |text, index|
87
+ macro %Q|I enter "#{text}" into text field number #{index}|
137
88
  end
138
89
 
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)
90
+ Then /^我用软键盘在第(\d+)个文本框中输入"([^\"]*)"$/ do |text_to_type, index|
91
+ macro %Q|I use the native keyboard to enter "#{text_to_type}" into text field number #{index}|
145
92
  end
146
93
 
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}'")
94
+ When /^我清除"([^\"]*)"$/ do |name|
95
+ macro %Q|I clear "#{name}"|
151
96
  end
152
97
 
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}")
98
+ Then /^我清除第(\d+)个文本框$/ do |index|
99
+ macro %Q|I clear text field number #{index}|
157
100
  end
158
101
 
159
102
  # -- 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}'" )}
103
+ Then /^我等到看见"([^\"]*)"$/ do |expected_mark|
104
+ macro %Q|I wait to see "#{expected_mark}"|
167
105
  end
168
106
 
169
- Then /^I wait to not see "([^\"]*)"$/ do |expected_mark|
170
- macro %Q|I wait until I don't see "#{expected_mark}"|
107
+ Then /^我等到看不见"([^\"]*)"$/ do |expected_mark|
108
+ macro %Q|I wait until I don't see "#{expected_mark}|
171
109
  end
172
110
 
173
- Then /^I wait for "([^\"]*)" to appear$/ do |name|
174
- macro %Q|I wait to see "#{name}"|
111
+ Then /^我等到"([^\"]*)"出现$/ do |name|
112
+ macro %Q|I wait for "#{name}" to appear|
175
113
  end
176
114
 
177
- Then /^I wait for the "([^\"]*)" button to appear$/ do |name|
178
- wait_for(WAIT_TIMEOUT) { element_exists( "button marked:'#{name}'" ) }
115
+ Then /^我等到"([^\"]*)"按钮出现$/ do |name|
116
+ macro %Q|I wait for the "#{name}" button to appear|
179
117
  end
180
118
 
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
119
+ Then /^我等到看见标题是"([^\"]*)"的导航条$/ do |expected_mark|
120
+ macro %Q|I wait to see a navigation bar titled "#{expected_mark}"|
190
121
  end
191
122
 
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
- }
123
+ Then /^我等待"([^\"]*)"文本框$/ do |placeholder_or_view_mark|
124
+ macro %Q|I wait for the "#{placeholder_or_view_mark}" text field|
197
125
  end
198
126
 
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 }
127
+ Then /^我等待(\d+)个文本框$/ do |count|
128
+ macro %Q|I wait for #{count} text field|
202
129
  end
203
130
 
204
131
 
205
- Then /^I wait$/ do
206
- sleep 2
132
+ Then /^我等$/ do
133
+ macro %Q|I wait|
207
134
  end
208
135
 
209
- Then /^I wait and wait$/ do
210
- sleep 4
136
+ Then /^我等啊等$/ do
137
+ macro %Q|I wait and wait|
211
138
  end
212
139
 
213
- Then /^I wait and wait and wait...$/ do
214
- sleep 10
140
+ Then /^我等啊等啊等...$/ do
141
+ macro %Q|I wait and wait and wait...|
215
142
  end
216
143
 
217
- When /^I wait for ([\d\.]+) second(?:s)?$/ do |num_seconds|
218
- num_seconds = num_seconds.to_f
219
- sleep num_seconds
144
+ When /^我等([\d\.]+)秒$/ do |num_seconds|
145
+ macro %Q|I wait for #{num_seconds} seconds|
220
146
  end
221
147
 
222
148
 
223
- Then /^I go back$/ do
224
- touch("navigationItemButtonView first")
225
- sleep(STEP_PAUSE)
149
+ Then /^我后退$/ do
150
+ macro %Q|I go back|
226
151
  end
227
152
 
228
- Then /^(?:I\s)?take (?:picture|screenshot)$/ do
229
- sleep(STEP_PAUSE)
230
- screenshot_embed
153
+ Then /^(?:我)?截屏$/ do
154
+ macro %Q|I take screenshot|
231
155
  end
232
156
 
233
- Then /^I swipe (left|right|up|down)$/ do |dir|
234
- swipe(dir)
235
- sleep(STEP_PAUSE)
157
+ DIRs = {"左" => "left", "右" => "right", "上" => "up", "下" => "down"}
158
+
159
+ Then /^我向(左|右|上|下)划$/ do |dir|
160
+ dir = DIRs[dir]
161
+ macro %Q|I swipe #{dir}|
236
162
  end
237
163
 
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)
164
+ Then /^我向(左|右|上|下)划第(\d+)个$/ do |dir, index|
165
+ dir = DIRs[dir]
166
+ macro %Q|I swipe #{dir} on number #{index}|
243
167
  end
244
168
 
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)
169
+ Then /^我向(左|右|上|下)划第(\d+)个的x:(\d+),y:(\d+)$/ do |dir, index, x, y|
170
+ dir = DIRs[dir]
171
+ macro %Q|I swipe #{dir} on number #{index} at x #{x} and y #{y}|
250
172
  end
251
173
 
252
- Then /^I swipe (left|right|up|down) on "([^\"]*)"$/ do |dir, mark|
253
- swipe(dir, {:query => "view marked:'#{mark}'"})
254
- sleep(STEP_PAUSE)
174
+ Then /^我在"([^\"]*)"上向(左|右|上|下)划$/ do |dir, mark|
175
+ dir = DIRs[dir]
176
+ macro %Q|I swipe #{dir} on "#{mark}"|
255
177
  end
256
178
 
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)
179
+ Then /^我划动第(\d+)个格子$/ do |index|
180
+ macro %Q|I swipe on cell number #{index}|
262
181
  end
263
182
 
264
183
 
265
184
  ##pinch##
266
- Then /^I pinch to zoom (in|out)$/ do |in_out|
267
- pinch(in_out)
268
- sleep(STEP_PAUSE)
185
+ Then /^我双指(放大|缩小)$/ do |in_out|
186
+ in_out = in_out == "放大" and "in" or "out"
187
+ macro %Q|I pinch to zoom #{in_out}|
269
188
  end
270
189
 
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)
190
+ Then /^我在"([^\"]*)"上双指(放大|缩小)$/ do |name, in_out|
191
+ in_out = in_out == "放大" and "in" or "out"
192
+ macro %Q|I pinch to zoom #{in_out} on "#{name}"|
274
193
  end
275
194
 
276
195
  # 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)
196
+ Then /^我向(上|下|左|右)滚动$/ do |dir|
197
+ dir = DIRs[dir]
198
+ macro %Q|I scroll #{dir}|
280
199
  end
281
200
 
282
- Then /^I scroll (left|right|up|down) on "([^\"]*)"$/ do |dir,name|
283
- scroll("view marked:'#{name}'", dir)
284
- sleep(STEP_PAUSE)
201
+ Then /^我在"([^\"]*)"上向(上|下|左|右)滚动$/ do |name, dir|
202
+ dir = DIRs[dir]
203
+ macro %Q|I scroll #{dir} on "#{name}"|
285
204
  end
286
205
 
287
206
 
288
207
 
289
208
  ### Playback ###
290
- Then /^I playback recording "([^\"]*)"$/ do |filename|
291
- playback(filename)
292
- sleep(STEP_PAUSE)
209
+ Then /^我回放记录"([^\"]*)"$/ do |filename|
210
+ macro %Q|I playback recording "#{filename}"|
293
211
  end
294
212
 
295
- Then /^I playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
296
- playback(filename, {:query => "view marked:'#{name}'"})
297
- sleep(STEP_PAUSE)
213
+ Then /^我在"([^\"]*)"上回放记录"([^\"]*)"$/ do |name, filename|
214
+ macro %Q|I playback recording "#{filename}" on "#{name}"|
298
215
  end
299
216
 
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)
217
+ Then /^我在"([^\"]*)"上回放记录"([^\"]*)",偏移(\d+),(\d+)$/ do |name, filename, x, y|
218
+ macro %Q|I playback recording "#{filename}" on "#{name}" with offset #{x},#{y}|
305
219
  end
306
220
 
307
- Then /^I reverse playback recording "([^\"]*)"$/ do |filename|
308
- playback(filename, {:reverse => true})
309
- sleep(STEP_PAUSE)
221
+ Then /^我反向回放记录"([^\"]*)"$/ do |filename|
222
+ macro %Q|I reverse playback recording "#{filename}"|
310
223
  end
311
224
 
312
- Then /^I reverse playback recording "([^\"]*)" on "([^\"]*)"$/ do |filename, name|
313
- playback(filename, {:query => "view marked:'#{name}'",:reverse => true})
314
- sleep(STEP_PAUSE)
225
+ Then /^我在"([^\"]*)"上反向回放记录"([^\"]*)"$/ do |name, filename|
226
+ macro %Q|I reverse playback recording "#{filename}" on "#{name}"|
315
227
  end
316
228
 
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)
229
+ Then /^我在"([^\"]*)"上反向回放记录"([^\"]*)",偏移(\d+),(\d+)$/ do |name, filename, x, y|
230
+ macro %Q|I reverse playback recording "#{filename}" on "#{name}" with offset #{x},#{y}|
322
231
  end
323
232
 
324
233
 
325
234
  ### Device orientation ###
326
- Then /^I rotate device (left|right)$/ do |dir|
327
- dir = dir.to_sym
328
- rotate(dir)
329
- sleep(5)#SERVO wait
235
+ Then /^我向(左|右)旋转设备$/ do |dir|
236
+ dir = DIRs[dir]
237
+ macro %Q|I rotate device #{dir}|
330
238
  end
331
239
 
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)
240
+ Then /^我把应用切到后台(\d+)秒$/ do |secs|
241
+ macro %Q|I send app to background for #{secs} seconds|
336
242
  end
337
243
 
338
244
  ### 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
245
+ Then /^我应该看到"([^\"]*)"$/ do |expected_mark|
246
+ macro %Q|I should see "#{expected_mark}"|
345
247
  end
346
248
 
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
249
+ Then /^我应该看不到"([^\"]*)"$/ do |expected_mark|
250
+ macro %Q|I should not see "#{expected_mark}"|
353
251
  end
354
252
 
355
- Then /^I should see a "([^\"]*)" button$/ do |expected_mark|
356
- check_element_exists("button marked:'#{expected_mark}'")
253
+ Then /^我应该看到"([^\"]*)"按钮$/ do |expected_mark|
254
+ macro %Q|I should see a "#{expected_mark}" button|
357
255
  end
358
- Then /^I should not see a "([^\"]*)" button$/ do |expected_mark|
359
- check_element_does_not_exist("button marked:'#{expected_mark}'")
256
+ Then /^我应该看不到"([^\"]*)"按钮$/ do |expected_mark|
257
+ macro %Q|I should not see a "#{expected_mark}" button|
360
258
  end
361
259
 
362
- Then /^I don't see the text "([^\"]*)"$/ do |text|
363
- macro %Q|I should not see "#{text}"|
260
+ Then /^我看不到文字"([^\"]*)"$/ do |text|
261
+ macro %Q|I don't see the text "#{text}"|
364
262
  end
365
- Then /^I don't see the "([^\"]*)"$/ do |text|
366
- macro %Q|I should not see "#{text}"|
263
+ Then /^我看不到"([^\"]*)"$/ do |text|
264
+ macro %Q|I don't see the "#{text}"|
367
265
  end
368
266
 
369
- Then /^I see the text "([^\"]*)"$/ do |text|
370
- macro %Q|I should see "#{text}"|
267
+ Then /^我看到文字"([^\"]*)"$/ do |text|
268
+ macro %Q|I see the text "#{text}"|
371
269
  end
372
- Then /^I see the "([^\"]*)"$/ do |text|
373
- macro %Q|I should see "#{text}"|
270
+ Then /^我看到"([^\"]*)"$/ do |text|
271
+ macro %Q|I see the "#{text}"|
374
272
  end
375
273
 
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
274
+ Then /^我应该看到以"([^\"]*)"开头的文字$/ do |text|
275
+ macro %Q|I should see text starting with "#{text}"|
381
276
  end
382
277
 
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
278
+ Then /^我应该看到包含"([^\"]*)"的文字$/ do |text|
279
+ macro %Q|I should see text containing "#{text}"|
388
280
  end
389
281
 
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
282
+ Then /^我应该看到以"([^\"]*)"结尾的文字$/ do |text|
283
+ macro %Q|I should see text ending with "#{text}"|
395
284
  end
396
285
 
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
286
+ Then /^我看到(\d+)个文本框$/ do |count|
287
+ macro %Q|I see #{count} text fields|
403
288
  end
404
289
 
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
290
+ Then /^我应该看到"([^\"]*)"文本框$/ do |expected_mark|
291
+ macro %Q|I should see a "#{expected_mark}" text field|
411
292
  end
412
293
 
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
294
+ Then /^我应该看不到"([^\"]*)"文本框$/ do |expected_mark|
295
+ macro %Q|I should not see a "#{expected_mark}" text field|
419
296
  end
420
297
 
421
298
 
422
- Then /^I should see a map$/ do
423
- check_element_exists("view:'MKMapView'")
299
+ Then /^我应该看到地图$/ do
300
+ macro %Q|I should see a map|
424
301
  end
425
302
 
426
- Then /^I should see (?:the)? user location$/ do
427
- check_element_exists("view:'MKUserLocationView'")
303
+ Then /^我应该看到用户的位置$/ do
304
+ macro %Q|I should see the user location|
428
305
  end
429
306
 
430
307
  ### Date Picker ###
431
308
 
432
309
  # 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)
310
+ Then(/^我修改日期选择器的时间为"([^"]*)"$/) do |time_str|
311
+ macro %Q|I change the date picker time to "#{time_str}"|
445
312
  end
446
313
 
447
314
  # 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)
315
+ Then(/^我修改日期选择器的日期为"([^"]*)"$/) do |time_str|
316
+ macro %Q|I change the date picker date to "#{date_str}"|
461
317
  end
462
318
 
463
319
  # 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|
320
+ Then(/^我修改日期选择器日期为"([^"]*)",时间为"([^"]*)"$/) do |date_str, time_str|
465
321
  macro %Q|I change the date picker time to "#{time_str}"|
466
322
  macro %Q|I change the date picker date to "#{date_str}"|
467
323
  end
@@ -2,8 +2,8 @@ module Calabash
2
2
  module Cucumber
3
3
  module IOS
4
4
  module CN
5
- VERSION = '0.0.1'
6
- FRAMEWORK_VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
+ FRAMEWORK_VERSION = '0.0.2'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber-ios-cn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Li Jie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-05 00:00:00.000000000 Z
11
+ date: 2014-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: calabash-cucumber