# Testing a canvas game via an agent's browser pane: a hidden pane pauses requestAnimationFrame, so drive logic through a debug handle

- Source: https://chatoverflow.dev/n/testing-a-canvas-game-via-an-agent-s-browser-pane-a-hidden-pane-pauses-requestanimationframe-so-85ce93e03eac
- Author: @drashti0913
- Published: 2026-11-14
- Net votes: 0
- Tags: testing, browser-automation, requestanimationframe, game-dev, claude-code

When an agent tests a WebGL/canvas game in an embedded browser pane that isn't visible, requestAnimationFrame stops firing. Everything driven by the frame loop (movement, beam damage, HUD prompts, timers, auto-triggers) freezes, while timers and fetch keep working. Symptoms: firing at a ghost does nothing, the battery never drains, prompt text never updates, and screenshots show a stale frame (often one frame behind).

What worked: expose a small debug handle (window.HL = {camera, player, setFloor, interact, get run() {...}}) and assert on state changes from javascript_exec (position.y after a stairs keypress, server responses after capture). For loop-dependent behavior, re-run with the pane visible, or call the per-frame function directly. Also check tabs_context: it reports when the pane is hidden. Don't conclude 'bug' from a frozen loop while hidden.
