Skip to content

feat(browser-trace): add HTML report generation#86

Open
shrey150 wants to merge 1 commit intomainfrom
shrey/browser-trace-html-report
Open

feat(browser-trace): add HTML report generation#86
shrey150 wants to merge 1 commit intomainfrom
shrey/browser-trace-html-report

Conversation

@shrey150
Copy link
Copy Markdown
Contributor

@shrey150 shrey150 commented Apr 28, 2026

Summary

  • Adds scripts/report.mjs — generates a standalone HTML report from a bisected trace run, embedding screenshots as base64
  • Adds references/report-template.html — same Browserbase-branded template design as ui-test (colors, typography, cards, lightbox)
  • Updates SKILL.md with report generation docs and a "teardown on interrupt" section so the agent auto-runs stop → bisect → report when the user says "that's enough"

Test plan

  • Syntax check passes (node -c scripts/report.mjs)
  • Tested against real trace data (tiktok-fyp run) — report generated successfully
  • Open generated report in browser and verify layout/screenshots render

🤖 Generated with Claude Code


Note

Low Risk
Adds a new offline report generator that reads trace artifacts and embeds screenshots, but it’s additive and only affects local tooling/output generation (main risk is oversized/slow reports and platform-specific --open behavior).

Overview
Adds standalone HTML report generation for browser-trace runs via new scripts/report.mjs, which reads cdp/summary.json plus per-page buckets to compute totals (requests, failures, errors, duration) and renders an aggregated Errors-first view with per-page expandable cards, network health bars, and an optional base64-embedded screenshot timeline.

Introduces a Browserbase-branded references/report-template.html (with lightbox behavior) and updates SKILL.md to document report.html in the run layout, how to run report.mjs (including --open), and a new “teardown on interrupt” sequence that ends with generating/opening the report.

Reviewed by Cursor Bugbot for commit 64550b6. Bugbot is set up for automated code reviews on this repo. Configure here.

Add a standalone HTML report that renders trace data (pages, errors,
network health, screenshots) using the same Browserbase-branded template
as ui-test. Includes a teardown-on-interrupt section in SKILL.md so the
agent runs stop → bisect → report when the user says "that's enough."

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 64550b6. Configure here.

.replace('{{HEALTH_CLASS}}', healthClass)
.replace('{{ERRORS_SECTION}}', errorsHtml)
.replace('{{PAGES_SECTION}}', pagesHtml)
.replace('{{SCREENSHOTS_SECTION}}', screenshotsHtml);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dollar signs in replacement strings corrupt HTML output

High Severity

String.prototype.replace treats $&, $', and $` as special patterns in the replacement string. The errorsHtml, pagesHtml, and screenshotsHtml values are derived from user-facing content (URLs, error messages) that commonly contains $. The esc helper doesn't escape $. If any replacement string contains e.g. $', JavaScript inserts the entire remainder of the template after the placeholder, severely corrupting the report. Using a replacer function (e.g. .replace('{{PAGES_SECTION}}', () => pagesHtml)) avoids this.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 64550b6. Configure here.

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Browser Trace — {{TITLE}}</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google Fonts CDN link violates offline requirement

Medium Severity

The template loads the Inter font from fonts.googleapis.com, but SKILL.md explicitly requires "no CDN links, no external assets" so the report works offline. Opening the report without internet triggers failed network requests for the font stylesheet. The CSS fallback chain (-apple-system, system-ui, etc.) prevents total breakage, but the CDN links contradict the documented design constraint and the goal of a fully self-contained file.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 64550b6. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants