You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
1.4 KiB

import { test, expect } from "@playwright/test";
test.describe("冒烟测试", () => {
test("首页可访问", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveURL(/\//);
});
test("登录页可访问", async ({ page }) => {
await page.goto("/auth/login");
await expect(page.locator("#login-username")).toBeVisible();
await expect(page.locator("#login-password")).toBeVisible();
await expect(page.locator("#login-captcha")).toBeVisible();
});
test("注册页可访问", async ({ page }) => {
await page.goto("/auth/register");
await expect(page.locator("#register-username")).toBeVisible();
await expect(page.locator("#register-password")).toBeVisible();
await expect(page.locator("#register-confirm")).toBeVisible();
await expect(page.locator("#register-captcha")).toBeVisible();
});
test("验证码 API 返回固定验证码(E2E 模式)", async ({ request }) => {
const res = await request.get("/api/auth/captcha");
expect(res.ok()).toBeTruthy();
const json = await res.json();
expect(json.data.captchaId).toBeTruthy();
expect(json.data.imageSvg).toContain("e2e fixed captcha");
});
test("全局配置 API 可访问", async ({ request }) => {
const res = await request.get("/api/config/global");
expect(res.ok()).toBeTruthy();
const json = await res.json();
expect(json.data).toBeDefined();
});
});