import { expect, test, type Page, type TestInfo } from "@playwright/test"; import { EMPLOYEE, login } from "./helpers/auth"; async function attachScreenshot(page: Page, testInfo: TestInfo, name: string) { await testInfo.attach(name, { body: await page.screenshot({ fullPage: true }), contentType: "image/png", }); } test.describe("visual shell", () => { test("登录页入口布局基线", async ({ page }, testInfo) => { await page.setViewportSize({ width: 1440, height: 1024 }); await page.goto("/login"); await expect(page.getByRole("heading", { name: "登录海音达工作台" })).toBeVisible(); await expect(page.getByText("统一入口").first()).toBeVisible(); await expect(page.getByTestId("login-password-primary-panel")).toBeVisible(); await attachScreenshot(page, testInfo, "login-shell.png"); }); test("登录后壳层布局基线", async ({ page }, testInfo) => { await page.setViewportSize({ width: 1440, height: 1024 }); await login(page, EMPLOYEE); await expect(page.locator("aside")).toBeVisible(); await expect(page.getByTestId("topbar-profile-trigger")).toBeVisible(); await expect(page.locator("aside").getByRole("link", { name: "Portal", exact: true })).toBeVisible(); await expect(page.locator("summary").filter({ hasText: "备用模块" })).toBeVisible(); await attachScreenshot(page, testInfo, "app-shell.png"); }); });