cuke_master 0.1.15 → 0.1.16

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: 6ba5282c27de89cfa50c4db4c2b789b7b9057b40
4
- data.tar.gz: d794bcc1ca5b5f177fe096db2d23ade38c74c061
3
+ metadata.gz: 971c757c7e64ebb51a6f5ab24a5fbff0f5285342
4
+ data.tar.gz: a5a96e16f7e92f902103937ca19e20ba7c2f31af
5
5
  SHA512:
6
- metadata.gz: 68c3121b9266a07580f7c335682e10157dfa71388bd9e6729b6e4a0d8cb70e7ff757636f043304cb611fa7e94c3da292bf56999faef1e55b2a7ffef38b575adc
7
- data.tar.gz: 7f6d233d60ef5e1a518ebed2e84de4b8c3009e1ad7b010afda219acfa45562d00483b487dd4aa6155d53421b9c9f3ab2d64662db3cfd3061177ee7bfe189144e
6
+ metadata.gz: d189fdb3c62a2676aad00c9699ff67f8806a409b2cc1b7fb641850fd02d3679dd38c6b200e885596c815865519cdf8d9adca9592794678051b2fcf3106400490
7
+ data.tar.gz: cd3207393e5023e12517fdb3e3d16673c53c96c744017284b9650732a75ea71cd290cbdb5330a0e1a260c07a847448a432f8906c736b651df8284fa6fa6c6980
@@ -1,5 +1,4 @@
1
- # rubocop:disable Lint/Debugger, HandleExceptions
2
- # rubocop:disable BlockLength
1
+
3
2
  require 'securerandom'
4
3
 
5
4
  # 1. ========= BROWSE ACTIONS ===========
@@ -298,47 +297,60 @@ end
298
297
 
299
298
  # 4. ========= CHECKING ACTIONS ===========
300
299
  # 4.1 Check what can be seen on the page
301
- Then(/^I should see "([^"]*)"$/) do |arg1|
302
- assert page.has_content?(arg1)
300
+ Then(/^I should (not )?see "([^"]*)"$/) do |not_word, arg1|
301
+ assert page.has_content?(arg1) != (not_word.try(:strip) == 'not')
303
302
  end
304
303
 
305
304
  # 4.2 Advanced checking of content based on html tag
306
- Then(/^I should see tag "([^"]*)" with content "([^"]*)"$/) do |tag, content|
307
- assert page.has_selector?(tag, text: content, visible: true)
305
+ Then(/^I should (not )?see tag "([^"]*)" with content "([^"]*)"$/) \
306
+ do |not_word, tag, content|
307
+ assert \
308
+ page.has_selector?(tag, text: content, visible: true) \
309
+ != (not_word.try(:strip) == 'not')
308
310
  end
309
311
 
310
312
  # 4.3 Check for attribute name vs value
311
313
  # I should see tag "div" with attribute "id" filled in "james"
312
- Then(/^I should see tag "([^"]*)" with attribute "([^"]*)" \
314
+ Then(/^I should (not )?see tag "([^"]*)" with attribute "([^"]*)" \
313
315
  filled with "([^"]*)" has attribute "([^"]*)" filled with "([^"]*)"$/) \
314
- do |tag, attr_name, attr_value, attr2_name, attr2_value|
316
+ do |not_word, tag, attr_name, attr_value, attr2_name, attr2_value|
315
317
  Capybara.ignore_hidden_elements = false
316
318
  el = first(:xpath, ".//#{tag}[@#{attr_name}='#{attr_value}']")
317
319
  Capybara.ignore_hidden_elements = true
318
- assert !el.nil?
319
-
320
- assert el[attr2_name] == attr2_value
320
+ if not_word.try(:strip) != 'not'
321
+ assert !el.nil?
322
+ assert el[attr2_name] == attr2_value
323
+ else
324
+ assert el.nil? || el[attr2_name] != attr2_value
325
+ end
321
326
  end
322
327
 
323
328
  # 4.4 Check for checked checkbox
324
329
  # I should see tag "div" with attribute "id" filled in "james"
325
- Then(/^I should see checkbox with attribute "([^"]*)" \
330
+ Then(/^I should (not )?see checkbox with attribute "([^"]*)" \
326
331
  filled with "([^"]*)" "([^"]*)"$/) \
327
- do |attr_name, attr_value, checked_cond|
332
+ do |not_word, attr_name, attr_value, checked_cond|
328
333
  Capybara.ignore_hidden_elements = false
329
334
  el = first(:xpath, ".//input[@#{attr_name}='#{attr_value}']")
330
335
  Capybara.ignore_hidden_elements = true
331
- assert !el.nil?
332
-
333
- assert el.checked? == (checked_cond == 'checked')
336
+ if not_word.try(:strip) != 'not'
337
+ assert !el.nil?
338
+ assert el.checked? == (checked_cond == 'checked')
339
+ else
340
+ assert el.nil? || el.checked? != (checked_cond == 'checked')
341
+ end
334
342
  end
335
343
 
336
344
  # 4.5 Check for checked checkbox
337
345
  # I should see "hello" "6" times
338
- Then(/^I should see "([^"]*)" "([^"]*)" time\(s\)$/) \
339
- do |text, number_of_times|
346
+ Then(/^I should (not )?see "([^"]*)" "([^"]*)" time\(s\)$/) \
347
+ do |not_word, text, number_of_times|
340
348
  el = all(:xpath, ".//*[contains(text(), '#{text}')]")
341
- assert el.length == number_of_times.to_i
349
+ if not_word.try(:strip) != 'not'
350
+ assert el.length == number_of_times.to_i
351
+ else
352
+ assert el.length != number_of_times.to_i
353
+ end
342
354
  end
343
355
 
344
356
  # 5. ========= MISC ACTIONS ===========
@@ -1,3 +1,3 @@
1
1
  module CukeMaster
2
- VERSION = '0.1.15'.freeze
2
+ VERSION = '0.1.16'.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.15
4
+ version: 0.1.16
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-24 00:00:00.000000000 Z
11
+ date: 2018-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler