Every JumpBud game page has one job on a phone: show a short answer to "what is this?", then a Play button you can reach without scrolling. Yesterday a copy change broke that on one page, and no human noticed. A Playwright script did.

This post walks through that script, playcheck.py: one Python file that opens all 49 games on jumpbud.com in Chromium, presses Play like a person would, plays at least one full round, and fails the build if anything looks off.

The bug it caught

On the Reef Pairs page we wanted the first sentence to list everything the game offers: two practice boards, a daily 4×5 board drawn from 365 unique-solution layouts, par, streaks, a share button. It read well. On a 375×812 phone it pushed the Play button's bottom edge to 613 px.

That matters because a 812 px viewport is not 812 px of page. With Safari's address bar and toolbar showing on an iPhone SE-class screen, roughly 553 px are actually visible. So the check is a single hard number:

PHONE_VISIBLE_HEIGHT = 553 play = page.locator("#load-game") play_box = play.bounding_box() if touch else None if play_box and play_box["y"] + play_box["height"] > PHONE_VISIBLE_HEIGHT: issues.append(f"Play button below the phone fold " f"(bottom {play_box['y'] + play_box['height']:.0f}px)") 

The fix was editorial, not CSS: keep the first sentence short and move the feature list into the intro paragraph below the game. Play went back to 522 px. Across all 49 pages today the Play button's bottom edge sits between 493 px and 540 px, median 522 px, so the budget is tight on every page, not just this one.

One context per viewport

Each game runs twice: a phone (375×812, touch, is_mobile) and a desktop (1280×900, mouse and keyboard). A fresh browser context per run keeps localStorage, streaks and cookies from leaking between games:

VIEWPORTS = (("phone", 375, 812, True), ("desktop", 1280, 900, False)) with browser.new_context(viewport={"width": w, "height": h}, has_touch=touch, is_mobile=touch, reduced_motion="reduce") as context: page = context.new_page() page.on("pageerror", lambda e: issues.append(f"JS error {e.message}")) page.on("console", check_console) # console.error fails the run page.on("response", check_response) # any 404 fails the run 

reduced_motion="reduce" is deliberate: it keeps optional animation out of the timing picture for any game that respects the setting.

Before Play is even pressed, the script also asserts that the quick-answer summary is fully inside the first screen and sits above the player iframe. That is the same promise a search snippet or an AI answer box relies on.

Listening to the game, not the DOM

Asserting on CSS classes breaks every time a game is restyled. Instead, every JumpBud game dispatches two public events: game_start and round_complete. The test injects a counter before any page script runs:

ROUND_EVENTS = """ window.playcheckRounds = {game_start: 0, round_complete: 0}; for (const event of Object.keys(window.playcheckRounds)) { window.addEventListener(event, () => window.playcheckRounds[event]++); } """ page.add_init_script(ROUND_EVENTS) 

A run only passes if it saw at least one round_complete and at least two game_start events, which proves both "I can finish a round" and "Play again actually restarts".

A scenario per game

Each game registers a board selector, a rules selector and a short scenario. Here is part of the one for Reef Pairs, a domino pairing puzzle. It checks that illegal moves are rejected, that undo restores state, and that a known solution finishes the board at the expected score:

def reef_pairs(game): tile = lambda i: f'[data-tile="{i}"]' game.tap("#reef-start") game.tap(tile(1)); game.tap(tile(5)) # diagonal, must be refused require("do not share an edge" in game.text("#reef-status"), "diagonal accepted") ... for a, b in [(4, 5), (0, 3)]: game.tap(tile(a)); game.tap(tile(b)) require(game.text("#reef-status") == "Reef complete! 5 edits · Par 3.", "practice board did not finish") 

game.tap() is a small wrapper: on the phone pass it uses locator.tap() or page.touchscreen.tap(), on desktop it clicks. For swipe games it sends raw Input.dispatchTouchEvent messages through a CDP session, because a synthesized mouse drag does not exercise touchstart/touchmove handlers at all.

Virtual time, mostly

Games with timers, gravity or falling sand are slow and flaky to test in real time. After the iframe has loaded, the script installs Playwright's clock and pauses it:

now = datetime.fromtimestamp(page.evaluate("Date.now()") / 1000, timezone.utc) page.clock.install(time=now) page.clock.pause_at(now + timedelta(milliseconds=200)) # later, inside a scenario: page.clock.run_for(1600) # delivers every timer and animation frame 

We use run_for rather than fast_forward because run_for fires every intermediate requestAnimationFrame and timer, so physics steps happen exactly as they would for a player.

There is one honest exception list: 8 touch scenarios that mix drags and button taps (for example a snake game and a drawing game) use the real clock on the phone pass. With a frozen clock, Chromium can't finish the scroll and click synthesis between gestures, and the test would fail for reasons a player never sees.

Numbers from today's run

  • 49 games, 98 browser runs (phone + desktop): 49/49 pass
  • Full suite wall time in a cloud container: 6 min 6 s, about 3.7 s per run
  • Mobile Play button bottom edge: 493–540 px against a 553 px budget
  • Failures are printed as a Markdown table, one row per game, so the reason ("JS error…", "Play button below the phone fold (bottom 613px)") lands straight in the daily report

What I'd tell anyone copying this

  1. Put the fold in a constant with a comment that says where the number came from. "553 because of Safari's toolbars" survives refactors; a magic number doesn't.
  2. Test through events the game already emits for analytics. You get stable assertions for free.
  3. Use virtual time by default, but keep a short, named list of exceptions instead of sprinkling wait_for_timeout everywhere.

You can see the page that tripped the 553 px rule, now fixed, and play today's board here: Reef Pairs daily domino puzzle on JumpBud.