v0.2.0: CRM/ERP 系统升级 - 清理 .gitignore 并移除误提交的 venv/env/db 文件
- 更新 .gitignore:全面覆盖环境变量、数据库、日志、缓存、上传文件 - 移除误跟踪的 server/venv/、crm_data.db、.env 文件 - 新增 server/.env.example 模板 - 新增合同管理、利润核算、AI教练等功能模块 - 新增 Playwright e2e 测试套件 - 前后端多项功能升级和 bug 修复
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 全局认证 Setup
|
||||
* 通过 UI 登录后持久化 storageState,后续所有测试复用登录态
|
||||
*/
|
||||
import { test as setup, expect } from '@playwright/test';
|
||||
|
||||
const authFile = 'e2e/.auth/user.json';
|
||||
|
||||
setup('authenticate', async ({ page }) => {
|
||||
// 1. 访问登录页
|
||||
await page.goto('/login');
|
||||
await expect(page.locator('.login-title')).toContainText('天津硕博霖 CRM 系统');
|
||||
|
||||
// 2. 填写表单
|
||||
await page.getByPlaceholder('用户名').fill('admin');
|
||||
await page.getByPlaceholder('密码').fill('123456');
|
||||
|
||||
// 3. 点击登录
|
||||
await page.getByRole('button', { name: '登 录' }).click();
|
||||
|
||||
// 4. 等待跳转到首页 (工作台)
|
||||
await page.waitForURL('/', { timeout: 10000 });
|
||||
await expect(page.locator('.el-menu--vertical').first()).toBeVisible({ timeout: 5000 });
|
||||
|
||||
// 5. 持久化认证状态 (localStorage token + cookies)
|
||||
await page.context().storageState({ path: authFile });
|
||||
});
|
||||
Reference in New Issue
Block a user