Files
cal.diy/apps/web/playwright/change-password.e2e.ts
Anirban SinghaandBandhan Majumder 0d164da8dd fix: implement missing password validation (#27634)
* 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>
2026-06-22 10:37:09 +05:30

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(),
});
});
});