test(e2e): cover registration flow when email confirmation is required

This commit is contained in:
kolaente
2026-08-18 11:30:03 +02:00
parent 595f4c3edc
commit c7535008cf
@@ -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',