Skip to content

test(onboarding): wait for Back button after step change - #1586

Merged
gabrielseco merged 2 commits into
mainfrom
fix/onboarding-flaky-back-button-test
Oct 16, 2026
Merged

gabrielseco merged 2 commits into
mainfrom
fix/onboarding-flaky-back-button-test

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes a flaky Onboarding test that intermittently failed with "Unable to find an accessible element with the role button and name Back".

Why

The test's render prop shows the step heading even while the step is loading. The test treated the heading as "step ready" and looked up the Back button synchronously, so it failed whenever contract details loaded slowly (seen on a full-suite CI run).

What changed

Toggle details

Test-only change in OnboardingFlow.test.tsx: the Back button lookups (including two other step-change tests with the same pattern) in "should call POST /employments when country is changed and basic information is resubmitted" now use findByRole, which waits for the button. No source or public API changes.

Screenshots

N/A

Related Resources

N/A

Testing

Test-only change, so there is no UI to check. The race only shows up under load, so it can't be reproduced on demand. The fix follows from the failing DOM (heading plus spinner, no button). The test passes 3 out of 3 isolated runs.

  • Tested against the example/ app in a browser: N/A
  • Feature flag: N/A

🤖 Generated with Claude Code


Note

Low Risk
Test-only assertion timing changes with no runtime or API impact.

Overview
Fixes flaky Onboarding flow tests that could fail in CI when the step heading appeared before the step UI finished loading.

After navigating to Contract Details (or back to earlier steps), Back button lookups in three tests now use findByText / findByRole instead of synchronous getBy* queries, so the tests wait for the button instead of assuming it is already in the DOM. Test-only change in OnboardingFlow.test.tsx; no production onboarding behavior or API changes.

Reviewed by Cursor Bugbot for commit cf8587b. Bugbot is set up for automated code reviews on this repo. Configure here.

gabrielseco and others added 2 commits October 15, 2026 16:25
The test's render prop draws the step heading outside the loading
check, so findByText on the heading resolves while the spinner is
still showing and the synchronous Back lookup throws when contract
details are slow to load. Use findByRole so it waits for the button.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two more tests looked up the Back button synchronously right after the
Contract Details heading appeared, which has the same race.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 230.8 kB 230.8 kB 0 B (0%) 🟢
Total (raw) 642.63 kB 642.63 kB 0 B (0%) 🟢
CSS (gzip) 21.95 kB 21.95 kB 0 B (0%) 🟢
CSS (raw) 114.51 kB 114.51 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 230.8 kB / 350 kB (65.9%)
  • ✅ Total raw: 642.63 kB / 850 kB (75.6%)
  • ✅ CSS gzipped: 21.95 kB / 25 kB (87.8%)

Largest Files (Top 5)

  1. index.esm-wIkXrqU6.js - 11.4 kB (0 B (0%))
  2. styles.css - 10.97 kB (0 B (0%))
  3. index.css - 10.97 kB (0 B (0%))
  4. internals-BOZceErx.js - 6.13 kB (0 B (0%))
  5. hooks-ThU7CDLI.js - 5.85 kB (0 B (0%))
View All Files (291 total)
File Size (gzip) Change
index.esm-wIkXrqU6.js 11.4 kB 0 B (0%)
styles.css 10.97 kB 0 B (0%)
index.css 10.97 kB 0 B (0%)
internals-BOZceErx.js 6.13 kB 0 B (0%)
hooks-ThU7CDLI.js 5.85 kB 0 B (0%)
sdk.gen-BRPiw4M1.js 5.58 kB 0 B (0%)
index.js 5.51 kB 0 B (0%)
flows/Onboarding/hooks.js 4.67 kB 0 B (0%)
utils-CUgvJHl4.js 4.07 kB 0 B (0%)
FieldSetField-D0HdSLTs.js 4.04 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-pb6cnjn1c-remotecom.vercel.app
Latest Commit:cf8587b

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-p7rdmmzzo-remotecom.vercel.app
Latest Commit:cf8587b

Deployed with vercel-action

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚠️ Coverage decreased

Metric Current Previous Change Status
Lines 89.58% 89.59% -0.02% 🔴
Statements 89.45% 89.47% -0.02% 🔴
Functions 88.48% 88.48% 0% ⚪
Branches 81.21% 81.26% -0.05% 🔴

Detailed Breakdown

Lines Coverage
  • Covered: 5396 / 6024
  • Coverage: 89.58%
  • Change: -0.02% (-1 lines)
Statements Coverage
  • Covered: 5461 / 6105
  • Coverage: 89.45%
  • Change: -0.02% (-1 statements)
Functions Coverage
  • Covered: 1428 / 1614
  • Coverage: 88.48%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3350 / 4125
  • Coverage: 81.21%
  • Change: -0.05% (-2 branches)

✅ Coverage check passed

@gabrielseco
gabrielseco merged commit 3bdda2f into main Oct 16, 2026
22 of 23 checks passed
@gabrielseco
gabrielseco deleted the fix/onboarding-flaky-back-button-test branch October 16, 2026 09:46
@gabrielseco gabrielseco mentioned this pull request Oct 16, 2026
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