mirror of
https://github.com/margrop/wrong-notebook.git
synced 2026-12-05 07:39:34 +08:00
- 登录时检测管理员是否使用默认密码 123456,会话标记 mustChangePassword - 中间件把被标记会话的所有页面重定向到 /setup,改密后经 session update 按数据库重新判断并解除 - /api/user 拒绝管理员把密码改回默认密码 - E2E 新增 scripts/prepare-e2e.js 准备测试账号,Playwright 支持 E2E_BASE_URL;新增强制改密用例 - 同步更新 README、Wiki、安装包提示文案 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
883 B
TypeScript
18 lines
883 B
TypeScript
import { expect, type Page } from '@playwright/test';
|
||
|
||
/**
|
||
* 确认页面内的确认框(FeedbackHost 渲染,替代原生 confirm)。
|
||
* 确认框可能叠在设置等对话框之上,按标题定位以免点到其他对话框的按钮。
|
||
*/
|
||
export async function acceptConfirmDialog(page: Page) {
|
||
const confirmDialog = page.getByRole('dialog').filter({
|
||
has: page.getByRole('heading', { name: /请确认|Please confirm/ }),
|
||
});
|
||
await expect(confirmDialog).toBeVisible({ timeout: 5000 });
|
||
await confirmDialog.getByRole('button', { name: /^(确认|Confirm)$/ }).click();
|
||
await expect(confirmDialog).not.toBeVisible({ timeout: 5000 });
|
||
}
|
||
|
||
/** 各用例登录用的管理员密码,需先运行 scripts/prepare-e2e.js 设置(默认管理员会被强制改密) */
|
||
export const ADMIN_PASSWORD = process.env.E2E_ADMIN_PASSWORD || 'e2e-admin-pass';
|