From 6437bdb4a33b1ccb649489b0071e5ba4416d5702 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Thu, 29 Oct 2026 19:54:11 -0400 Subject: [PATCH] test(mosaic): wait for the added address's poll in the email link reverification test --- .changeset/mosaic-email-link-flake.md | 2 ++ .../__tests__/user-profile-email-section.feature.test.tsx | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changeset/mosaic-email-link-flake.md diff --git a/.changeset/mosaic-email-link-flake.md b/.changeset/mosaic-email-link-flake.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/mosaic-email-link-flake.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/mosaic/src/features/user-profile/user-profile-email-section/__tests__/user-profile-email-section.feature.test.tsx b/packages/mosaic/src/features/user-profile/user-profile-email-section/__tests__/user-profile-email-section.feature.test.tsx index d28b064404a..a3e88dda51c 100644 --- a/packages/mosaic/src/features/user-profile/user-profile-email-section/__tests__/user-profile-email-section.feature.test.tsx +++ b/packages/mosaic/src/features/user-profile/user-profile-email-section/__tests__/user-profile-email-section.feature.test.tsx @@ -485,11 +485,13 @@ describe('email reverification', () => { const dialog = await screen.findByRole('dialog', { name: 'Verify your email' }); await waitFor(() => expect(dialog).toHaveTextContent('Open the link we sent to new@example.com')); expect(screen.queryByRole('textbox', { name: 'Verification code' })).not.toBeInTheDocument(); - await waitFor(() => expect(poll.requests).toHaveLength(1)); const added = fapi.client.sessions[0]?.user.email_addresses[0]; if (!added) { throw new Error('Expected the new email address'); } + const pollsForAdded = () => + poll.requests.filter(request => new URL(request.url).pathname === `/v1/me/email_addresses/${added.id}`); + await waitFor(() => expect(pollsForAdded()).toHaveLength(1)); verifyEmailOutOfBand(fapi, added.id); poll.release(); await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());