* fix: validate password presence and requirements * chore: add error code for invalid passwords * chore: avoid trimming password * chore: add test for password validation * fix: update password to delete user * fix: create user password following protocol * test: simplify deleteMeHandler password validation tests * fix: address coderabbit * fix: modify login params for failing tests * fix: failing e2e tests --------- Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
28 lines
969 B
TypeScript
28 lines
969 B
TypeScript
import { expect } from "@playwright/test";
|
|
|
|
import { test } from "./lib/fixtures";
|
|
import { submitAndWaitForResponse, getDefaultPassword } from "./lib/testUtils";
|
|
|
|
test.afterEach(({ users }) => users.deleteAll());
|
|
|
|
test.describe("Change Password Test", () => {
|
|
test("change password", async ({ page, users }) => {
|
|
const pro = await users.create();
|
|
const currentPassword = getDefaultPassword(String(pro.username))
|
|
await pro.apiLogin();
|
|
// Go to http://localhost:3000/settings/security
|
|
await page.goto("/settings/security/password");
|
|
|
|
expect(pro.username).toBeTruthy();
|
|
|
|
// Fill form
|
|
await page.locator('[name="oldPassword"]').fill(currentPassword);
|
|
|
|
const $newPasswordField = page.locator('[name="newPassword"]');
|
|
await $newPasswordField.fill(`${pro.username}Aa1111`);
|
|
await submitAndWaitForResponse(page, "/api/trpc/auth/changePassword?batch=1", {
|
|
action: () => page.locator("text=Update").click(),
|
|
});
|
|
});
|
|
});
|