-
Notifications
You must be signed in to change notification settings - Fork 357
Add CI check for tracking bundle size impact using browser-based measurements #2822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Co-authored-by: adamziel <[email protected]>
Co-authored-by: adamziel <[email protected]>
Co-authored-by: adamziel <[email protected]>
|
Don't analyze assets based on regexps. Instead, use actual browser and measure total downloads until bar visible, after Wordpress loaded, and after all the downloads settle (offline mode readiness) @copilot |
Co-authored-by: adamziel <[email protected]>
Switched to browser-based measurements using Playwright. The new approach tracks actual network requests and measures downloads at three stages:
This provides realistic data that reflects actual user experience, including caching and compression effects. Commit: a03b8f6 |
|
@copilot assume WordPress is ready when the Playground iframe inside the remote iframe contains WordPress admin bar. Look up the right class names or whatever you need to peek in there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements automated bundle size tracking using real browser measurements via Playwright. The system monitors network activity at three critical page load stages (First Paint, WordPress Loaded, and Offline Mode Ready) and posts PR comments when size changes exceed 50KB.
Key changes:
- Browser-based measurement using Playwright to capture actual download sizes and timing
- Automated comparison logic that generates markdown reports for PR comments
- CI workflow that builds both PR and base branches, measures them, and posts results
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tools/scripts/measure-bundle-size-browser.mjs |
Implements Playwright-based network monitoring to measure downloads at three page load stages |
tools/scripts/compare-bundle-size.mjs |
Compares measurements between branches and generates markdown reports with 50KB threshold logic |
tools/scripts/README.md |
Documents the measurement system, CI workflow, and local development workflow |
.github/workflows/bundle-size-check.yml |
Defines CI workflow that builds both branches, runs measurements, and posts PR comments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log('Waiting for WordPress to load...'); | ||
| try { | ||
| // Wait for the WordPress iframe | ||
| const wpFrame = page.frameLocator('#playground-viewport:visible, .playground-viewport:visible').frameLocator('#wp'); |
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The selector '#playground-viewport:visible, .playground-viewport:visible' is redundant - both parts of the comma-separated list are identical. This should either be simplified to '#playground-viewport:visible' or the second selector should target a different element (e.g., '.playground-viewport:visible' if a class-based fallback is intended).
| const wpFrame = page.frameLocator('#playground-viewport:visible, .playground-viewport:visible').frameLocator('#wp'); | |
| const wpFrame = page.frameLocator('#playground-viewport:visible').frameLocator('#wp'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed redundant selector - simplified to #playground-viewport:visible. Commit e9e334d
|
@copilot fix the issues ^ |
Co-authored-by: adamziel <[email protected]>
Changed WordPress ready detection to wait for the admin bar (
Fixed both issues: simplified selector and changed WordPress ready detection to use admin bar. Commit e9e334d |
Implementation of download size tracking CI check:
Recent Changes
Fixed two issues identified in code review:
#playground-viewport:visible, .playground-viewport:visibleto just#playground-viewport:visible#wpadminbar) to be visible in the nested iframe, which is a more reliable indicator that WordPress is fully loaded and readyThis ensures more accurate measurement of when WordPress is actually ready for user interaction.
Summary
This PR implements automated bundle size tracking using real browser measurements via Playwright.
Measurement Approach
CI Workflow
On each PR:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.