-
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(fps): use observed metrics for screenshot dimensions #14418
Conversation
width: document.documentElement.clientWidth, | ||
height: document.documentElement.clientHeight, | ||
width: window.outerWidth, | ||
height: window.outerHeight, |
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.
Creating the smoke test helped me discover that document.documentElement.client*
does not represent the actual device size.
screenshot: { | ||
height: 1742, | ||
width: 980, | ||
}, |
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.
these exact value display raw confidence :P
hopefully we can be this exact in all environments
ViewportDimensions: { | ||
innerWidth: 980, | ||
// This value can vary slightly, depending on the display. | ||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1346355 |
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.
i'm so sorry
I assume so. The actual text is tiny and then we add compression on top of that. |
const documentSize = | ||
await context.driver.executionContext.evaluate(getDocumentSize, { | ||
const screenshotAreaSize = | ||
await context.driver.executionContext.evaluate(getScreenshotAreaSize, { |
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 should usually be the same as the document size. In some cases (e.g. infinite scroll) the document element could grow larger than the viewport after we expand the viewport size.
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 sounds like a good comment to add.
Closes #14415
The device metric dimensions only match the element bounding boxes if the page scale is 1. This PR takes the dimensions of the document element after the viewport is expanded to ensure the element bounding boxes line up with the screenshot.