Skip to content

Commit cc17322

Browse files
OrKoNDevtools-frontend LUCI CQ
authored andcommitted
Fix screenshot error message
The timer was not cancelled resulting in the error message "Could not take screenshots within X ms" being always printed. Bug: none Change-Id: Ibb81ad1b60f185a3704ba61ad7ab783453201fc3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6072805 Commit-Queue: Alex Rudenko <[email protected]> Auto-Submit: Alex Rudenko <[email protected]> Reviewed-by: Simon Zünd <[email protected]> Commit-Queue: Simon Zünd <[email protected]>
1 parent 789751e commit cc17322

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/conductor/mocha-interface-helpers.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ async function takeScreenshots(): Promise<{target?: string, frontend?: string}>
6262
}
6363

6464
async function createScreenshotError(error: Error): Promise<Error> {
65-
console.error('Taking screenshots for the error', error);
65+
console.error('Taking screenshots for the error:', error);
6666
if (!TestConfig.debug) {
6767
const screenshotTimeout = 5_000;
68+
let timer: NodeJS.Timeout;
6869
const {target, frontend} = await Promise.race([
69-
takeScreenshots(),
70+
takeScreenshots().then(result => {
71+
clearTimeout(timer);
72+
return result;
73+
}),
7074
new Promise(resolve => {
71-
setTimeout(resolve, screenshotTimeout);
75+
timer = setTimeout(resolve, screenshotTimeout);
7276
}).then(() => {
7377
console.error(`Could not take screenshots within ${screenshotTimeout}ms.`);
7478
return {target: undefined, frontend: undefined};

0 commit comments

Comments
 (0)