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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0db0c057627b41fecc8c63b1b50c6bf68da0b382
4
- data.tar.gz: e9bda2e32756d756636454703d77152d74ff192b
3
+ metadata.gz: 1f2e8ff127cde47995c9573bc5dcca1a509b724c
4
+ data.tar.gz: c1faf7735e4afa8361dd1086a2feda300297abdf
5
5
  SHA512:
6
- metadata.gz: bdf5113f6d9adaa557fe88533b123ff0e7e87824805a1f30fb7645796c946ea61d59f2041b83ed073a894b840a98eca9acba1dbd56d16a6607ba8cd711893f57
7
- data.tar.gz: 22eeb41345514aaabd48cab63785450b1aa33e7aa2af30f2cfecdb6c72d32527170d78489605577f7555306ecb4592ee4edc15965e21d2604c96126c5445c1fa
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', '~> 3.1.0'
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'
@@ -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
- ParameterType(
380
- name: 'variable',
381
- regexp: /^\[([^"]*)\]$/,
382
- transformer: lambda { |string|
383
- val = instance_variable_get("@#{string.gsub(/\]|\[/, '')}")
384
- if val
385
- val
386
- else
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
- 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
- )
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
@@ -1,3 +1,3 @@
1
1
  module CukeMaster
2
- VERSION = '0.1.11'.freeze
2
+ VERSION = '0.1.12'.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.11
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-20 00:00:00.000000000 Z
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: 3.1.0
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: 3.1.0
82
+ version: '2.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement