import puppeteer from 'puppeteer-core'; import { constants } from 'e2e-test/core/constants'; export const downloadBrowserIfNeeded = async (): Promise => { const browserFetcher = puppeteer.createBrowserFetcher(); const localRevisions = await browserFetcher.localRevisions(); if (localRevisions && localRevisions.length > 0) { console.log('Found a local revision for browser, exiting install.'); return; } console.log('Did not find any local revisions for browser, downloading latest this might take a while.'); await browserFetcher.download(constants.chromiumRevision, (downloaded, total) => { console.log(`Downloaded ${downloaded}bytes of ${total}bytes.`); }); }; beforeAll(async () => { console.log('Checking Chromium'); jest.setTimeout(60 * 1000); await downloadBrowserIfNeeded(); });