test(e2e): stabilize fixture imports

This commit is contained in:
2026-07-03 14:43:45 +08:00
parent 873a0a8bce
commit e22c5dfb78
9 changed files with 20 additions and 19 deletions
@@ -0,0 +1,34 @@
import { expect, test } from "@playwright/test";
import { mockCoreApis } from "@e2e/fixtures/api-mocks";
import {
clearBrowserState,
signInWithEmailAndOpenChat,
} from "@e2e/fixtures/test-helpers";
test.beforeEach(async ({ baseURL, context, page }) => {
await clearBrowserState(context, page, baseURL);
await mockCoreApis(page);
});
test("user can log out from the sidebar after email login", async ({
page,
}) => {
await signInWithEmailAndOpenChat(page);
await expect(page.getByRole("button", { name: "Menu" })).toBeVisible();
await page.getByRole("button", { name: "Menu" }).click();
await expect(page).toHaveURL(/\/sidebar$/);
const logoutRequestPromise = page.waitForRequest("**/api/auth/logout");
await page.getByRole("button", { name: /Log out/i }).click();
const logoutRequest = await logoutRequestPromise;
expect(logoutRequest.method()).toBe("POST");
await expect(page).toHaveURL(/\/splash$/);
await expect(page.getByRole("button", { name: "Skip" })).toBeVisible();
await expect(
page.getByRole("button", { name: "Login with Facebook" }),
).toBeVisible();
});