44 lines
2.3 KiB
TypeScript
44 lines
2.3 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
||
|
||
test.skip(
|
||
process.env.E2E_FLEX_DUE !== '1',
|
||
'requires an isolated backend holding a flex-only schedule (set E2E_FLEX_DUE=1)',
|
||
);
|
||
|
||
// 现场反馈:柔性试排已经跑出来,切到「交期分析」却整列显示"未排产"、工具栏显示"暂无版本"。
|
||
// 根因:交期分析属于固定产线视图组,只读 scheduleVersions/productionOrders;柔性版本不进这两张表。
|
||
// 修复后:固定通道没有版本时,KPI 回退显示柔性版本号,看板的承诺完成/裕量/风险取柔性虚拟产线。
|
||
test('柔性试排结果在交期分析可见(不显示未排产)', async ({ page }) => {
|
||
// 隔离后端关闭了登录;前端总会带访客头,会被后端解析成独立访客身份,看不到
|
||
// 本地管理员作用域里的演示项目。这里只摘掉访客头,让请求回落到本地管理员身份。
|
||
await page.route('**/api/**', async (route) => {
|
||
const headers = { ...route.request().headers() };
|
||
delete headers['x-aps-visitor-id'];
|
||
await route.continue({ headers });
|
||
});
|
||
await page.goto('/');
|
||
await expect(page.locator('.sidebar-account-area')).toContainText(
|
||
/本地免登录管理员|local-admin/, { timeout: 30_000 });
|
||
|
||
const resultButton = page.locator(
|
||
'.right-rail button[data-tip="排产结果"], .right-rail button[data-tip="再点收起"]');
|
||
await expect(resultButton).toBeEnabled({ timeout: 30_000 });
|
||
await resultButton.click();
|
||
await expect(page.locator('.vp-toolbar')).toBeVisible({ timeout: 30_000 });
|
||
|
||
await page.locator('.seg .tab', { hasText: '交期分析' }).click();
|
||
|
||
// KPI 卡组:如实显示柔性版本号,而不是"暂无版本"
|
||
const kpis = page.locator('.kpis');
|
||
await expect(kpis).toContainText('柔性版本');
|
||
await expect(kpis).not.toContainText('暂无版本');
|
||
await expect(kpis).toContainText(/FV\d{8}-\d{3}/);
|
||
|
||
// 交期看板:承诺完成/裕量有值,风险徽标不再是"未排产"
|
||
const firstRow = page.locator('table.grid tbody tr').first();
|
||
await expect(firstRow).toContainText('SO-');
|
||
await expect(firstRow.locator('.risk')).toHaveText(/超期|紧张|充足/);
|
||
await expect(firstRow).not.toContainText('未排产');
|
||
if (process.env.FLEX_DUE_SCREENSHOT) await page.screenshot({ path: process.env.FLEX_DUE_SCREENSHOT });
|
||
});
|