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());