import { test, expect, openPredict, login, sceneObjectCount } from './fixtures'; test.beforeEach(async ({ context, page }) => { await login(context); await page.goto('/'); await page.evaluate(() => localStorage.removeItem('workspaces')); }); /** Count map objects whose scoped id belongs to a bounding-box scene. */ function bboxLayerCount(page: import('@playwright/test').Page) { return sceneObjectCount(page, 'bbox'); } // Regression: the bounding box is drawn only by WorkspaceRenderer (predict-only). // Selecting the same forecast on /track must redraw its box, otherwise it // "disappears" the moment the user switches into tracking mode. test('selected forecast bounding box is drawn on the tracking page', async ({ page }) => { test.setTimeout(90_000); await openPredict(page); const panel = page.locator('.panel-container-right'); const runBtn = panel .locator('.workspace-row') .first() .getByRole('button', { name: /Рассчитать|Run/ }); await runBtn.click(); // Wait for the run to complete (workspace scene appears). await expect .poll(() => sceneObjectCount(page, 'ws/'), { timeout: 75_000, intervals: [1000, 2000, 3000], }) .toBeGreaterThan(0); // Enable the bounding box for this forecast. await panel.getByRole('button', { name: /Построить рамку|Generate bounding box/ }).click(); await expect.poll(() => bboxLayerCount(page), { timeout: 10_000 }).toBeGreaterThan(0); // Client-side navigate to tracking (a full reload would drop the in-memory // prediction result, which is intentionally not persisted). await page.getByRole('link', { name: /Слежение|Track/ }).click(); await page .locator('.map-container canvas') .first() .waitFor({ state: 'attached', timeout: 15_000 }); // Select the forecast to track against — its box must appear on this map. await page.locator('#forecast-select').selectOption({ index: 1 }); await expect.poll(() => bboxLayerCount(page), { timeout: 10_000 }).toBeGreaterThan(0); });