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,51 @@
|
||||
/**
|
||||
* 产品与库存 E2E 测试
|
||||
* 覆盖: 分类树 / SKU 列表 / 新增 SKU / 库存入库 / 流水查看
|
||||
*/
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('产品与库存', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/products');
|
||||
await page.waitForLoadState('networkidle');
|
||||
});
|
||||
|
||||
test('页面正确加载', async ({ page }) => {
|
||||
// 表格和操作按钮可见
|
||||
await expect(page.locator('.el-table')).toBeVisible({ timeout: 5000 });
|
||||
});
|
||||
|
||||
test('分类树可见', async ({ page }) => {
|
||||
// 左侧分类树
|
||||
const tree = page.locator('.el-tree');
|
||||
if (await tree.isVisible({ timeout: 3000 })) {
|
||||
await expect(tree).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('新增 SKU 弹窗', async ({ page }) => {
|
||||
const addBtn = page.getByRole('button', { name: /新增|新建.*SKU|新建产品/ });
|
||||
if (await addBtn.isVisible()) {
|
||||
await addBtn.click();
|
||||
await expect(page.locator('.el-dialog')).toBeVisible({ timeout: 3000 });
|
||||
}
|
||||
});
|
||||
|
||||
test('SKU 搜索', async ({ page }) => {
|
||||
const searchInput = page.getByPlaceholder(/搜索|产品|SKU|关键词/);
|
||||
if (await searchInput.isVisible()) {
|
||||
await searchInput.fill('壳牌');
|
||||
await page.waitForTimeout(1000);
|
||||
// 表格应刷新
|
||||
await expect(page.locator('.el-table')).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('库存操作入口', async ({ page }) => {
|
||||
// 表格中应有库存/入库相关按钮
|
||||
const inventoryBtn = page.locator('.el-table').getByRole('button', { name: /入库|库存|编辑/ }).first();
|
||||
if (await inventoryBtn.isVisible({ timeout: 3000 })) {
|
||||
await expect(inventoryBtn).toBeVisible();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user