Skip to content

Commit 4eba7d3

Browse files
committed
fix: convert remaining URL preview warning test to fake timer pattern
- The 'shows warning when not configured' test was still using userEvent.type() which jsdom 29.1.1 broke for email inputs - Switch to fireEvent.change() + vi.useFakeTimers() consistent with the other fixed tests in the same describe block - Resolves the last remaining CI failure on PR #992 Refs: #992
1 parent 9129b25 commit 4eba7d3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

frontend/src/pages/__tests__/UsersPage.test.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,18 +563,24 @@ describe('UsersPage', () => {
563563
expect(await screen.findByText('Invite User')).toBeInTheDocument()
564564
await user.click(screen.getByRole('button', { name: /Invite User/i }))
565565

566-
const emailInput = screen.getByPlaceholderText('user@example.com')
567-
await user.type(emailInput, 'test@example.com')
566+
vi.useFakeTimers()
567+
568+
try {
569+
const emailInput = screen.getByPlaceholderText('user@example.com')
570+
fireEvent.change(emailInput, { target: { value: 'test@example.com' } })
571+
572+
await act(async () => {
573+
await vi.advanceTimersByTimeAsync(550)
574+
})
568575

569-
await waitFor(() => {
570576
expect(client.post).toHaveBeenCalledWith('/users/preview-invite-url', { email: 'test@example.com' })
571-
}, { timeout: 2000 })
572577

573-
await waitFor(() => {
574578
// Look for link to system settings
575579
const link = screen.getByRole('link')
576580
expect(link.getAttribute('href')).toContain('/settings/system')
577-
}, { timeout: 2000 })
581+
} finally {
582+
vi.useRealTimers()
583+
}
578584
})
579585

580586
it('does not show preview when email is invalid', async () => {

0 commit comments

Comments
 (0)