chore: avoid evaluates in screenshot on failure (#16386)

This commit is contained in:
Dmitry Gozman 2022-08-09 14:03:07 -07:00 committed by GitHub
parent fa9c20c959
commit 2efe947dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,7 +330,9 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
(page as any)[screenshottedSymbol] = true;
const screenshotPath = path.join(_artifactsDir(), createGuid() + '.png');
temporaryScreenshots.push(screenshotPath);
await page.screenshot({ timeout: 5000, path: screenshotPath }).catch(() => {});
// Pass caret=initial to avoid any evaluations that might slow down the screenshot
// and let the page modify itself from the problematic state it had at the moment of failure.
await page.screenshot({ timeout: 5000, path: screenshotPath, caret: 'initial' }).catch(() => {});
};
const screenshotOnTestFailure = async () => {
@ -432,7 +434,9 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
await Promise.all(context.pages().map(async page => {
if ((page as any)[screenshottedSymbol])
return;
await page.screenshot({ timeout: 5000, path: addScreenshotAttachment() }).catch(() => {});
// Pass caret=initial to avoid any evaluations that might slow down the screenshot
// and let the page modify itself from the problematic state it had at the moment of failure.
await page.screenshot({ timeout: 5000, path: addScreenshotAttachment(), caret: 'initial' }).catch(() => {});
}));
}
}).concat(leftoverApiRequests.map(async context => {