Skip to content

Commit 4f2a95d

Browse files
test(mosaic): wait for the added address's poll in the email link reverification test (#10537)
1 parent 7109d2f commit 4f2a95d

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎packages/mosaic/src/features/user-profile/user-profile-email-section/__tests__/user-profile-email-section.feature.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,13 @@ describe('email reverification', () => {
513513
const dialog = await screen.findByRole('dialog', { name: 'Verify your email' });
514514
await waitFor(() => expect(dialog).toHaveTextContent('Open the link we sent to new@example.com'));
515515
expect(screen.queryByRole('textbox', { name: 'Verification code' })).not.toBeInTheDocument();
516-
await waitFor(() => expect(poll.requests).toHaveLength(1));
517516
const added = fapi.client.sessions[0]?.user.email_addresses[0];
518517
if (!added) {
519518
throw new Error('Expected the new email address');
520519
}
520+
const pollsForAdded = () =>
521+
poll.requests.filter(request => new URL(request.url).pathname === `/v1/me/email_addresses/${added.id}`);
522+
await waitFor(() => expect(pollsForAdded()).toHaveLength(1));
521523
verifyEmailOutOfBand(fapi, added.id);
522524
poll.release();
523525
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());

0 commit comments

Comments
 (0)