Repository navigation
test(onboarding): wait for Back button after step change - #1586
Merged
Merged
Conversation
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>
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (291 total)
✅ Bundle size check passed |
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Contributor
📊 Coverage Report
|
| 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
jordividaller
approved these changes
Oct 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usefindByRole, 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.
example/app in a browser: 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/findByRoleinstead of synchronousgetBy*queries, so the tests wait for the button instead of assuming it is already in the DOM. Test-only change inOnboardingFlow.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.