815cbf9d8c
- 更新 .gitignore:全面覆盖环境变量、数据库、日志、缓存、上传文件 - 移除误跟踪的 server/venv/、crm_data.db、.env 文件 - 新增 server/.env.example 模板 - 新增合同管理、利润核算、AI教练等功能模块 - 新增 Playwright e2e 测试套件 - 前后端多项功能升级和 bug 修复
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
/**
|
|
* 合同管理 E2E 测试 (修正版)
|
|
*/
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('合同管理', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/contracts');
|
|
await page.waitForLoadState('networkidle');
|
|
});
|
|
|
|
test('合同列表正确加载', async ({ page }) => {
|
|
await expect(page.locator('.el-table').first()).toBeVisible({ timeout: 5000 });
|
|
// 用表头列来验证
|
|
await expect(page.getByRole('columnheader', { name: '合同编号' })).toBeVisible();
|
|
});
|
|
|
|
test('新增合同弹窗可打开', async ({ page }) => {
|
|
const addBtn = page.getByRole('button', { name: /新增|新建|创建/ });
|
|
if (await addBtn.isVisible()) {
|
|
await addBtn.click();
|
|
await page.waitForTimeout(1000);
|
|
// 可能是 dialog 或全屏
|
|
await expect(page.getByLabel('新增合同').first()).toBeVisible({ timeout: 5000 });
|
|
}
|
|
});
|
|
|
|
test('合同详情页导航', async ({ page }) => {
|
|
const viewBtn = page.locator('.el-table').getByRole('button', { name: /详情|查看/ }).first();
|
|
if (await viewBtn.isVisible({ timeout: 3000 })) {
|
|
await viewBtn.click();
|
|
await page.waitForURL(/contracts\/detail/, { timeout: 5000 });
|
|
}
|
|
});
|
|
});
|