import { test, expect, chromium } from "@playwright/test"; const TEST_USER = { email: "admin@fischer.com", password: "Admin@123", }; test.use({ launchOptions: { executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", }, }); test.describe("登录跳转测试(系统Chrome)", () => { test("登录成功后应跳转到dashboard并保持在dashboard", async ({ page }) => { await page.goto("/login"); await page.locator("#email").fill(TEST_USER.email); await page.locator("#password").fill(TEST_USER.password); await page.getByRole("button", { name: /登录/ }).click(); await expect(page).toHaveURL(/\/dashboard/, { timeout: 15000 }); await page.waitForTimeout(3000); await expect(page).toHaveURL(/\/dashboard/); await expect(page.getByText("Overview", { exact: false })).toBeVisible({ timeout: 10000 }); }); });