30 lines
2.8 KiB
TypeScript
30 lines
2.8 KiB
TypeScript
import { expect, test, type Page, type TestInfo } from '@playwright/test';
|
|
|
|
const viewports = [{ width: 1366, height: 768 }, { width: 1920, height: 1080 }, { width: 3440, height: 1440 }];
|
|
const ready = async (page: Page) => { await page.goto('/'); await expect(page.getByTestId('operational-map')).toBeVisible(); };
|
|
|
|
for (const viewport of viewports) test(`renders the eight spatial compositions at ${viewport.width}x${viewport.height}`, async ({ page }, testInfo: TestInfo) => {
|
|
await page.setViewportSize(viewport);
|
|
const shot = (name: string) => page.screenshot({ path: testInfo.outputPath(`${name}-${viewport.width}x${viewport.height}.png`), animations: 'disabled' });
|
|
|
|
await ready(page); await shot('01-live-tactical');
|
|
|
|
await page.getByText('Low reserve', { exact: true }).click(); await expect(page.getByText(/VEHICLES/).first()).toBeVisible(); await shot('02-large-multiselection');
|
|
|
|
await ready(page); await page.getByRole('button', { name: 'Route', exact: true }).first().click();
|
|
{ const box = await page.getByTestId('operational-map').boundingBox(); if (!box) throw new Error('map has no bounds'); for (const [x, y] of [[.15,.68],[.43,.74],[.72,.69]]) await page.mouse.click(box.x + box.width * x, box.y + box.height * y); }
|
|
await page.keyboard.press('Enter'); await expect(page.getByLabel('Command draft review')).toBeVisible(); await shot('03-route-formation-draft');
|
|
|
|
await ready(page); await page.getByRole('button', { name: 'Map creation tools' }).click(); await page.getByRole('button', { name: 'Polygon', exact: true }).click();
|
|
{ const box = await page.getByTestId('operational-map').boundingBox(); if (!box) throw new Error('map has no bounds'); for (const [x, y] of [[.18,.62],[.38,.70],[.44,.48],[.24,.42]]) await page.mouse.click(box.x + box.width * x, box.y + box.height * y); }
|
|
await page.keyboard.press('Enter'); await shot('04-task-area-drawing');
|
|
|
|
await ready(page); await page.getByRole('button', { name: 'Deploy', exact: true }).click(); await page.getByRole('button', { name: 'DISCOVER', exact: true }).click(); await expect(page.getByText('KPT-F722-9A31')).toBeVisible(); await shot('05-deployment-discovery');
|
|
|
|
await ready(page); await page.getByRole('button', { name: 'Configuration' }).click(); await page.getByRole('button', { name: 'SENSORS', exact: true }).click(); await expect(page.getByText('GYRO RESIDUAL')).toBeVisible(); await shot('06-sensor-radio-calibration');
|
|
|
|
await page.getByRole('button', { name: 'PARAMETERS', exact: true }).click(); await expect(page.getByText('BASELINE → CURRENT → DESIRED')).toBeVisible(); await shot('07-parameter-configuration-diff');
|
|
|
|
await ready(page); await page.getByRole('button', { name: 'Recovery' }).click(); await expect(page.getByText('DEGRADED OPERATIONS')).toBeVisible(); await shot('08-degraded-recovery');
|
|
});
|