mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-08-31 12:45:51 -05:00
test(e2e): cover registration flow when email confirmation is required
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user