删除内容: - 前端: health/(67文件), ai/(2文件), Copilot, MediaPicker, 相关API/Store/Hook - 后端: wechat_handler, wechat_service, wechat_user entity, analytics handler, ai_workflow_seed - 配置: WechatConfig, AppConfig.wechat, AuthState wechat 字段 - 启动: 微信凭据检查块, ensure_ai_workflows() 调用 - 迁移: 新增 m20260613_000170_drop_wechat_users.rs - 脚本: api_test_health_alert.py, api_test_mp.py, mpsync.sh/ps1 - E2E: health-data page, flows/ 目录 保留: erp-core/auth/workflow/message/config/plugin + 基座前端 + 通用组件
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
// apps/web/e2e/pages/login.page.ts
|
|
import type { Page } from '@playwright/test';
|
|
|
|
export class LoginPage {
|
|
readonly page: Page;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto('/#/login');
|
|
await this.page.waitForSelector('.ant-card, .ant-form');
|
|
}
|
|
|
|
async fillUsername(username: string) {
|
|
await this.page.fill('input[id="username"], input[placeholder*="用户名"]', username);
|
|
}
|
|
|
|
async fillPassword(password: string) {
|
|
await this.page.fill('input[type="password"]', password);
|
|
}
|
|
|
|
async clickSubmit() {
|
|
await this.page.click('button[type="submit"]');
|
|
}
|
|
|
|
async login(username: string, password: string) {
|
|
await this.goto();
|
|
await this.fillUsername(username);
|
|
await this.fillPassword(password);
|
|
await this.clickSubmit();
|
|
}
|
|
|
|
async getErrorMessage(): Promise<string> {
|
|
const el = this.page.locator('.ant-form-item-explain-error, .ant-message-error, .ant-alert-error');
|
|
return el.first().textContent() ?? '';
|
|
}
|
|
|
|
async isLoggedIn(): Promise<boolean> {
|
|
try {
|
|
await this.page.waitForURL('**/#/', { timeout: 5000 });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
}
|