-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Performance suite: track Largest Contentful Paint in the front-end #47938
Conversation
Size Change: +454 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
So far, the metric reports 0ms. Locally, I was able to get some good data when running the test in interactive mode (for example, |
Flaky tests detected in 90f7dc1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4137595182
|
I think it's probably because there is nothing being painted in headless mode. We can probably run in headed mode for this particular test by using |
Nice cue. It inspired me to learn that puppeteer considers the page "done" on I don't know why it worked in non-headless mode locally. Being a side effect of it being slower in that mode, perhaps? That could be, though it's not super convincing: it still should consider a page done at |
If you used --puppeteer-interactive mode locally, know that this mode also adds "slowmo" time by default. Meaning your explanation above seems right. The added slowmo time gaps allowed the page to trigger the events. |
*/ | ||
|
||
/** | ||
* @typedef WPPerformanceResults | ||
* | ||
* @property {number=} timeToFirstByteMedian Represents the time since the browser started the request until it received a response (median). |
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.
This just adds two other properties: largestContentfulPaintMedian and largestContentfulPaintP75. The rest is indentation.
@@ -30,54 +30,57 @@ const config = require( '../config' ); | |||
/** | |||
* @typedef WPRawPerformanceResults | |||
* | |||
* @property {number[]} timeToFirstByte Represents the time since the browser started the request until it received a response. |
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.
This just adds one new properties: largestContentfulPaint. The rest is indentation.
OK, this is ready if anyone cares to approve :) |
For the record, these are the screens we are tracking (homepage template) for each theme: TwentyTwentyThree: TwentyTwentyOne: For tracking LCP, it'll be good to update the content of this homepage template, so it has something meaningful (a hero image or something like that?) that LCP can track. For example, changes such as lazy loading should impact this metric. cc @mikachan in case you are interested in helping here? I've added this task as a follow-up at #33645 For awareness, core is in the process of tracking this front-end metrics as well. See https://core.trac.wordpress.org/ticket/57687 They plan to use the theme test data https://github.com/WPTT/theme-test-data |
Good idea for the content, thanks for the ping! I'd be interested in helping out with the remaining tasks in #33645. |
Part of #33645
Follow-up to #47037
What?
Adds a new metric to the front-end performance suite: Largest Contentful Paint (LCP).
Why?
We want to know how the front-end performs for the user, and the existing metric we track (TTFB) only tells us a partial picture.
Time To First Byte (TTFB) is a good metric to know what happens in the server. However, it's not a user-centered metric: taking more time in the server doesn't necessarily mean taking more time to render in the client. For example, WordPress processes the post to render so it can identify the blocks in use. With that information, it enqueues the CSS of those blocks instead of the CSS of the whole block library. This certainly takes more time in the server, though we expect it to improve the perceived performance by the user (LCP).
By having LCP available as a metric, we will have a more balanced story of the performance impact of our work.
How?
Add support for it in the existing e2e test suite.
Testing Instructions
Verify that the results for largest contentful paint (median and p75) are reported in the Performance Test job as part of the front-end test suite: