Add Playwright E2E tests replacing Cypress with MSW integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 16:43:32 +08:00
parent 67a723207f
commit 6e7d010c54
32 changed files with 2276 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
// 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("Delete an Account", () => {
test.beforeEach(async ({ page, context }) => {
await loginWithMSW(context);
await page.goto("/account-admin");
await expect(page.getByText("Test Admin").first()).toBeVisible();
});
test("Delete button opens confirmation modal and deletes on confirm.", async ({
page,
}) => {
await page.locator("img.delete-account").first().click();
await expect(
page.getByText("ARE YOU SURE TO DELETE"),
).toBeVisible();
await page.locator("#sure_to_delete_acct_btn").click();
await expect(page.getByText("Account deleted")).toBeVisible();
});
test("Cancel button closes the delete confirmation modal.", async ({
page,
}) => {
await page.locator("img.delete-account").first().click();
await expect(
page.getByText("ARE YOU SURE TO DELETE"),
).toBeVisible();
await page.locator("#calcel_delete_acct_btn").click();
await expect(
page.getByText("ARE YOU SURE TO DELETE"),
).not.toBeVisible();
});
});