From c7535008cf1929ccb2b59ff0156bc17ead1fdc30 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 18 Aug 2026 09:53:23 +0200 Subject: [PATCH] test(e2e): cover registration flow when email confirmation is required --- frontend/tests/e2e/user/registration.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/tests/e2e/user/registration.spec.ts b/frontend/tests/e2e/user/registration.spec.ts index 6509f4668..81490c6e7 100644 --- a/frontend/tests/e2e/user/registration.spec.ts +++ b/frontend/tests/e2e/user/registration.spec.ts @@ -30,6 +30,25 @@ test.describe('Registration', () => { await expect(page.locator('main h1')).toContainText(fixture.username) }) + test('Should show a confirmation notice when the email needs to be verified', async ({page}) => { + // e2e API has no mailer, so mock the 412 the auto-login would get + await page.route('**/api/v1/login', route => route.fulfill({ + status: 412, + contentType: 'application/json', + body: JSON.stringify({code: 1012, message: 'Please confirm your email address.'}), + })) + + await page.goto('/register') + await page.locator('#username').fill('unconfirmeduser') + await page.locator('#email').fill('unconfirmed@example.com') + await page.locator('#password').fill('12345678') + await page.locator('#register-submit').click() + + await expect(page.locator('div.message.success')).toContainText('check your inbox') + await expect(page.locator('div.message.danger')).not.toBeVisible() + await expect(page).toHaveURL(/\/register/) + }) + test('Should fail', async ({page, apiContext}) => { const fixture = { username: 'test',