This commit is contained in:
Andras Schmelczer 2026-05-06 19:54:50 +01:00
parent e3e8a4522e
commit 58bb3cb4f8
9 changed files with 49 additions and 174 deletions

View file

@ -1,5 +1,6 @@
import type { Page } from 'playwright';
import { installCursor, installZoomWrapper, waitForCurrentDemoMapSettled } from './dom.js';
import { installCursor, installZoomWrapper } from './dom.js';
import { DashboardRecorder } from './dashboard.js';
import { sleep } from './motion.js';
import { dashboardUrl } from './routes.js';
import {
@ -18,19 +19,21 @@ export interface TimelineResult {
}
export async function prepareTimeline(page: Page): Promise<SceneCtx> {
const dashboard = new DashboardRecorder(page);
const initialMapVersion = dashboard.getMapDataVersion();
await page.goto(dashboardUrl(), { waitUntil: 'domcontentloaded' });
await page.waitForLoadState('load', { timeout: 15000 }).catch(() => {});
await page
.locator('[data-tutorial="ai-filters"]')
.waitFor({ state: 'visible', timeout: 15000 });
await page.locator('canvas').first().waitFor({ state: 'attached', timeout: 15000 });
await waitForCurrentDemoMapSettled(page, 15000);
await dashboard.waitForMapSettled(initialMapVersion, 15000);
await new Promise((r) => setTimeout(r, 400));
await installZoomWrapper(page);
await installCursor(page);
const ctx: SceneCtx = { page, cursor: { x: 200, y: 240 } };
const ctx: SceneCtx = { page, dashboard, cursor: { x: 200, y: 240 } };
await page.mouse.move(ctx.cursor.x, ctx.cursor.y);
await prepareAiBox(ctx);
await sleep(80);