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

36 lines
1.8 KiB
TypeScript
Raw Permalink 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-checkbar')).toContainText('发布前校验');
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 });
});