diff --git a/frontend/tests/e2e/user/email-confirmation.spec.ts b/frontend/tests/e2e/user/email-confirmation.spec.ts index a19ff4b7f..7762376b0 100644 --- a/frontend/tests/e2e/user/email-confirmation.spec.ts +++ b/frontend/tests/e2e/user/email-confirmation.spec.ts @@ -163,3 +163,18 @@ test.describe('Email Confirmation', () => { await expect(page.locator('body')).toContainText(user.username) }) }) + +test.describe('Email change', () => { + test('rejects email change with wrong current password', async ({authenticatedPage: page}) => { + await page.goto('/user/settings/email-update') + await page.locator('#newEmail').fill('new@example.com') + await page.locator('#currentPasswordEmail').fill('WRONG_PASSWORD') + + const resp = page.waitForResponse(r => r.url().includes('/user/settings/email')) + await page.getByRole('button', {name: 'Save'}).last().click() + const r = await resp + expect(r.status()).toBeGreaterThanOrEqual(400) + + await expect(page.locator('.global-notification .vue-notification.error')).toBeVisible() + }) +})