effective_test_bot 1.7.9 → 1.8.0

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: 07d35a95259ca95427d9cf3f683b5772f7ead21ddaccfba26db8a0e7e69df241
4
- data.tar.gz: dccee1cb15aa036640ab367a970d3ffe2f2da3b760575c45b8f5127c9dca5f39
3
+ metadata.gz: afe9f3ed70aea09b0e56cc8c1aadf560b15824418d41447528702b379048ca66
4
+ data.tar.gz: 473caac40e0954a3ed0c522779e32d7f81528ba7b76e46f044d8af3773428bd3
5
5
  SHA512:
6
- metadata.gz: 598efc2bc915c67d539e313d29fd4337b33980c3f46265ea02aa095131a5aed6bcaa4583bdef0ae3832632086c9f4b31b973b5742dea4588a12c1d903e99a849
7
- data.tar.gz: be8e0f9f9dda9b884720be5bd38096837b9918af48b948a6c9774162893aa76cf3d45c44f3384eb23dc7fdebe5c613a89523e726d886b7d8a94a8e6f0e088c01
6
+ metadata.gz: c6e24064fe80a3686cee7e8d453ce1dfdc5274f51714e4b1be3545758c7a4cc9bf97171ef6f4a92a9879574079e357d6a592ca48c3804815769e7cfc851b2468
7
+ data.tar.gz: 75946cccfa5261c40eb3761444579b46a2916bf3d95396c05a0ab3165546aa4e7c0fe0a4914d7ddd88cb6e24a3aeba02a698a86971c234b4014aa7731af26b4c
@@ -1,4 +1,4 @@
1
- # Watch for any rails server exceptions and write the stacktrace to ./tmp/test_bot/exception.txt
1
+ # Watch for any rails server exceptions and write the stacktrace to ./tmp/test_bot/exception-PID.txt
2
2
  # This file is checked for by assert_no_exceptions
3
3
 
4
4
  module EffectiveTestBot
@@ -25,7 +25,7 @@ module EffectiveTestBot
25
25
  lines = [exception.message] + exception.backtrace.first(EffectiveTestBot&.backtrace_lines || 10)
26
26
 
27
27
  dir = File.join(Dir.pwd, 'tmp', 'test_bot')
28
- file = File.join(dir, 'exception.txt')
28
+ file = File.join(dir, "exception-#{Process.pid}.txt")
29
29
 
30
30
  Dir.mkdir(dir) unless File.exist?(dir)
31
31
  File.delete(file) if File.exist?(file)
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.7.9'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
@@ -23,7 +23,7 @@ module EffectiveTestBotAssertions
23
23
 
24
24
  def assert_no_exceptions(message: "(no_exceptions) Unexpected rails server exception:\n:exception:")
25
25
  # this file is created by EffectiveTestBot::Middleware when an exception is encountered in the rails app
26
- file = File.join(Dir.pwd, 'tmp', 'test_bot', 'exception.txt')
26
+ file = File.join(Dir.pwd, 'tmp', 'test_bot', "exception-#{Process.pid}.txt")
27
27
  return unless File.exist?(file)
28
28
 
29
29
  exception = File.read(file)
@@ -99,7 +99,8 @@ module EffectiveTestBotAssertions
99
99
 
100
100
  def assert_current_path(path, message: '(current_path) Expected current_path to be :path:')
101
101
  path = public_send(path) if path.kind_of?(Symbol)
102
- assert_equal path, page.current_path, message.sub(':path:', path.to_s)
102
+ assert page.has_current_path?(path), message.sub(':path:', path.to_s)
103
+ wait_for_turbo
103
104
  end
104
105
 
105
106
  # assert_redirect '/about'
@@ -167,6 +167,37 @@ module EffectiveTestBotFormHelper
167
167
  true
168
168
  end
169
169
 
170
+ def submit_helcim_delayed_checkout(success_content: nil)
171
+ # Click Save Card Info button
172
+ within('.effective-helcim-delayed-checkout') { find('a#helcim-delayed-checkout-button').click }
173
+
174
+ # Find the iframe
175
+ helcim_checkout_iframe = find('iframe#helcimPayIframe')
176
+ assert helcim_checkout_iframe.present?, 'unable to find helcim iframe'
177
+
178
+ before_path = page.current_path
179
+
180
+ within_frame(helcim_checkout_iframe) do
181
+ assert_content 'Card number'
182
+ find('input[id=checkout-card-fields__number]').set("4242424242424242")
183
+ find('input[id=checkout-card-fields__expiry-date]').set("12#{Time.zone.now.year - 1999}")
184
+ (find('input[id=checkout-card-fields__security-number]') rescue nil).try(:set, "123")
185
+ find('button.hds-a-button').click
186
+
187
+ assert_no_js_errors
188
+ refute_content 'Payment not completed'
189
+ end
190
+
191
+ # This is a blocking selector that will wait until the page has changed url
192
+ assert_no_current_path(before_path.to_s, wait: Capybara.default_max_wait_time * 10)
193
+
194
+ if success_content
195
+ assert page.has_content?(success_content, wait: Capybara.default_max_wait_time * 10), "#{success_content} not found"
196
+ end
197
+
198
+ true
199
+ end
200
+
170
201
  def submit_moneris_checkout(success_content: nil)
171
202
  moneris_checkout_iframe = find('iframe[id=monerisCheckout-Frame]')
172
203
  assert moneris_checkout_iframe.present?, 'unable to find moneris checkout iframe'
@@ -4,6 +4,19 @@ module EffectiveTestBotTestHelper
4
4
  page.document.find('html')
5
5
  wait_for_ajax
6
6
  wait_for_turbolinks
7
+ wait_for_turbo
8
+ end
9
+
10
+ def wait_for_turbo
11
+ return unless page.evaluate_script('typeof Turbo !== "undefined"')
12
+
13
+ begin
14
+ Timeout.timeout(Capybara.default_max_wait_time * 2) do
15
+ loop until page.evaluate_script("document.querySelector('html[aria-busy=\"true\"], form[aria-busy=\"true\"], turbo-frame[busy]') === null")
16
+ end
17
+ rescue => e
18
+ # Turbo not active or not available, continue
19
+ end
7
20
  end
8
21
 
9
22
  def wait_for_turbolinks
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_test_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.9
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-03-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -163,7 +162,6 @@ homepage: https://github.com/code-and-effect/effective_test_bot
163
162
  licenses:
164
163
  - MIT
165
164
  metadata: {}
166
- post_install_message:
167
165
  rdoc_options: []
168
166
  require_paths:
169
167
  - lib
@@ -178,8 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
176
  - !ruby/object:Gem::Version
179
177
  version: '0'
180
178
  requirements: []
181
- rubygems_version: 3.5.6
182
- signing_key:
179
+ rubygems_version: 4.0.17
183
180
  specification_version: 4
184
181
  summary: A shared library of rails model & system tests that should pass in every
185
182
  Rails application.