Files
lucia-frontend/tests/e2e/specs/accountAdmin/editAccount.spec.ts
2026-03-22 18:52:18 +08:00

39 lines
1.2 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";
const MODAL_TITLE_ACCOUNT_EDIT = "Account Edit";
const MSG_ACCOUNT_EDITED = "Saved";
test.describe("Edit an account", () => {
test.beforeEach(async ({ page, context }) => {
await loginWithMSW(context);
await page.goto("/account-admin");
await expect(page.getByText("Test Admin").first()).toBeVisible();
});
test("Edit an account; modify name and see saved message.", async ({
page,
}) => {
await page.locator(".btn-edit").first().click();
await expect(
page.locator("h1", { hasText: MODAL_TITLE_ACCOUNT_EDIT }),
).toBeVisible();
await page.locator("#input_name_field").clear();
await page.locator("#input_name_field").fill("Updated Name");
await expect(
page.getByRole("button", { name: "Confirm" }),
).toBeVisible();
await expect(
page.getByRole("button", { name: "Confirm" }),
).toBeEnabled();
await page.getByRole("button", { name: "Confirm" }).click();
await expect(page.getByText(MSG_ACCOUNT_EDITED)).toBeVisible();
});
});