From e0609c2b608f306a42c3a893901eb6ab758646a2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 13 Aug 2026 15:23:19 +0000 Subject: [PATCH 1/3] fix: stabilize flaky TransitionCreation submission test 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 Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o --- .../TransitionCreation.test.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx b/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx index bf7134380c..b9b1931131 100644 --- a/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx +++ b/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx @@ -212,14 +212,24 @@ describe('TransitionCreation', () => { await user.type(within(checkDateGroup).getByRole('spinbutton', { name: /day/i }), '15') await user.type(within(checkDateGroup).getByRole('spinbutton', { name: /year/i }), '2026') - await user.click(screen.getByRole('button', { name: /continue/i })) - await waitFor(() => { - expect(defaultProps.onEvent).toHaveBeenCalledWith( - 'transition/created', - expect.objectContaining({ payrollUuid: 'transition-payroll-uuid-1' }), + expect(within(checkDateGroup).getByRole('spinbutton', { name: /year/i })).toHaveAttribute( + 'aria-valuenow', + '2026', ) }) + + await user.click(screen.getByRole('button', { name: /continue/i })) + + await waitFor( + () => { + expect(defaultProps.onEvent).toHaveBeenCalledWith( + 'transition/created', + expect.objectContaining({ payrollUuid: 'transition-payroll-uuid-1' }), + ) + }, + { timeout: 5000 }, + ) }) }) }) From d2f05f5214ecce610d341ca4a95515447a9bc9f5 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 13 Aug 2026 15:30:52 +0000 Subject: [PATCH 2/3] fix: add missing MSW handler for payment configs endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o --- src/test/mocks/apis/company.ts | 9 +++++++++ src/test/mocks/handlers.ts | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/test/mocks/apis/company.ts b/src/test/mocks/apis/company.ts index fe2ff9d13b..dd101063a0 100644 --- a/src/test/mocks/apis/company.ts +++ b/src/test/mocks/apis/company.ts @@ -1,5 +1,6 @@ import { http, HttpResponse } from 'msw' import { API_BASE_URL } from '@/test/constants' +import { getFixture } from '@/test/mocks/fixtures/getFixture' export const getCompany = http.get(`${API_BASE_URL}/v1/companies/:company_id`, ({ params }) => HttpResponse.json({ @@ -108,6 +109,14 @@ export const getIndustrySelection = http.get( }), ) +export const getPaymentConfigs = http.get( + `${API_BASE_URL}/v1/companies/:company_uuid/payment_configs`, + async () => { + const responseFixture = await getFixture('get-v1-companies-company_uuid-payment_configs') + return HttpResponse.json(responseFixture) + }, +) + export const updateIndustrySelection = http.put( `${API_BASE_URL}/v1/companies/:company_id/industry_selection`, async ({ request }) => { diff --git a/src/test/mocks/handlers.ts b/src/test/mocks/handlers.ts index c6a3156c9f..b61b3c6fc2 100644 --- a/src/test/mocks/handlers.ts +++ b/src/test/mocks/handlers.ts @@ -32,6 +32,7 @@ import { getCompany, getCompanyOnboardingStatus, getIndustrySelection, + getPaymentConfigs, updateIndustrySelection, } from './apis/company' import { getEmployeeFederalTaxes, updateEmployeeFederalTaxes } from './apis/employee_federal_taxes' @@ -42,6 +43,7 @@ export const handlers = [ getCompany, getCompanyOnboardingStatus, getIndustrySelection, + getPaymentConfigs, updateIndustrySelection, ...EmployeeHandlers, getEmployeeOnboardingStatus, From 1aa8e758bbd31f022d51e01be8b8571327fd964b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 13 Aug 2026 19:52:14 +0000 Subject: [PATCH 3/3] fix: remove unnecessary extended timeout from TransitionCreation test 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 Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o --- .../TransitionCreation.test.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx b/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx index b9b1931131..123fe2b3ee 100644 --- a/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx +++ b/src/components/Payroll/TransitionCreation/TransitionCreation.test.tsx @@ -221,15 +221,12 @@ describe('TransitionCreation', () => { await user.click(screen.getByRole('button', { name: /continue/i })) - await waitFor( - () => { - expect(defaultProps.onEvent).toHaveBeenCalledWith( - 'transition/created', - expect.objectContaining({ payrollUuid: 'transition-payroll-uuid-1' }), - ) - }, - { timeout: 5000 }, - ) + await waitFor(() => { + expect(defaultProps.onEvent).toHaveBeenCalledWith( + 'transition/created', + expect.objectContaining({ payrollUuid: 'transition-payroll-uuid-1' }), + ) + }) }) }) })