删除内容: - 前端: 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 + 基座前端 + 通用组件
23 lines
882 B
TypeScript
23 lines
882 B
TypeScript
// apps/web/e2e/check-readiness.ts
|
|
import type { FullConfig } from '@playwright/test';
|
|
|
|
async function check(url: string, label: string): Promise<void> {
|
|
for (let i = 0; i < 5; i++) {
|
|
try {
|
|
const res = await fetch(url);
|
|
if (res.ok) return;
|
|
} catch { /* retry */ }
|
|
console.log(`⏳ ${label} 未就绪,等待重试 (${i + 1}/5)...`);
|
|
await new Promise((r) => setTimeout(r, 2000));
|
|
}
|
|
throw new Error(`❌ ${label} 未就绪: ${url}。请确认后端服务已启动 (cd crates/erp-server && cargo run)`);
|
|
}
|
|
|
|
export default async function globalSetup(_config: FullConfig) {
|
|
const apiBase = process.env.E2E_API_URL || 'http://localhost:3000';
|
|
const webBase = process.env.E2E_BASE_URL || 'http://localhost:5174';
|
|
await check(`${apiBase}/api/v1/health`, '后端 API');
|
|
await check(webBase, '前端 SPA');
|
|
console.log('✅ E2E 环境就绪');
|
|
}
|