Add Playwright E2E tests replacing Cypress with MSW integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
38
tests/e2e/specs/accountAdmin/editAccount.spec.ts
Normal file
38
tests/e2e/specs/accountAdmin/editAccount.spec.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user