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 aa2661b556
33 changed files with 2284 additions and 7 deletions

View File

@@ -0,0 +1,56 @@
// 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("Discover page navigation tabs", () => {
test.beforeEach(async ({ page, context }) => {
await loginWithMSW(context);
await page.goto("/files");
await expect(page.getByText("sample-process.xes").first()).toBeVisible();
});
test("Double-clicking a log file enters the MAP page.", async ({
page,
}) => {
await page
.locator("td.fileName", { hasText: "sample-process.xes" })
.dblclick();
await expect(page).toHaveURL(/map/);
// MAP tab should exist in the navbar
await expect(
page.locator(".nav-item", { hasText: "MAP" }),
).toBeVisible();
});
test("Clicking CONFORMANCE tab switches active page.", async ({
page,
}) => {
await page
.locator("td.fileName", { hasText: "sample-process.xes" })
.dblclick();
await expect(page).toHaveURL(/map/);
await page.locator(".nav-item", { hasText: "CONFORMANCE" }).click();
await expect(page).toHaveURL(/conformance/);
await expect(
page.locator(".nav-item", { hasText: "CONFORMANCE" }),
).toHaveClass(/active/);
});
test("Clicking PERFORMANCE tab switches active page.", async ({
page,
}) => {
await page
.locator("td.fileName", { hasText: "sample-process.xes" })
.dblclick();
await expect(page).toHaveURL(/map/);
await page.locator(".nav-item", { hasText: "PERFORMANCE" }).click();
await expect(page).toHaveURL(/performance/);
await expect(
page.locator(".nav-item", { hasText: "PERFORMANCE" }),
).toHaveClass(/active/);
});
});