feat(frontend): prefill demo credentials on login page + E2E test passed
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/** 登录页预填测试账号验证。 */
|
||||
|
||||
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();
|
||||
});
|
||||
Reference in New Issue
Block a user