cuke_master 0.1.7 → 0.1.8
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 +4 -4
- data/lib/cuke_master/steps.rb +64 -54
- data/lib/cuke_master/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16be9a7ced714bfa403092481c1d9cf15f9252a
|
4
|
+
data.tar.gz: 70fbf52ddebf07dac599c75184be59e2264b4232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc5e84e3be35ce15db21dbca7b06e5b2095d37fc4123264f6f9957f655bd400b2bf626ee3abd65e6b7c0a32399aac948b123e0cdb3cfb134cc19b04a47d7eed
|
7
|
+
data.tar.gz: ca15e65626f2ba82733316b619e35d1e294906a071647aab09e3e39dde2019b70c53d022e0d47fee9f66df68635353c7cb9031fc33a7e391b2fdcc5a9bc1d741
|
data/lib/cuke_master/steps.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# rubocop:disable Lint/Debugger, HandleExceptions
|
2
1
|
# rubocop:disable BlockLength
|
2
|
+
# rubocop:disable LineLength
|
3
3
|
require 'securerandom'
|
4
4
|
|
5
5
|
# 1. ========= BROWSE ACTIONS ===========
|
@@ -32,14 +32,14 @@ end
|
|
32
32
|
# 2.1 Click on a button or a link
|
33
33
|
When(/^I click on "([^"]*)"$/) do |content|
|
34
34
|
el = first(:xpath, ".//*[contains(text(), '#{content}')]")
|
35
|
-
el
|
35
|
+
el ||= first(:xpath, ".//*[@value='#{content}']")
|
36
36
|
el.click
|
37
37
|
end
|
38
38
|
|
39
39
|
# 2.2 Click on a button (in case you have a link with the same display)
|
40
40
|
When(/^I click on button "([^"]*)"$/) do |content|
|
41
41
|
el = first(:xpath, ".//button[contains(text(), '#{content}')]")
|
42
|
-
el
|
42
|
+
el ||= first(:xpath, ".//input[@value='#{content}']")
|
43
43
|
el.click
|
44
44
|
end
|
45
45
|
|
@@ -58,10 +58,8 @@ When(/^I click on "([^"]*)" with attribute "([^"]*)" value "([^"]*)"$/) \
|
|
58
58
|
do |content, attribute, attribute_value|
|
59
59
|
el = first(:xpath, ".//*[contains(text(), '#{content}') and \
|
60
60
|
contains(@#{attribute}, '#{attribute_value}')]")
|
61
|
-
|
62
|
-
el = first(:xpath, ".//input[@value='#{content}' and \
|
61
|
+
el ||= first(:xpath, ".//input[@value='#{content}' and \
|
63
62
|
contains(@#{attribute}, '#{attribute_value}')]")
|
64
|
-
end
|
65
63
|
el.click
|
66
64
|
end
|
67
65
|
|
@@ -96,8 +94,7 @@ end
|
|
96
94
|
When(/^I click on the ([^"]*) "([^"]*)" with attribute "([^"]*)" value \
|
97
95
|
"([^"]*)" within the same box as "([^"]*)" with attribute "([^"]*)" value \
|
98
96
|
"([^"]*)" as "([^"]*)"$/) \
|
99
|
-
do |position, tag, attribute, attribute_value, box_tag,
|
100
|
-
box_attribute_name, box_attribute_value, seeable_content|
|
97
|
+
do |position, tag, attribute, attribute_value, box_tag, box_attribute_name, box_attribute_value, seeable_content|
|
101
98
|
parent_el =
|
102
99
|
find(:xpath,
|
103
100
|
".//#{box_tag}[contains(@#{box_attribute_name}, \
|
@@ -379,51 +376,64 @@ value "([^"]*)"$/) do |name, tag, attribute, value|
|
|
379
376
|
end
|
380
377
|
|
381
378
|
# ============== TRANSFORMING =====================
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
379
|
+
ParameterType(
|
380
|
+
name: 'variable',
|
381
|
+
regexp: /^\[([^"]*)\]$/,
|
382
|
+
transformer: lambda { |string|
|
383
|
+
val = instance_variable_get("@#{string}")
|
384
|
+
if val
|
385
|
+
val
|
386
|
+
else
|
387
|
+
string
|
388
|
+
end
|
389
|
+
}
|
390
|
+
)
|
390
391
|
|
391
392
|
# 8.1 Transform date & time
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
end
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
'
|
420
|
-
|
421
|
-
'
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
393
|
+
ParameterType(
|
394
|
+
name: 'date',
|
395
|
+
regexp: /^([^"]*) from now( with format ([^"]*))?$/,
|
396
|
+
transformer: lambda { |string, format|
|
397
|
+
number = string.split(' ')[0]
|
398
|
+
unit = string.split(' ')[1]
|
399
|
+
date_format = case format
|
400
|
+
when 'd-m-y'
|
401
|
+
'%d-%m-%Y'
|
402
|
+
when 'y-m-d'
|
403
|
+
'%Y-%m-%d'
|
404
|
+
when 'm-d-y'
|
405
|
+
'%m-%d-%Y'
|
406
|
+
else
|
407
|
+
'%d-%m-%Y'
|
408
|
+
end
|
409
|
+
(Date.today + number.to_i.send(unit)).strftime(date_format)
|
410
|
+
}
|
411
|
+
)
|
412
|
+
|
413
|
+
ParameterType(
|
414
|
+
name: 'date_before',
|
415
|
+
regexp: /^([^"]*) prior to now( with format ([^"]*))?$/,
|
416
|
+
transformer: lambda { |string, format|
|
417
|
+
number = string.split(' ')[0]
|
418
|
+
unit = string.split(' ')[1]
|
419
|
+
date_format = case format
|
420
|
+
when 'd-m-y'
|
421
|
+
'%d-%m-%Y'
|
422
|
+
when 'y-m-d'
|
423
|
+
'%Y-%m-%d'
|
424
|
+
when 'm-d-y'
|
425
|
+
'%m-%d-%Y'
|
426
|
+
else
|
427
|
+
'%d-%m-%Y'
|
428
|
+
end
|
429
|
+
(Date.today - number.to_i.send(unit)).strftime(date_format)
|
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
|
+
)
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Huynh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.6.11
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Cuke Master Steps
|