fix(toHaveScreenshot): fix initial screenshot time (#12576)

Instead of being taken immediately, first screenshot was actually
taken after 1 second.
This commit is contained in:
Andrey Lushnikov 2022-03-08 10:30:14 -07:00 committed by GitHub
parent 18e6aa3f15
commit 497b51ad8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -467,7 +467,7 @@ export class Page extends SdkObject {
if (this.isClosed())
throw new Error('The page has closed');
let comparatorResult: ComparatorResult | undefined;
const screenshotTimeout = pollIntervals.shift() || 1000;
const screenshotTimeout = pollIntervals.shift() ?? 1000;
if (isGeneratingNewScreenshot) {
previous = actual;
actual = await rafrafScreenshot(progress, screenshotTimeout).catch(e => undefined);