25 lines
838 B
TypeScript
25 lines
838 B
TypeScript
/** 登录页预填测试账号验证。 */
|
|
|
|
import { test, expect, type Page } from "@playwright/test";
|
|
|
|
test.use({ viewport: { width: 1280, height: 720 } });
|
|
|
|
test("登录页预填演示账号并登录成功", async ({ page }: { page: Page }) => {
|
|
await page.goto("/login");
|
|
await page.waitForLoadState("networkidle");
|
|
|
|
// 验证邮箱和密码已预填
|
|
await expect(page.locator('input[id="email"]')).toHaveValue("gp@demo.com");
|
|
await expect(page.locator('input[id="password"]')).toHaveValue("demo123456");
|
|
|
|
// 验证演示账号提示存在
|
|
await expect(page.getByText("演示账号")).toBeVisible();
|
|
|
|
// 点击登录
|
|
await page.click('button[type="submit"]');
|
|
await expect(page).toHaveURL(/\/dashboard|\/today/);
|
|
|
|
// 验证已登录(侧边栏出现)
|
|
await expect(page.locator("aside")).toBeVisible();
|
|
});
|