Collect coverage information for the integration tests#21173
Collect coverage information for the integration tests#21173timvandermeij wants to merge 1 commit intomozilla:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21173 +/- ##
===========================================
+ Coverage 55.92% 74.54% +18.61%
===========================================
Files 220 254 +34
Lines 58990 64614 +5624
===========================================
+ Hits 32993 48167 +15174
+ Misses 25997 16447 -9550
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
24e380c to
2f29315
Compare
2f29315 to
f39eb0f
Compare
f39eb0f to
68e44a4
Compare
68e44a4 to
9976a72
Compare
d94f5a8 to
647edd5
Compare
647edd5 to
76fa3a3
Compare
76fa3a3 to
42084e2
Compare
42084e2 to
12ea70d
Compare
12ea70d to
4523554
Compare
|
Possibly a stupid idea: Given how slow the Windows/Chrome integration-tests become, how about keeping that particular combination running without |
I'm not opposed. |
|
The failing integration-test actually looks like a pre-existing intermittent failure, given that the very same test just failed in PR #21214 for the same OS/browser combination. Maybe that test should be marked as |
|
Thank you for reporting this. I have done some digging into this intermittent and created #21217 for it: fortunately it's reproducible locally and it's clear what the problem is (duplicated text layer content for page editing operations), but I haven't been able to figure out how that can happen yet. In any case, it's not a blocker for this PR because it's a pre-existing issue. This PR is mostly ready, but there are a few things left I need to fix before putting this up for review. |
Note that for the integration tests the coverage information ends up being processed in the Node.js context where `window` is not available, so we use `globalThis` instead for the function that merges individual test's coverage information into the global object because that is available in all contexts we support. For clarity we also rename said function since we're not exclusively dealing with `window` nor worker data anymore.
|
#21217 is fixed, so I have rebased this PR and included the final changes I still needed to make here, so it should be ready for review now. |
| // WebDriver BiDi protocol, otherwise Puppeteer's own serialization logic | ||
| // kicks in and that is a lot slower (see also upstream issue | ||
| // https://github.com/puppeteer/puppeteer/issues/2427). | ||
| return window.__coverage__ ? JSON.stringify(window.__coverage__) : null; |
There was a problem hiding this comment.
You overlooked worker coverage, right ?
There was a problem hiding this comment.
Hm, good point; looks like I did. I'll have to think a bit about how to do that here.
There was a problem hiding this comment.
You could have something like in closeSinglePage:
const result = await page.evaluate(async () => {
let workerCoverage = null;
const handler =
window.PDFViewerApplication.pdfDocument?._transport?.messageHandler;
if (handler) {
try {
workerCoverage = await handler.sendWithPromise("GetWorkerCoverage", null);
} catch {}
}
await window.PDFViewerApplication.testingClose();
window.localStorage.clear();
return {
page: window.__coverage__ ? JSON.stringify(window.__coverage__) : null,
worker: workerCoverage ? JSON.stringify(workerCoverage) : null,
};
});
if (result.page) mergeCoverageIntoGlobal(JSON.parse(result.page));
if (result.worker) mergeCoverageIntoGlobal(JSON.parse(result.worker));
Note that for the integration tests the coverage information ends up being processed in the Node.js context where
windowis not available, so we useglobalThisinstead for the function that merges individual test's coverage information into the global object because that is available in all contexts we support. For clarity we also rename said function since we're not exclusively dealing withwindownor worker data anymore.