effective_test_bot 1.2.9 → 1.3.0

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: 0f3d9ab3cddaef1ad1ee91873759222b6a546f519e02217a741b4f16179bd1c4
4
- data.tar.gz: 7c633130bc82e1e5fac09a5bf5cf8411dc8a3c3889b5af22c5ef1e8e56a4b4a3
3
+ metadata.gz: 26e683262e1566595e1354fb38ab178e36763c50edf3a6f5d9bca647bd8df76e
4
+ data.tar.gz: 52edb3cf280a5f1ae143e34394ded8fdf5aab19e021ba4bb8c1f2a41d53ffcbf
5
5
  SHA512:
6
- metadata.gz: 7d17817f9ba053c08e510e1d76630b029d1f62cc02b1d93b9502cb2edf61259f2906ccc90afe0c3791d6b083f98f56b7b0aaa68a170a7dae6d1c9c7f7c9c9490
7
- data.tar.gz: b596f08ecad87dad7a9cc71695352c85cdb6ef7b633a12e142f2123f256c2952fe84e3c92e4dd1519a4bc54ecf704982c60037b44627842e47cf97bedcd3b3a5
6
+ metadata.gz: a68273a9574c1fa18e73a73af64988a1e42889599f6b3389919ea2789d226357def3aa77090cbd87ff2db6650052bc872ac5665f300d942c18628501c425c876
7
+ data.tar.gz: 45a472ed4d6750c0c00d968927a4d864365468e0934062caa4e5c041b3da2209779f320601169f4926ce02c1d3dbb00e08d746862d6112ee68ca6eca9f7f350e
@@ -3,15 +3,15 @@ module EffectiveTestBot
3
3
  engine_name 'effective_test_bot'
4
4
 
5
5
  config.autoload_paths += Dir[
6
- "#{config.root}/test/test_botable/",
7
- "#{config.root}/test/concerns/",
8
- "#{config.root}/test/support/"
6
+ "#{config.root}/test/test_botable",
7
+ "#{config.root}/test/concerns",
8
+ "#{config.root}/test/support"
9
9
  ]
10
10
 
11
11
  config.eager_load_paths += Dir[
12
- "#{config.root}/test/test_botable/",
13
- "#{config.root}/test/concerns/",
14
- "#{config.root}/test/support/"
12
+ "#{config.root}/test/test_botable",
13
+ "#{config.root}/test/concerns",
14
+ "#{config.root}/test/support"
15
15
  ]
16
16
 
17
17
  # Set up our default configuration options.
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.2.9'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
@@ -84,7 +84,16 @@ 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')
96
+ return if response_code == nil # This doesn't work well in some drivers
88
97
  assert_equal status, response_code, message.sub(':status:', status.to_s)
89
98
  end
90
99
 
@@ -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
@@ -18,16 +18,21 @@ module EffectiveTestBotFormHelper
18
18
  end
19
19
 
20
20
  # This submits the form, while checking for html5 form validation errors and unpermitted params
21
- def submit_form(label = nil, last: false, debug: false)
21
+ def submit_form(label = nil, last: false, assert_path_changed: true, debug: false)
22
22
  assert_no_html5_form_validation_errors unless test_bot_skip?(:no_html5_form_validation_errors)
23
23
  assert_jquery_ujs_disable_with(label) unless test_bot_skip?(:jquery_ujs_disable_with)
24
24
 
25
+ before_path = page.current_path
26
+
25
27
  if test_bot_skip?(:no_unpermitted_params)
26
28
  click_submit(label, last: last, debug: debug)
27
29
  else
28
30
  with_raised_unpermitted_params_exceptions { click_submit(label, last: last, debug: debug) }
29
31
  end
30
32
 
33
+ # This is a blocking selector that will wait until the page has changed url
34
+ assert_no_current_path(before_path) if assert_path_changed
35
+
31
36
  assert_no_assigns_errors unless test_bot_skip?(:no_assigns_errors)
32
37
  assert_no_exceptions unless test_bot_skip?(:exceptions)
33
38
  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.9
4
+ version: 1.3.0
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: 2021-10-20 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