Skip to content

test: add payment configs mock handler and improve transition test - #2560

Open
serikjensen wants to merge 3 commits into
mainfrom
claude/flaky-test-investigation-qmv9sd
Open

test: add payment configs mock handler and improve transition test#2560
serikjensen wants to merge 3 commits into
mainfrom
claude/flaky-test-investigation-qmv9sd

Conversation

@serikjensen

Copy link
Copy Markdown
Member

Summary

Adds mock API handler for the payment configs endpoint and improves test reliability in the TransitionCreation component by adding an explicit wait for year input value synchronization.

Changes

  • Added getPaymentConfigs mock handler for GET /v1/companies/:company_uuid/payment_configs endpoint that loads response data from a fixture file
  • Registered the new handler in the mock handlers list
  • Added waitFor assertion in TransitionCreation test to ensure the year spinbutton value is synchronized before proceeding with form submission

Testing

Existing tests pass. The new mock handler is automatically used by tests that call the payment configs endpoint via the mock service worker setup. The TransitionCreation test improvement ensures the year input has the expected value before the continue button is clicked, reducing flakiness from timing issues.

https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o

claude added 3 commits August 13, 2026 15:23
The submission test was intermittently failing on CI because
react-aria DateSegment spinbuttons process keystrokes
asynchronously. Under CI load, the year value had not committed
to react-aria's internal state before the form was submitted,
causing zod validation to reject the null checkDate.

Wait for the year segment's aria-valuenow to settle before
clicking submit, and extend the mutation-completion waitFor
timeout to 5 seconds for slow CI runners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o
The payment_configs endpoint had a fixture file but no MSW
handler, causing unhandled requests to hit the real network
during tests. After a successful mutation, TanStack Query's
global onSuccess awaits invalidateQueries which refetches all
mounted queries — including the unhandled payment_configs
request. The variable network latency caused mutateAsync to
block unpredictably, making any test that submits a form with
useCompanyPaymentSpeed mounted flaky.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o
The 5s timeout was a workaround for the missing MSW handler,
which is now fixed. The default 1000ms waitFor is sufficient
when all queries resolve through MSW.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o
@serikjensen
serikjensen requested a review from a team as a code owner August 13, 2026 20:30
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.

3 participants