45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
// The Lucia project.
|
|
// Copyright 2026-2026 DSP, inc. All rights reserved.
|
|
// Authors:
|
|
// imacat.yang@dsp.im (imacat), 2026/03/22
|
|
|
|
import { test, expect } from "@playwright/test";
|
|
import { loginWithMSW } from "../../helpers";
|
|
|
|
test.describe("Password validation on create account.", () => {
|
|
test.beforeEach(async ({ page, context }) => {
|
|
await loginWithMSW(context);
|
|
await page.goto("/account-admin");
|
|
await expect(page.getByText("Test Admin").first()).toBeVisible();
|
|
});
|
|
|
|
test("When password is too short, confirm button stays disabled.", async ({
|
|
page,
|
|
}) => {
|
|
await page.getByRole("button", { name: "Create New" }).click();
|
|
|
|
await page.locator("#input_account_field").fill("unit-test-0001");
|
|
await page.locator("#input_name_field").fill("unit-test-0001");
|
|
// Password shorter than 6 characters
|
|
await page.locator("#input_first_pwd").fill("aaa");
|
|
|
|
await expect(
|
|
page.getByRole("button", { name: "Confirm" }),
|
|
).toBeDisabled();
|
|
});
|
|
|
|
test("When password meets minimum length, confirm button enables.", async ({
|
|
page,
|
|
}) => {
|
|
await page.getByRole("button", { name: "Create New" }).click();
|
|
|
|
await page.locator("#input_account_field").fill("unit-test-0001");
|
|
await page.locator("#input_name_field").fill("unit-test-0001");
|
|
await page.locator("#input_first_pwd").fill("aaaaaa");
|
|
|
|
await expect(
|
|
page.getByRole("button", { name: "Confirm" }),
|
|
).toBeEnabled();
|
|
});
|
|
});
|