From 1b92a8bb72e7a8571509fc005effed044b990721 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 7 May 2026 12:10:21 +0000 Subject: [PATCH] ci(mac): make Playwright screenshots best-effort + 90s timeout Run 25494399543 / job 74810247593 progressed past the change-password flow + composer-mount + default_models[0] check (so commits d35bf6a and fdf7f94's Chromium fixes are working) but then crashed on `shoot('03b-default-model-button')` with: playwright._impl._errors.TimeoutError: Page.screenshot: Timeout 30000ms exceeded. Call log: - taking page screenshot - waiting for fonts to load... - fonts loaded Page.screenshot waits for the page's webfonts to be resolved before snapshotting. On macos-14 free runners under --single-process Chromium, font loading for the Studio chat page (Inter / Geist Mono) crowds the 30s default. Two changes: 1. Bump screenshot timeout to 90_000ms. 2. Wrap shoot() in try/except. Screenshots are diagnostic artifacts uploaded for human triage; a failure to capture one should never fail the test. The actual UI assertions live in step()/info()/ wait_for() calls, which are unaffected. Adds animations='disabled' for deterministic captures (frozen CSS transitions). Both playwright_chat_ui.py and playwright_extra_ui.py get the same treatment. --- tests/studio/playwright_chat_ui.py | 22 ++++++++++++++++++---- tests/studio/playwright_extra_ui.py | 16 ++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tests/studio/playwright_chat_ui.py b/tests/studio/playwright_chat_ui.py index c7c9189eef..5e0ed2cbdc 100644 --- a/tests/studio/playwright_chat_ui.py +++ b/tests/studio/playwright_chat_ui.py @@ -220,11 +220,25 @@ with sync_playwright() as p: ) def shoot(name): + # Screenshots are diagnostic artifacts only -- never fail the + # test on a screenshot timeout. Page.screenshot waits for + # webfonts to fully load before snapshotting; on macos-14 free + # runners with --single-process Chromium, font loading on the + # Studio chat page (Inter / Geist Mono) regularly crowds the + # 30s default and crashes Page.screenshot. Bump the timeout + # AND wrap in try/except so the test progresses even if the + # screenshot can't be captured. animations='disabled' freezes + # any in-flight CSS transitions for a deterministic snap. _n[0] += 1 - page.screenshot( - path = str(ART / f"{_n[0]:02d}-{name}.png"), - full_page = True, - ) + try: + page.screenshot( + path = str(ART / f"{_n[0]:02d}-{name}.png"), + full_page = True, + timeout = 90_000, + animations = "disabled", + ) + except Exception as _shoot_err: + info(f"WARN: screenshot {name} failed: {_shoot_err}") # ───────────────────────────────────────────────────── # 1. Change-password through the UI ("Setup your account"). diff --git a/tests/studio/playwright_extra_ui.py b/tests/studio/playwright_extra_ui.py index 72521b336b..89f03187f0 100644 --- a/tests/studio/playwright_extra_ui.py +++ b/tests/studio/playwright_extra_ui.py @@ -159,11 +159,19 @@ with sync_playwright() as p: page.on("pageerror", _on_pageerror) def shoot(name: str) -> None: + # See playwright_chat_ui.py:shoot -- screenshots are diagnostic, + # never fail the test on a font-load timeout under + # --single-process Chromium on macos-14 free runners. _n[0] += 1 - page.screenshot( - path = str(ART / f"{_n[0]:02d}-{name}.png"), - full_page = True, - ) + try: + page.screenshot( + path = str(ART / f"{_n[0]:02d}-{name}.png"), + full_page = True, + timeout = 90_000, + animations = "disabled", + ) + except Exception as _shoot_err: + info(f"WARN: screenshot {name} failed: {_shoot_err}") # ───────────────────────────────────────────────────── # Setup: change-password through the UI + model load.