push to maple-street
This commit is contained in:
+14
-20
@@ -1,25 +1,19 @@
|
||||
import { test, expect, type Page } from "@playwright/test";
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { signInAs, BASE } from "./dev";
|
||||
|
||||
const BASE = "http://localhost:3000";
|
||||
const TAB_LABELS = ["Schedule", "Roster", "Training", "Announcements", "Settings"];
|
||||
|
||||
/**
|
||||
* Dev console transport: request a magic link, then complete it in the browser
|
||||
* context so the Auth.js session cookie is set for the navigation under test.
|
||||
*/
|
||||
async function signInAs(page: Page, email: string) {
|
||||
const res = await page.request.post(`${BASE}/api/dev/magic-link`, {
|
||||
data: { email },
|
||||
});
|
||||
expect(res.ok(), "magic-link request should succeed").toBe(true);
|
||||
const body = (await res.json()) as { url?: string };
|
||||
expect(body.url, "magic-link should return a sign-in url").toBeTruthy();
|
||||
await page.goto(body.url!);
|
||||
await expect(page).toHaveURL(/complete/);
|
||||
}
|
||||
const TAB_LABELS = [
|
||||
"Home",
|
||||
"Schedule",
|
||||
"Events",
|
||||
"Media",
|
||||
"Roster",
|
||||
"Training",
|
||||
"Announcements",
|
||||
"Settings",
|
||||
];
|
||||
|
||||
test.describe("app shell", () => {
|
||||
test("renders the shell with 5 nav tabs at a 360px viewport", async ({ page }) => {
|
||||
test("renders the shell with 8 nav tabs at a 360px viewport", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 360, height: 780 });
|
||||
await signInAs(page, `e2e-mobile-${Date.now()}@example.com`);
|
||||
|
||||
@@ -29,7 +23,7 @@ test.describe("app shell", () => {
|
||||
// Header + page title.
|
||||
await expect(page.getByRole("heading", { name: "Schedule", level: 1 })).toBeVisible();
|
||||
|
||||
// Five nav tabs, one per label.
|
||||
// One tab per primary destination.
|
||||
for (const label of TAB_LABELS) {
|
||||
await expect(page.getByRole("link", { name: label, exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user