web-infra-dev / web-infra-dev/midscene
[Feature] Enhance Midscene Reports: Add Playwright timing metrics and optimize page load waits
@zhoushaw is already working on this.
Since Apr 2, 2025.
- Dominant language
- TypeScript
- Stars
- 14.9k
- Forks
- 1.2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 96
Description
Background
Currently, Midscene reports provide basic execution time information for Playwright operations, but users have requested more granular timing data to identify performance bottlenecks in automation scripts. Additionally, the default timeout settings for waitForNetworkIdle sometimes cause unnecessary delays, and users want more control over this. Meanwhile, the execution speed of waitForSelector('html') is considered to have room for optimization, which could improve overall script efficiency.
Feature Details
1. Detailed Playwright Timing Display in Midscene Reports
Midscene reports will include the following additional timing information:
- Page load time
- Network request time
- Time spent on specific operations (e.g., clicks, navigation)
2. Configurable waitForNetworkIdle Options
- Users can customize the timeout duration for
waitForNetworkIdlevia configuration - Users can opt to completely disable
waitForNetworkIdleto adapt to varying network conditions
3. Optimize waitForSelector('html') Speed
- Reduce the waiting time for
waitForSelector('html')by adjusting polling strategies or using more efficient selectors
Implementation Plan
- Modify the Midscene report generation logic to capture and display additional Playwright timing metrics
- Add configuration options in Midscene.js to control the timeout and enable/disable
waitForNetworkIdle - Analyze and refactor the implementation of
waitForSelector('html')to improve its execution efficiency
Expected Impact
This feature will help users:
- Gain deeper insights into the performance of their automation scripts
- Identify and resolve potential performance issues
- Have greater flexibility in unstable network environments through configurable
waitForNetworkIdle - Experience improved script execution speed through optimized
waitForSelector('html')
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.