f7a720204a
- 移除 GovAI, nomifun-tauri, 算力盒子 的 submodule 引用 - 添加所有子项目的完整源代码 - 保留原始 .git 为 .git.bak 备份
24 lines
865 B
TypeScript
24 lines
865 B
TypeScript
import { test as setup, expect } from "@playwright/test";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
|
|
const AUTH_FILE = path.join(__dirname, ".auth", "state.json");
|
|
|
|
setup("登录法制日报账号并保存会话", async ({ page }) => {
|
|
fs.mkdirSync(path.dirname(AUTH_FILE), { recursive: true });
|
|
|
|
await page.goto("/login");
|
|
|
|
await expect(page.locator("#org")).toBeVisible({ timeout: 30_000 });
|
|
|
|
await page.locator("#org").selectOption("a0000000-0000-0000-0000-00000000000a");
|
|
await page.fill("#email", "fazhiribao@govai.gov.cn");
|
|
await page.fill("#password", "admin123");
|
|
|
|
await page.getByRole("button", { name: /登\s*录/ }).click();
|
|
|
|
await page.waitForURL(/\/store/, { timeout: 30_000 });
|
|
|
|
// HttpOnly Cookie: 登录后 token 存在 cookie 中,通过 storageState 自动捕获
|
|
await page.context().storageState({ path: AUTH_FILE });
|
|
}); |