Skip to content

test(onboarding): fix flaky SaveDraftButton advance test - #1567

Merged
remotecom merged 1 commit into
mainfrom
test/onboarding-save-draft-flaky
Oct 14, 2026
Merged

remotecom merged 1 commit into
mainfrom
test/onboarding-save-draft-flaky

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes a flaky unit test that intermittently fails the "Generate Base Coverage" CI job. No product code changes.

Why

SaveDraftButton > should not advance to next step when save draft is clicked failed once in CI (run, PR #1566) and passed on retry. The final assertion ran before the flow finished reloading, so it saw only the loading spinner.

What changed

Toggle details
  • After onSuccess fires, the new employment is fetched and isLoading briefly flips back to true, so the render prop returns the spinner.
  • The last assertion used a synchronous getByText, which raced that window.
  • It now uses await findByText for the Basic Information step, and also asserts Step: Contract Details is not rendered, so the test still proves the flow didn't advance.
  • Test-only change; no public API impact.

Screenshots

N/A

Related Resources

Testing

  • Ran SaveDraftButton.test.tsx 3 times locally: 12/12 passing each time.
  • The race only reproduces under CI load, so I couldn't make the old assertion fail locally. The fix is justified by the failing CI DOM (spinner only) rather than a local red/green revert.
  • Tested against the example/ app in a browser: N/A (test-only)
  • Feature flag: N/A

🤖 Generated with Claude Code


Note

Low Risk
Test-only assertion timing change with no production code or API impact.

Overview
Stabilizes the Save Draft onboarding test that checks the flow does not advance after a successful draft save.

The final check now waits for Step: Basic Information with findByText instead of a synchronous getByText, so it no longer races the brief loading state after onSuccess when the employment is refetched. It also asserts Contract Details is absent, preserving the “stay on the same step” intent.

Test-only change; no production behavior updates.

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

Wait for the step to reappear after save draft succeeds instead of
asserting synchronously, and assert Contract Details is not shown.

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.55 kB 230.55 kB 0 B (0%) 🟢
Total (raw) 642.09 kB 642.09 kB 0 B (0%) 🟢
CSS (gzip) 21.94 kB 21.94 kB 0 B (0%) 🟢
CSS (raw) 114.43 kB 114.43 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 230.55 kB / 350 kB (65.9%)
  • ✅ Total raw: 642.09 kB / 850 kB (75.5%)
  • ✅ CSS gzipped: 21.94 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-D6148AAY.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-D6148AAY.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-QbfQb5Lp.js 4.04 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

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-70l1drna6-remotecom.vercel.app
Latest Commit:1d9b5a9

Deployed with vercel-action

@github-actions

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

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

Deployed with vercel-action

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 89.58% 89.58% 0% ⚪
Statements 89.46% 89.46% 0% ⚪
Functions 88.47% 88.47% 0% ⚪
Branches 81.21% 81.21% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 5393 / 6020
  • Coverage: 89.58%
  • Change: 0% (0 lines)
Statements Coverage
  • Covered: 5458 / 6101
  • Coverage: 89.46%
  • Change: 0% (0 statements)
Functions Coverage
  • Covered: 1427 / 1613
  • Coverage: 88.47%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3345 / 4119
  • Coverage: 81.21%
  • Change: 0% (0 branches)

✅ Coverage check passed

@remotecom
remotecom merged commit fcff57f into main Oct 14, 2026
14 checks passed
@remotecom
remotecom deleted the test/onboarding-save-draft-flaky branch October 14, 2026 16:26
@gabrielseco gabrielseco mentioned this pull request Oct 14, 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