cuke_master 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cuke_master.gemspec +1 -1
- data/lib/cuke_master/steps.rb +60 -60
- data/lib/cuke_master/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f2e8ff127cde47995c9573bc5dcca1a509b724c
|
4
|
+
data.tar.gz: c1faf7735e4afa8361dd1086a2feda300297abdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1c05e6e566132b843729396fa87f0ec7f8b524fb033c506690ba818bebf66841a29e279a1c0ea9dea1c151ecbb71c98d24eeb21cb4f8b9b0e8078868efe7844
|
7
|
+
data.tar.gz: 1640c5ef5af1952d32a1ba384b6bdbdd72d667f408f200cc56651942a9e875975438c3534279981048ccecf85312e5a60cf90a31c33f4980f19f83c356cdfa80
|
data/cuke_master.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
spec.add_dependency 'capybara', '~> 2.14'
|
33
33
|
spec.add_dependency 'capybara-screenshot', '~> 1.0'
|
34
|
-
spec.add_dependency 'cucumber', '~>
|
34
|
+
spec.add_dependency 'cucumber', '~> 2.4'
|
35
35
|
spec.add_dependency 'minitest', '~> 5.8'
|
36
36
|
spec.add_dependency 'selenium-webdriver', '~> 3.4'
|
37
37
|
spec.add_dependency 'activesupport', '~> 5.1'
|
data/lib/cuke_master/steps.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
+
# rubocop:disable Lint/Debugger, HandleExceptions
|
1
2
|
# rubocop:disable BlockLength
|
2
|
-
# rubocop:disable LineLength
|
3
3
|
require 'securerandom'
|
4
4
|
|
5
5
|
# 1. ========= BROWSE ACTIONS ===========
|
@@ -307,6 +307,19 @@ Then(/^I should see tag "([^"]*)" with content "([^"]*)"$/) do |tag, content|
|
|
307
307
|
assert page.has_selector?(tag, text: content, visible: true)
|
308
308
|
end
|
309
309
|
|
310
|
+
# 4.3 Check checkbox checked value
|
311
|
+
# I should see tag "div" with attribute "id" filled in "james"
|
312
|
+
Then(/^I should see tag "([^"]*)" with attribute "([^"]*)" \
|
313
|
+
filled with "([^"]*)" has attribute "([^"]*)" filled with "([^"]*)"$/) \
|
314
|
+
do |tag, attr_name, attr_value, attr2_name, attr2_value|
|
315
|
+
Capybara.ignore_hidden_elements = false
|
316
|
+
el = first(:xpath, ".//#{tag}[@#{attr_name}='#{attr_value}']")
|
317
|
+
Capybara.ignore_hidden_elements = true
|
318
|
+
assert !el.nil?
|
319
|
+
|
320
|
+
assert el[attr2_name] == attr2_value
|
321
|
+
end
|
322
|
+
|
310
323
|
# 5. ========= MISC ACTIONS ===========
|
311
324
|
# 5.1 Pause
|
312
325
|
Then(/^pause for ([^"]*) seconds$/) do |duration|
|
@@ -376,64 +389,51 @@ value "([^"]*)"$/) do |name, tag, attribute, value|
|
|
376
389
|
end
|
377
390
|
|
378
391
|
# ============== TRANSFORMING =====================
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
string
|
388
|
-
end
|
389
|
-
}
|
390
|
-
)
|
392
|
+
Transform(/^\[([^"]*)\]$/) do |string|
|
393
|
+
val = instance_variable_get("@#{string}")
|
394
|
+
if val
|
395
|
+
val
|
396
|
+
else
|
397
|
+
string
|
398
|
+
end
|
399
|
+
end
|
391
400
|
|
392
401
|
# 8.1 Transform date & time
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
)
|
432
|
-
|
433
|
-
ParameterType(
|
434
|
-
name: 'order',
|
435
|
-
regexp: /^(first|second|third|fourth|fifth) last$/,
|
436
|
-
transformer: lambda { |string|
|
437
|
-
"#{string}_last"
|
438
|
-
}
|
439
|
-
)
|
402
|
+
Transform(/^([^"]*) from now( with format ([^"]*))?$/) \
|
403
|
+
do |string, _tmp, format|
|
404
|
+
number = string.split(' ')[0]
|
405
|
+
unit = string.split(' ')[1]
|
406
|
+
date_format = case format
|
407
|
+
when 'd-m-y'
|
408
|
+
'%d-%m-%Y'
|
409
|
+
when 'y-m-d'
|
410
|
+
'%Y-%m-%d'
|
411
|
+
when 'm-d-y'
|
412
|
+
'%m-%d-%Y'
|
413
|
+
else
|
414
|
+
'%d-%m-%Y'
|
415
|
+
end
|
416
|
+
(Date.today + number.to_i.send(unit)).strftime(date_format)
|
417
|
+
end
|
418
|
+
|
419
|
+
Transform(/^([^"]*) prior to now( with format ([^"]*))?$/) \
|
420
|
+
do |string, _tmp, format|
|
421
|
+
number = string.split(' ')[0]
|
422
|
+
unit = string.split(' ')[1]
|
423
|
+
date_format = case format
|
424
|
+
when 'd-m-y'
|
425
|
+
'%d-%m-%Y'
|
426
|
+
when 'y-m-d'
|
427
|
+
'%Y-%m-%d'
|
428
|
+
when 'm-d-y'
|
429
|
+
'%m-%d-%Y'
|
430
|
+
else
|
431
|
+
'%d-%m-%Y'
|
432
|
+
end
|
433
|
+
(Date.today - number.to_i.send(unit)).strftime(date_format)
|
434
|
+
end
|
435
|
+
|
436
|
+
Transform(/^(first|second|third|fourth|fifth) last$/) \
|
437
|
+
do |string|
|
438
|
+
"#{string}_last"
|
439
|
+
end
|
data/lib/cuke_master/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Huynh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '2.4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '2.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|