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