fix(reports): keep body sized so standalone screenshots don't time out#39944
Conversation
Screenshot capture (Playwright/Selenium) waits for body.standalone to become visible, but the SSR'd page only contains an absolutely-positioned spinner — body collapses to 0 height and the wait resolves "hidden" until React mounts the dashboard. On slow first paints (cold webpack, complex filter hydration), this exceeds the 60s wait and the report errors with "Locator.wait_for: Timeout 60000ms exceeded ... .standalone". Pin body.standalone to the viewport so the locator is measurable from first paint and the wait sequence drives off React mount, not body box. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Code Review Agent Run #82fd2bActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #39944 +/- ##
=======================================
Coverage 63.88% 63.88%
=======================================
Files 2583 2583
Lines 136602 136604 +2
Branches 31501 31502 +1
=======================================
+ Hits 87274 87276 +2
Misses 47812 47812
Partials 1516 1516
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SUMMARY
Scheduled Reports on dashboards (especially with native filters that take a moment to hydrate) intermittently fail screenshot capture with:
The body element does have
class="standalone"(server-rendered), but Playwright reports it hidden. Root cause: the SSR'dspa.htmlbody only contains an absolutely-positioned spinner, so before React mounts, the body's content height is0and Playwright'swait_for(state="visible")keeps reporting "hidden" until React fills the layout. On slow first paints (cold webpack compile, complex native filter hydration, etc.), React mount can exceed the 60s wait and the report errors out.This is a regression-class issue independent of the multi-tab
urlParamsfix in #39884: the URL is correct, the body has the right class, but the locator's visibility check fails on the empty body box.Reproduced locally by blocking JS/CSS subresources after
domcontentloaded:body bbox = 1584 × 0, Playwright says HIDDEN.body bbox = 1600 × 2000, Playwright says VISIBLE.The fix pins
html, body.standalonetomin-height: 100vh; margin: 0;inspa.htmlwheneverstandalone_modeis true. This is the screenshot/embed code path, so non-standalone navigations are untouched.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — change is in the SSR shell during a sub-second window before React mounts; not visually observable in the final report screenshot.
TESTING INSTRUCTIONS
FEATURE_FLAGS["ALERT_REPORTS"] = True,ALERT_REPORT_TABS = True,ALERT_REPORTS_FILTER = True,PLAYWRIGHT_REPORTS_AND_THUMBNAILS = True,ALERT_REPORTS_NOTIFICATION_DRY_RUN = True.filter_selectvalue (e.g.Country = USA).report_execution_log— pre-fix, runs intermittently fail withLocator.wait_for: ... .standalone. Post-fix, the wait resolves immediately and screenshots succeed.Automated coverage:
tests/unit_tests/extension_tests.py::test_spa_template_standalone_body_has_min_heightrenders the Jinja template and asserts themin-height: 100vhrule is present in standalone responses and absent otherwise. Removing the rule fromspa.htmlmakes this test fail.tests/unit_tests/commands/report/execute_test.pytests continue to pass — this PR does not touch the_get_tabs_urls/urlParamsmerge logic shipped in fix(reports): preserve urlParams in multi-tab report fan-out #39884.ADDITIONAL INFORMATION
ALERT_REPORTS,PLAYWRIGHT_REPORTS_AND_THUMBNAILS(existing)