cuke_master 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8af6036a448eebd944beec9e0c061fd3d8d0f65
4
- data.tar.gz: 0aa508eb0bce87c6e1f602d70b79cac97dcf53d8
3
+ metadata.gz: 87108075b629af8a0a209c204d1d1f317c187897
4
+ data.tar.gz: a876e27c0f8094ebbd36bad9975bc9e6bf79124c
5
5
  SHA512:
6
- metadata.gz: 0018a501de6217e257277a4b4b7c19440f3051456d8443d60b2373b378911baf6069359b20426cb895eddc6e43bd72caa6a204a1f98948c6f3531774bce26415
7
- data.tar.gz: 4bfb1083980a67426d32f7a521595a99410e38cfd321cfdd078f4805b31ff275d4250b4286430ba54c4939a66656aa4734f42a136632a422faca557ee8cf53ab
6
+ metadata.gz: fd2d0f92cb67b8525fbc342de1f654671af7d142098859aaeea953147f91b7c7c04c1a1ec4fea70cfea52cdeb031953046e89f8441d1f7979e8f8d597d7ce340
7
+ data.tar.gz: 2c74def24ca32dde798eeb39af1c4fdb3a68365ae30402641b98793971dd481d49764256b564e1ffb48f2091fb47b5f4610efdcf23ef96fd5e0ecb46eeb19ffc
@@ -108,6 +108,15 @@ box_attribute_name, box_attribute_value, seeable_content|
108
108
  el.click
109
109
  end
110
110
 
111
+ # 2.9 Click on a special tag with text value
112
+ Then(/^I click on the ([^"]*) "([^"]*)" with text "([^"]*)"$/) \
113
+ do |position, tag, text|
114
+ pos_number = @pos_number[position.to_sym]
115
+ els = all(:xpath, ".//#{tag}[text()='#{text}']")
116
+ el = els[pos_number - 1]
117
+ el.set(value)
118
+ end
119
+
111
120
  # 3. ========= FILL FORM ACTIONS ===========
112
121
  # 3.1 Fill in a text field (given that the text field and the
113
122
  # label are connected)
@@ -171,8 +180,7 @@ end
171
180
 
172
181
  # 3.9 Upload a file
173
182
  When(/^I attach file to "([^"]*)" with "([^"]*)"$/) do |field_name, file_path|
174
- root_folder = File.expand_path('..', File.expand_path(File.dirname(__FILE__)))
175
- root_folder = File.expand_path('..', root_folder)
183
+ root_folder = Dir.pwd
176
184
  attach_file field_name, "#{root_folder}/uploads/#{file_path}"
177
185
  end
178
186
 
@@ -189,8 +197,7 @@ end
189
197
  # 3.11 Upload a file
190
198
  When(/^I attach file to field with attribute "([^"]*)" value "([^"]*)" with \
191
199
  "([^"]*)"$/) do |attribute_name, attribute_value, file_path|
192
- root_folder = File.expand_path('..', File.expand_path(File.dirname(__FILE__)))
193
- root_folder = File.expand_path('..', root_folder)
200
+ root_folder = Dir.pwd
194
201
  page.execute_script \
195
202
  "document
196
203
  .querySelector(
@@ -207,6 +214,15 @@ When(/^I attach file to field with attribute "([^"]*)" value "([^"]*)" with \
207
214
  visible: false
208
215
  end
209
216
 
217
+ # 3.12 Fill in a special tag
218
+ When(/^I fill in ([^"]*) "([^"]*)" with value "([^"]*)"$/) \
219
+ do |position, tag, value|
220
+ pos_number = @pos_number[position.to_sym]
221
+ els = all(:xpath, ".//#{tag}")
222
+ el = els[pos_number - 1]
223
+ el.set(value)
224
+ end
225
+
210
226
  # 4. ========= CHECKING ACTIONS ===========
211
227
  # 4.1 Check what can be seen on the page
212
228
  Then(/^I should see "([^"]*)"$/) do |arg1|
@@ -294,7 +310,7 @@ Transform(/^\[([^"]*)\]$/) do |string|
294
310
  end
295
311
  end
296
312
 
297
- # ============== TRANSFORMING =====================
313
+ # 8.1 Transform date & time
298
314
  Transform(/^([^"]*) from now( with format ([^"]*))?$/) \
299
315
  do |string, _tmp, format|
300
316
  number = string.split(' ')[0]
@@ -304,7 +320,7 @@ do |string, _tmp, format|
304
320
  '%d-%m-%Y'
305
321
  when 'y-m-d'
306
322
  '%Y-%m-%d'
307
- when 'm-d-Y'
323
+ when 'm-d-y'
308
324
  '%m-%d-%Y'
309
325
  else
310
326
  '%d-%m-%Y'
@@ -321,7 +337,7 @@ do |string, _tmp, format|
321
337
  '%d-%m-%Y'
322
338
  when 'y-m-d'
323
339
  '%Y-%m-%d'
324
- when 'm-d-Y'
340
+ when 'm-d-y'
325
341
  '%m-%d-%Y'
326
342
  else
327
343
  '%d-%m-%Y'
@@ -1,3 +1,3 @@
1
1
  module CukeMaster
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Huynh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-14 00:00:00.000000000 Z
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler