effective_test_bot 1.2.10 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f117b4980f2edc56c9f3f99922209374ccd851e487fdc8762b80e5f8739069ac
4
- data.tar.gz: cfe4ea65d642ce4c4f0ef9fc909516cb4f3dc426e4aa654c5ca85a8ec9912152
3
+ metadata.gz: 72d97aedd61e58203f074d35ab38312f057420ddb5e1a75dcde2c13e783de46e
4
+ data.tar.gz: 134b31cbf7a3248ff7d50582b3dd1d367f137cbfb84af7087f9028755463b981
5
5
  SHA512:
6
- metadata.gz: 8d90692c2a84642e49d8d07beafb398e9be878ed2d6ce0d0c67f8c5fc599b98fd70348ab1fe7b42912754c11516ca012e8b258470584e7a071ab3279428bbe46
7
- data.tar.gz: 470dcdcdefe2b351f7b76e734bd06b8c9a3b8d59356683c78df84b166fb9f5422feddeab476b0acaac412ea634b6ed210504bfd706e8d3c8819b1a7af1bd58f5
6
+ metadata.gz: 5a3fd6bde458ec79fca2391f8611e407b9c5be23e92af612e3f18ff2d76ceb1005bac62f78ff601685f2a6cafc2915a7e2791ad8f95511942cef9bd11bc0e1d2
7
+ data.tar.gz: e564a1ef8f480e2c12c45123c0684e185569d13809183cee1d5512499ecb76629c9d673e191cd87205b9de1614297bd8d1bb8c497d1ada5ae02203a797fe9d5f
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.2.10'.freeze
2
+ VERSION = '1.3.1'.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)
@@ -29,13 +29,13 @@ module EffectiveTestBotFormFaker
29
29
  when 'input_text'
30
30
  classes = field['class'].to_s.split(' ')
31
31
 
32
- if classes.include?('date') # Let's assume this is a date input.
32
+ if classes.include?('effective_date') || classes.include?('date')
33
33
  if attribute.include?('end') || attribute.include?('expire') # Make sure end dates are after start dates
34
34
  Faker::Date.forward(days: 365).strftime('%Y-%m-%d')
35
35
  else
36
36
  Faker::Date.backward(days: 365).strftime('%Y-%m-%d')
37
37
  end
38
- elsif classes.include?('datetime')
38
+ elsif classes.include?('effective_datetime') || classes.include?('datetime')
39
39
  if attribute.include?('end') || attribute.include?('expire')
40
40
  Faker::Date.forward(days: 365).strftime('%Y-%m-%d %H:%m')
41
41
  else
@@ -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.10
4
+ version: 1.3.1
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-04-29 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails