-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(test): add user flows to generate some fixtures #15005
Conversation
@@ -267,106 +267,124 @@ describe('Third party facades audit', () => { | |||
expect(results.displayValue).toBeDisplayString('2 facade alternatives available'); | |||
expect(results.details.items[0].product).toBeDisplayString('YouTube Embedded Player (Video)'); | |||
expect(results.details.items[1].product).toBeDisplayString('Vimeo Embedded Player (Video)'); | |||
expect(results.details.items).toMatchObject( |
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.
We could also just delete this?
animations: [ | ||
{failureReasonsMask: 8224, unsupportedProperties: ['width']}, | ||
{name: 'alpha', failureReasonsMask: 8224, unsupportedProperties: ['height']}, | ||
{name: 'beta', failureReasonsMask: 8224, unsupportedProperties: ['background-color']}, |
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.
note: background-color is now supported (sometime shortly after this audit was made), but now font-size
replaces it in the unsupported reasons? shrug
@@ -101,6 +104,26 @@ describe('Performance: page execution timings audit', () => { | |||
assert.equal(output.score, 1); | |||
}); | |||
|
|||
it('should compute the correct values for the load trace', async () => { |
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.
really any modern chrome trace will do here, which is why I didn't bother making a user flow for a basic page. instead just used animations
here.
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.
First pass, but I like the idea of having generator scripts w/ verify functions
@@ -101,6 +104,26 @@ describe('Performance: page execution timings audit', () => { | |||
assert.equal(output.score, 1); | |||
}); | |||
|
|||
it('should compute the correct values for the load trace', async () => { | |||
assert(loadTrace.traceEvents.find(e => e.name === 'TracingStartedInBrowser')); |
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.
Why not put this assertion in the trace verify
function?
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.
Because that's pretty far removed from the one place that cares (this test)
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.
Actually, are we really worried about this event being missing in any new traces? The check kinda makes sense for the old trace but if this one is being continually refreshed then I'm not sure we need it.
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 trace will not be refreshed. We could remove the logic for the old event but only when all our test fixtures have been updated.
1503272
to
d608b26
Compare
Issue was that the user flow was simulated throttling, and that only waits 1s after cpu idle. Yet this trace was then being used in the interactive unit test for observed throttling, which assumes at least 5s of idle time at the end of the trace :) Fixed by setting |
@@ -101,6 +104,26 @@ describe('Performance: page execution timings audit', () => { | |||
assert.equal(output.score, 1); | |||
}); | |||
|
|||
it('should compute the correct values for the load trace', async () => { | |||
assert(loadTrace.traceEvents.find(e => e.name === 'TracingStartedInBrowser')); |
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.
Actually, are we really worried about this event being missing in any new traces? The check kinda makes sense for the old trace but if this one is being continually refreshed then I'm not sure we need it.
Can we bikeshed a bit? If we ignore
this would also allow growth in page requirements (extra scripts, etc) and an easy place to colocate artifacts if/when we need them (devtoolslog, artifacts.json). |
It helps us organize better, but then we wouldn't be able to access them via |
These traces are central to so many tests, so better to pay for any static-server changes and reduce the annoyance of to authoring/maintaining test trace generation. I was looking for where we've expanded the serving directories before to see how hard it would be, but had forgotten the |
What are your thoughts on the redirect fixture (uses a real website at the moment, with real CPU work to test interactive audit)? Create a new page for the same purpose now, or defer until needed (when regenerating from the website no longer gives us what we need). |
Yeah, I think it's worth it. The smoke test should be able to evolve, add extra things etc without worrying about altering a bunch of unit tests.
I think in an ideal world we would recreate hermetic tests for all those, but in reality our most complex test sites aren't really approaching all the complexity you get in a real site (all the requests, all the cpu work, etc). Like we could never engineer a monstrosity like the youtube embed, and it's not worth trying. (though by the same token, maybe we'll only want to refresh the traces for those sites like once every three years, or if there's a major change for a key trace event like navStart or a CWV event since there could be wild volatility in what results. That seems ok since for these we're just interested in a real trace, not a live one) |
Moved the files to match the structure defined in #15005 (comment) - but will rename the trace/devtools output files in a follow up PR (simplest way to preserve file rename history in git). |
ref #14525
I picked a few traces and fleshed out a script to regenerate them.
This PR:
regenerate.js
scripts incore/test/fixtures/artifacts
to run user flows that update test fixturessh core/test/scripts/regenerate-fixtures.sh
animation.json, trace-user-timings.json, site-with-redirect.json, video-embeds-m84.json
(will rename in next PR to preserve git history)devtools-homepage-w-screenshots-trace.json, network-records.json
(not used)Some user flows use existing pages copied over from the static server fixtures, or makes a new page. One (the redirects one) just runs on a real site (the same it originally came from), since that seemed more useful than a bare-bones test page (
/redirects-scripts.html?redirect=...
works too but doesn't have a lot of main thread work).We could choose to land this PR w/o any updates to the fixtures, just keep the user flow scripts (defer the actual update for when more stuff is done). Other reasons to defer would be if we want to somehow minify the fixtures, or use git-lfs, before we starting churning these big files. (EDIT: we decided to land the changes, and do not care about the file size)
This first pass has uncovered a possible bug with user flow + redirects, as seen by the
interactive
test currently failing. If we choose to drop changes in fixtures, we can land this PR w/o addressing the bug. (EDIT: this was a fluke)https://docs.google.com/spreadsheets/d/1AaYzpzWnpXQ4JB5IZzOkTO9Zf5Sm0I8dsp7MhBgthMg/edit#gid=0