reset/update password
This commit is contained in:
@@ -13,3 +13,33 @@ test("a user can log out", async ({ page }) => {
|
||||
await expect(page).toHaveURL(/\/login/);
|
||||
await expect(page.locator("h1")).toContainText("Welcome back");
|
||||
});
|
||||
|
||||
test("a user can change their password", async ({ page }) => {
|
||||
await registerAndLogin(page, "alice@example.com");
|
||||
await page.goto("/account");
|
||||
await page.fill("#new-password", "a-new-strong-password");
|
||||
await page.fill("#confirm-password", "a-new-strong-password");
|
||||
await page.click('button:has-text("Update password")');
|
||||
await expect(page.locator(".alert-success")).toContainText("updated");
|
||||
|
||||
// The old password no longer works; the new one does.
|
||||
await page.click('button:has-text("Sign out")');
|
||||
await page.fill("#email", "alice@example.com");
|
||||
await page.fill("#password", "a-strong-password");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator(".alert-error")).toContainText("incorrect");
|
||||
|
||||
await page.fill("#email", "alice@example.com");
|
||||
await page.fill("#password", "a-new-strong-password");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL(/\/lists/);
|
||||
});
|
||||
|
||||
test("changing password rejects a mismatched confirmation", async ({ page }) => {
|
||||
await registerAndLogin(page, "alice@example.com");
|
||||
await page.goto("/account");
|
||||
await page.fill("#new-password", "a-new-strong-password");
|
||||
await page.fill("#confirm-password", "a-different-password");
|
||||
await page.click('button:has-text("Update password")');
|
||||
await expect(page.locator(".alert-error")).toContainText("do not match");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user