Skip to content

test: wait for the new page after forms that redirect to the same URL - #155

Merged
RenzoMinelli merged 1 commit into
masterfrom
rm--retry-detached-node-errors
Sep 25, 2026
Merged

RenzoMinelli merged 1 commit into
masterfrom
rm--retry-detached-node-errors

Conversation

@RenzoMinelli

@RenzoMinelli RenzoMinelli commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What: Adds click_button_and_wait_for_page_load, which clicks and waits until performance.timeOrigin changes. Six system specs whose form redirects back to the same URL use it. A failed 2FA attempt re-renders at the POST URL, so that spec now asserts the real path.

Why: have_current_path passes before the new page loads when the URL doesn't change. Any query during the page swap can then hit an open ChromeDriver bug, which Capybara does not retry.

How it works: performance.timeOrigin is the time the browser started loading the current page, so every new page has a different value. The helper reads it, clicks, then uses Capybara's synchronize to retry the check until the value changes. Browser errors during the page swap are retried inside that wait.

Evidence:

How to test: CI is green.

@RenzoMinelli
RenzoMinelli marked this pull request as draft September 25, 2026 19:04
@RenzoMinelli
RenzoMinelli force-pushed the rm--retry-detached-node-errors branch from 2c03777 to cdd87fa Compare September 25, 2026 19:20
@RenzoMinelli RenzoMinelli changed the title test: retry ChromeDriver's detached-node error in system specs test: wait for the new page after forms that redirect to the same URL Sep 25, 2026
Base automatically changed from rm--pin-json-for-rails-7 to master September 25, 2026 19:43
`have_current_path` passes before the navigation starts when the target
URL equals the current one, so the next query could hit a node from the
old page and fail with ChromeDriver's detached-node error. The helper
clicks and waits until `performance.timeOrigin` changes.

Waiting exposed that a failed 2FA attempt re-renders at the POST URL
instead of redirecting, so that spec now asserts the real path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RenzoMinelli
RenzoMinelli force-pushed the rm--retry-detached-node-errors branch from cdd87fa to fe6beef Compare September 25, 2026 19:50
@RenzoMinelli
RenzoMinelli marked this pull request as ready for review September 25, 2026 19:52
@RenzoMinelli
RenzoMinelli force-pushed the rm--retry-detached-node-errors branch from fe6beef to 8deb78d Compare September 25, 2026 19:56
@RenzoMinelli RenzoMinelli changed the title test: wait for the new page after forms that redirect to the same URL test: assert the destination text before the path after same-URL redirects Sep 25, 2026
@RenzoMinelli
RenzoMinelli force-pushed the rm--retry-detached-node-errors branch from 8deb78d to fe6beef Compare September 25, 2026 20:18
@RenzoMinelli RenzoMinelli changed the title test: assert the destination text before the path after same-URL redirects test: wait for the new page after forms that redirect to the same URL Sep 25, 2026
@RenzoMinelli
RenzoMinelli merged commit c51f7ac into master Sep 25, 2026
93 checks passed
@RenzoMinelli
RenzoMinelli deleted the rm--retry-detached-node-errors branch September 25, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants