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,74 @@
|
||||
/**
|
||||
* 客户管理 E2E 测试 (修正版)
|
||||
*/
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('客户管理', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/customers');
|
||||
await page.waitForLoadState('networkidle');
|
||||
});
|
||||
|
||||
test('客户列表正确加载', async ({ page }) => {
|
||||
await expect(page.locator('.el-table').first()).toBeVisible({ timeout: 5000 });
|
||||
await expect(page.getByRole('button', { name: '新增客户' })).toBeVisible();
|
||||
});
|
||||
|
||||
test('新增客户完整流程', async ({ page }) => {
|
||||
await page.getByRole('button', { name: '新增客户' }).click();
|
||||
await expect(page.locator('.el-dialog')).toBeVisible({ timeout: 3000 });
|
||||
|
||||
const timestamp = Date.now();
|
||||
await page.getByPlaceholder('请输入客户公司名称').fill(`E2E测试客户_${timestamp}`);
|
||||
await page.getByPlaceholder('所属行业').fill('自动化测试');
|
||||
await page.getByPlaceholder('联系人姓名').fill('张测试');
|
||||
|
||||
// 选择客户级别
|
||||
await page.locator('.el-dialog .el-select').first().click();
|
||||
await page.waitForTimeout(500);
|
||||
// 选项: A级重点 / B级普通 / C级长尾
|
||||
await page.getByRole('option').first().click();
|
||||
|
||||
// 提交
|
||||
await page.locator('.el-dialog__footer').getByRole('button', { name: /确|保存|提交/ }).click();
|
||||
await expect(page.locator('.el-dialog')).not.toBeVisible({ timeout: 5000 });
|
||||
});
|
||||
|
||||
test('关键词搜索客户', async ({ page }) => {
|
||||
const searchInput = page.getByPlaceholder(/搜索|客户名称|关键词/);
|
||||
if (await searchInput.isVisible()) {
|
||||
await searchInput.fill('中石化');
|
||||
await page.getByRole('button', { name: '搜索' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(page.locator('.el-table').first()).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
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(/customers\/detail/);
|
||||
}
|
||||
});
|
||||
|
||||
test('编辑客户信息', async ({ page }) => {
|
||||
const editBtn = page.locator('.el-table').getByRole('button', { name: '编辑' }).first();
|
||||
if (await editBtn.isVisible({ timeout: 3000 })) {
|
||||
await editBtn.click();
|
||||
await expect(page.locator('.el-dialog')).toBeVisible({ timeout: 3000 });
|
||||
}
|
||||
});
|
||||
|
||||
test('分页翻页', async ({ page }) => {
|
||||
const pagination = page.locator('.el-pagination');
|
||||
if (await pagination.isVisible()) {
|
||||
const nextBtn = pagination.locator('.btn-next');
|
||||
if (await nextBtn.isEnabled()) {
|
||||
await nextBtn.click();
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(page.locator('.el-table').first()).toBeVisible();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user