aps-agent/apps/web/e2e/virtual-line-replay.spec.ts

36 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from '@playwright/test';
test.skip(
process.env.E2E_VIRTUAL_REPLAY !== '1',
'requires a pre-seeded local virtual-line demo dataset',
);
test('锐扬排产结果可播放二维虚拟产线预演', async ({ page }) => {
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 });
const flexTab = page.locator('.seg .tab', { hasText: '柔性甘特' });
await expect(flexTab).toBeVisible();
await flexTab.click();
await expect(page.locator('.flex-view-switch')).toBeVisible();
await page.getByRole('tab', { name: '虚拟线预演' }).click();
const replay = page.locator('.vlr');
await expect(replay).toBeVisible();
await expect(replay).toContainText('数字孪生 · 虚拟产线预演');
await expect(replay).toContainText('15 道工序');
await expect(replay.locator('.vlr-station')).toHaveCount(5);
expect(await replay.locator('.vlr-load-bar').count()).toBeGreaterThanOrEqual(10);
await replay.getByRole('button', { name: '8×' }).click();
await replay.getByRole('button', { name: '开始预演' }).click();
await expect(replay.locator('.vlr-progress-area strong')).not.toContainText('0.0%', { timeout: 3_000 });
await expect(replay.locator('.vlr-verdict')).toContainText('仿真验证通过', { timeout: 15_000 });
await expect(replay.locator('.vlr-progress-area strong')).toContainText('100.0%');
if (process.env.VIRTUAL_REPLAY_SCREENSHOT) await page.screenshot({ path: process.env.VIRTUAL_REPLAY_SCREENSHOT });
});