diff --git a/smoke/nudge.spec.ts b/smoke/nudge.spec.ts index be664d2f..c7a4b14a 100644 --- a/smoke/nudge.spec.ts +++ b/smoke/nudge.spec.ts @@ -7,6 +7,9 @@ import { watch } from './support/carnival'; * page's clock is moved on rather than waited out, so the test stays quick. */ +/** How long a square's frame may take before it is stopped: HANG_MS in src/northpole/frame.ts. */ +const DRAW_BUDGET_MS = 1000; + /** Opens the map at jedi4ever's booth, goes in with E, lingers, and comes back out. */ async function enjoyABooth(page: import('@playwright/test').Page) { await page.clock.install(); @@ -19,6 +22,10 @@ async function enjoyABooth(page: import('@playwright/test').Page) { await expect(page).toHaveURL(/#\/booth\/jedi4ever$/); // Inside for real, so the time moved on counts as time spent in the booth. await expect(page.locator('.map-frame')).toHaveAttribute('data-visiting', 'booth:jedi4ever'); + // The page's clock is every square's too, and a square stopped when its frame took over + // DRAW_BUDGET_MS can't tell a jump from a hang. So each frame asked for before the jump gets + // its whole budget of real time first: going inside is when the page is busiest. + await page.waitForTimeout(DRAW_BUDGET_MS + 250); await page.clock.fastForward('01:05'); await page.keyboard.press('Escape'); await expect(page.locator('.visit')).toHaveCount(0);