Skip to content
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

tests: update create-test-trace utility #13942

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Conversation

brendankenny
Copy link
Member

While working on #13917 I noticed create-test-trace has some very outdated details and wanted to fix them before it all paged out of my brain. There's a much nicer and powerful API possible here, but this PR is just some surface-level fixes to get the generated test traces closer to real traces.


return {
GatherContext: {gatherMode: 'navigation'},
traces: {defaultPass: createTestTrace({traceEnd: 5000})},
traces: {defaultPass: createTestTrace({frameUrl, traceEnd: 5000})},
Copy link
Member Author

Choose a reason for hiding this comment

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

a few of these tests were accidentally relying on the fact that the redirects audit was only using navStart events for the redirect chain if they have a isLoadingMainFrame property, and create-test-trace wasn't setting that property. The generated navStart event now has that property and these tests now set the navStart documentLoaderURL properly

@@ -298,7 +298,7 @@ describe('Metrics: CLS', () => {

it('ignores layout shift data from other tabs', async () => {
const trace = createTestTrace({timeOrigin: 0, traceEnd: 2000});
const mainFrame = trace.traceEvents[0].args.frame;
const mainFrame = trace.traceEvents.find(e => e.name === 'navigationStart').args.frame;
Copy link
Member Author

Choose a reason for hiding this comment

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

these mainFrame changes are a little awkward (and one reason why we should consider an ease of use refactor at some point), but still straightforward. navStart isn't necessarily the first event.

tid,
ph: 'I',
cat: 'disabled-by-default-devtools.timeline',
args: {
data: {
frameTreeNodeId: 6,
persistentIds: true,
frames: [{frame: rootFrame, url: frameUrl, name: '', processId: pid}],
frames: [{frame: rootFrame, url: 'about:blank', name: '', processId: pid}],
Copy link
Member Author

Choose a reason for hiding this comment

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

now defintely a navigation trace. we could adjust that if needed at some point

@devtools-bot devtools-bot merged commit ad60db4 into master Apr 28, 2022
@devtools-bot devtools-bot deleted the create-test-trace branch April 28, 2022 21:42
@connorjclark connorjclark mentioned this pull request May 9, 2022
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants