Add Playwright E2E tests replacing Cypress with MSW integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
45
tests/e2e/specs/accountInfo.spec.ts
Normal file
45
tests/e2e/specs/accountInfo.spec.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
// 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("Account Info Modal", () => {
|
||||
test.beforeEach(async ({ page, context }) => {
|
||||
await loginWithMSW(context);
|
||||
await page.goto("/account-admin");
|
||||
await expect(page.getByText("Test Admin").first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("double-click username opens info modal with user data", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.locator(".account-cell").first().dblclick();
|
||||
await expect(page.locator("#modal_container")).toBeVisible();
|
||||
await expect(page.locator("#acct_info_user_name")).toBeVisible();
|
||||
});
|
||||
|
||||
test("info modal shows Account Information header", async ({ page }) => {
|
||||
await page.locator(".account-cell").first().dblclick();
|
||||
await expect(page.locator("#modal_container")).toBeVisible();
|
||||
await expect(page.getByText("Account Information")).toBeVisible();
|
||||
});
|
||||
|
||||
test("info modal shows account visit info", async ({ page }) => {
|
||||
await page.locator(".account-cell").first().dblclick();
|
||||
await expect(page.locator("#modal_container")).toBeVisible();
|
||||
await expect(page.locator("#account_visit_info")).toBeVisible();
|
||||
await expect(
|
||||
page.locator("#account_visit_info"),
|
||||
).toContainText("Account:");
|
||||
});
|
||||
|
||||
test("info modal can be closed via X button", async ({ page }) => {
|
||||
await page.locator(".account-cell").first().dblclick();
|
||||
await expect(page.locator("#modal_container")).toBeVisible();
|
||||
await page.locator('img[alt="X"]').click();
|
||||
await expect(page.locator("#modal_container")).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user