effective_test_bot 1.2.11 → 1.3.2

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
  SHA256:
3
- metadata.gz: 5a5962e48f7f15a1f1462eb0c29e1feb6b451557b627190c5d789cfe7bfaaab5
4
- data.tar.gz: 0d0745d6d9fa469179d579f24f5bdb0699dd814ed1980e024090b3c8c46535f8
3
+ metadata.gz: cda1c7d4a4f0b934e6baaadf625b2b96f50aab8d65d25b93de93d1635921671b
4
+ data.tar.gz: 526f2651d06a5acb8b44021435d7b1c1b298c4251b3679f6520a38079f605dcd
5
5
  SHA512:
6
- metadata.gz: be710ed13d9985b0b82afe9aa47d51926d8de1468d425929882dd6be0718f74747c178a878f42a98189f2aadaa2bb4c56ac3f9364f0cc1fc9782b080104d30fd
7
- data.tar.gz: b63467149981fde04d4f49ceb8e0d861f88b25815993fbae433ce2a7b305d0cccc695b1452340783a0a3bafd37e762ec796512d7db766c32fe70e1c702661036
6
+ metadata.gz: 71dffce2fc877a2f556719dc645e0bac05818bd91092d47234a08e9580e9a66eaed07173fec548316b51f344aadd3afa7e2ceec8b79a0bb33de3abcf1448f3f0
7
+ data.tar.gz: 1046f829576969f5da11b8e739f4815f25b9d2ca171b470613336ab8497e277de5879d0bd8429046d84d422721093fee6d05c8d6dc1e52e915e96e34b0012265
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.2.11'.freeze
2
+ VERSION = '1.3.2'.freeze
3
3
  end
@@ -84,6 +84,14 @@ module EffectiveTestBotAssertions
84
84
  end
85
85
  end
86
86
 
87
+ def assert_current_path_changed(&block)
88
+ raise('expected a block') unless block_given?
89
+
90
+ before_path = page.current_path
91
+ yield
92
+ assert_no_current_path(before_path)
93
+ end
94
+
87
95
  def assert_page_status(status = 200, message: '(page_status) Expected :status: HTTP status code')
88
96
  return if response_code == nil # This doesn't work well in some drivers
89
97
  assert_equal status, response_code, message.sub(':status:', status.to_s)
@@ -47,7 +47,7 @@ module EffectiveTestBotFormFaker
47
47
  Faker::Internet.email
48
48
  elsif classes.include?('price') || classes.include?('effective_price')
49
49
  4.times.map { DIGITS.sample }.join('') + '.00'
50
- elsif classes.include?('numeric') || classes.include?('effective_number_text') || classes.include?('effective_integer') || attribute.include?('number')
50
+ elsif classes.include?('numeric') || classes.include?('effective_number_text') || classes.include?('effective_integer') || classes.include?('effective_percent') || attribute.include?('number')
51
51
  min = (Float(field['min']) rescue 1)
52
52
  max = (Float(field['max']) rescue 1000)
53
53
  number = Random.new.rand(min..max)
@@ -17,17 +17,27 @@ module EffectiveTestBotFormHelper
17
17
  true
18
18
  end
19
19
 
20
+ def submit_page(label = nil, last: false, assert_path_changed: true, debug: false)
21
+ submit_form(label, last: last, assert_path_changed: assert_path_changed, debug: debug)
22
+ end
23
+
20
24
  # This submits the form, while checking for html5 form validation errors and unpermitted params
21
- def submit_form(label = nil, last: false, debug: false)
25
+ def submit_form(label = nil, last: false, assert_path_changed: false, debug: false)
22
26
  assert_no_html5_form_validation_errors unless test_bot_skip?(:no_html5_form_validation_errors)
23
27
  assert_jquery_ujs_disable_with(label) unless test_bot_skip?(:jquery_ujs_disable_with)
24
28
 
29
+ before_path = page.current_path
30
+ before_path = 'ignore' unless assert_path_changed
31
+
25
32
  if test_bot_skip?(:no_unpermitted_params)
26
33
  click_submit(label, last: last, debug: debug)
27
34
  else
28
35
  with_raised_unpermitted_params_exceptions { click_submit(label, last: last, debug: debug) }
29
36
  end
30
37
 
38
+ # This is a blocking selector that will wait until the page has changed url
39
+ assert_no_current_path(before_path)
40
+
31
41
  assert_no_assigns_errors unless test_bot_skip?(:no_assigns_errors)
32
42
  assert_no_exceptions unless test_bot_skip?(:exceptions)
33
43
  assert_authorization unless test_bot_skip?(:authorization)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_test_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.11
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-06 00:00:00.000000000 Z
11
+ date: 2022-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails