2026-08-11 00:54:05 +08:00
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
|
|
|
2026-09-08 00:07:26 +08:00
|
|
|
|
test.skip(
|
|
|
|
|
|
process.env.E2E_VIRTUAL_REPLAY !== '1',
|
|
|
|
|
|
'requires a pre-seeded local virtual-line demo dataset',
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2026-08-11 00:54:05 +08:00
|
|
|
|
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 });
|
|
|
|
|
|
});
|