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

core(full-page-screenshot): wait for doubleraf, network quiet #13663

Merged
merged 3 commits into from
Feb 16, 2022

Conversation

connorjclark
Copy link
Collaborator

We don't give the page time to load new resources / perform a layout between changing the viewport and grabbing a screenshot. Sometimes, it would just work, but usually stuff is shifted a lot or many images are not loaded yet.

before

image

after

image

@connorjclark connorjclark requested a review from a team as a code owner February 14, 2022 23:33
@connorjclark connorjclark requested review from adamraine and removed request for a team February 14, 2022 23:33
isIdle: recorder => recorder.is2Idle(),
});
await Promise.race([
new Promise(resolve => setTimeout(resolve, 1000 * 10)),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thoughts on how long timeout should be?

Copy link
Member

Choose a reason for hiding this comment

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

how long did the networkidle promise take on CNN? maybe double that?

Copy link
Member

Choose a reason for hiding this comment

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

IMO it shouldn't be that long. FPS isn't critical information and I don't want to wait an extra 10s just so everything lines up. Quickly eyeballing it I would say 2s.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cnn.com took ~1-1.5s to reach isCritical network quiet time on my machine

Settled on 5s because 1-2s is way too short to expect a network response in the extreme case

Copy link
Contributor

Choose a reason for hiding this comment

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

5s seems reasonable to me!

Quick FYI, some pages have carousels that animate so the full screen screenshot may end up out of sync with the last screenshot from the timeline screenshots. I don't think that's a big deal, but it may lead to confusion of eagle-eyed report viewers :-)

// Now that the viewport is taller, give the page some time to fetch new resources that
// are now in view.
const networkMonitor = new NetworkMonitor(context.driver.defaultSession);
const waitForNetworkIdleResult = waitForNetworkIdle(session, networkMonitor, {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Don't have great reasons for 1000ms or 2-idle vs 0-idle.

Copy link
Member

Choose a reason for hiding this comment

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

you can pull networkQuietThresholdMs from the pass settings. the other two are correct.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

let's do network-critical-busy because we don't want to wait for tracking crap

I feel that option as used for the page load isn't quite the same as this use case... besides, that would be 5s by default which is the same time as the timeout we chose :P

const networkMonitor = new NetworkMonitor(context.driver.defaultSession);
const waitForNetworkIdleResult = waitForNetworkIdle(session, networkMonitor, {
networkQuietThresholdMs: 1000,
busyEvent: 'network-2-busy',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm.. should the waitfor be called before setDeviceMetricsOverride (but only awaited later like it is now)?

Copy link
Member

Choose a reason for hiding this comment

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

probably

@connorjclark connorjclark changed the title core(full-page-screenshot): wait for doubleraf and network quiet core(full-page-screenshot): wait for doubleraf, network quiet Feb 16, 2022
@connorjclark connorjclark merged commit 4608fb9 into master Feb 16, 2022
@connorjclark connorjclark deleted the fps-raff branch February 16, 2022 22:23
@connorjclark connorjclark mentioned this pull request Feb 23, 2022
16 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

5 participants