import { test, expect } from './fixtures'; test.describe('Resending your verification email', () => { test('the account page offers it while the address is unverified', async ({ customer, accountModal }) => { await accountModal.open(); await expect(accountModal.dialog.getByText('Email not verified')).toBeVisible(); await expect(accountModal.resendVerificationButton).toBeVisible(); }); test('confirms when it has sent', async ({ page, customer, accountModal }) => { await accountModal.open(); await accountModal.resendVerificationButton.click(); await expect(page.getByText('Check your inbox, and your spam folder.')).toBeVisible(); }); // The message the customer gets on the fourth attempt is the point of the // limiter's copy: it says the mail probably did send and where to look, // rather than only that a limit exists. test('says something useful once the allowance runs out', async ({ page, customer, accountModal }) => { await accountModal.open(); const resend = accountModal.resendVerificationButton; for (let i = 0; i < 3; i++) { await resend.click(); await expect(resend).toBeEnabled(); } await resend.click(); // Matched on the phrase unique to the refusal. "spam folder" appears in the // success message too, and the three stacked success toasts from the loop // above are still on screen, so the looser match finds them instead. await expect(page.getByText(/already sent several/)).toBeVisible(); }); });