-
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
tests(full-page-screenshot): add node verification and debug tool #15324
Conversation
import * as puppeteer from 'puppeteer-core'; | ||
import {getChromePath} from 'chrome-launcher'; | ||
|
||
import * as LH from '../../../../types/lh.js'; |
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 shouldn't be necessary for a test file
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.
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.
Ah this test is excluded in the tsconfig.json
, so the normal LH
global isn't available. I guess this is fine for now.
@@ -202,4 +208,338 @@ describe('FullPageScreenshot gatherer', () => { | |||
} | |||
); | |||
}); |
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 tests are good, but IMO should completely replace the old test cases. I understand not doing that to make the diff cleaner in this PR tho.
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.
But they test different things, why would we remove the existing ones?
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.
The existing ones are only as good as our ability to simulate how the browser handles DPR, page scale, and CDP emulation together. IMO we are never going to get that right so we should just rely on these new e2e tests (and smoke tests) to get this right.
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.
Bump, could be a follow-up but I still think the old test cases should be converted to smoke tests or this kind of test
const row = []; | ||
debugData.push(row); | ||
|
||
for (let x = node.left; x <= right; x++) { |
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 seems a lot like a re-implementation of existing pixel matchers. Could we leverage something like expect-mocha-image-snapshot
to do the image diffs for us? We use something similar in LHCI and I found it very helpful to review image diffs in Github that way.
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 doing outline detection here, not just a image snapshot. I think this must be a bespoke implementation.
@@ -202,4 +208,338 @@ describe('FullPageScreenshot gatherer', () => { | |||
} | |||
); | |||
}); |
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.
Bump, could be a follow-up but I still think the old test cases should be converted to smoke tests or this kind of test
core/scripts/full-page-screenshot-debug.js
to markup a FPS screenshot with its nodes. Some examples: