diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3c915518..958322aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: - name: Install run: yarn --prefer-offline --frozen-lockfile - name: Tests - run: 'xvfb-run --auto-servernum --server-args="-screen 0, 1920x1080x24" yarn run test:${{matrix.automation}}:${{ matrix.mm-version }} --timeout 50000' + run: 'yarn run test:${{matrix.automation}}:${{ matrix.mm-version }} --timeout 50000' - uses: actions/upload-artifact@v3 if: always() with: diff --git a/src/jest/config.ts b/src/jest/config.ts index ae37f7e9..5a66faf5 100644 --- a/src/jest/config.ts +++ b/src/jest/config.ts @@ -10,6 +10,12 @@ import { DapeteerJestConfig } from "./global"; export const DAPPETEER_DEFAULT_CONFIG: DappeteerLaunchOptions = { metaMaskVersion: RECOMMENDED_METAMASK_VERSION, browser: "chrome", + playwrightOptions: { + headless: true, + }, + puppeteerOptions: { + headless: true, + }, }; export async function getDappeteerConfig(): Promise { diff --git a/src/setup/playwright.ts b/src/setup/playwright.ts index fcec21a1..357ceb3a 100644 --- a/src/setup/playwright.ts +++ b/src/setup/playwright.ts @@ -18,11 +18,12 @@ export async function launchPlaywright( browser = await ( await import("playwright") ).chromium.launchPersistentContext(tmpdir, { - headless: false, + headless: options.playwrightOptions?.headless, args: [ `--disable-extensions-except=${metamaskPath}`, `--load-extension=${metamaskPath}`, ...(options.playwrightOptions?.args || []), + `${options.puppeteerOptions?.headless ? "--headless=chrome" : ""}`, ], ...(options.playwrightOptions ?? {}), }); diff --git a/src/setup/puppeteer.ts b/src/setup/puppeteer.ts index 80f7520c..6a4dbe8e 100644 --- a/src/setup/puppeteer.ts +++ b/src/setup/puppeteer.ts @@ -8,11 +8,12 @@ export async function launchPuppeteer( const pBrowser = await ( await import("puppeteer") ).default.launch({ - headless: false, + headless: options.puppeteerOptions?.headless, args: [ `--disable-extensions-except=${metamaskPath}`, `--load-extension=${metamaskPath}`, ...(options.puppeteerOptions?.args || []), + `${options.puppeteerOptions?.headless ? "--headless=chrome" : ""}`, ], ...(options.puppeteerOptions ?? {}), }); diff --git a/src/types.ts b/src/types.ts index 6cea7ab0..0690dd05 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,8 +21,8 @@ export type DappeteerLaunchOptions = { //fallbacks to installed dependency and prefers playwright if both are installed automation?: "puppeteer" | "playwright"; browser: "chrome"; - puppeteerOptions?: Omit[0], "headless">; - playwrightOptions?: Omit; + puppeteerOptions?: Parameters[0]; + playwrightOptions?: PlaywrightLaunchOptions; }; declare global { diff --git a/test/global.ts b/test/global.ts index ba3846c5..b0026249 100644 --- a/test/global.ts +++ b/test/global.ts @@ -29,6 +29,12 @@ export const mochaHooks = { browser: "chrome", metaMaskVersion: process.env.METAMASK_VERSION || dappeteer.RECOMMENDED_METAMASK_VERSION, + playwrightOptions: { + headless: true, + }, + puppeteerOptions: { + headless: true, + }, }); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment diff --git a/test/global_flask.ts b/test/global_flask.ts index b4c707c3..b330443b 100644 --- a/test/global_flask.ts +++ b/test/global_flask.ts @@ -27,6 +27,12 @@ export const mochaHooks = { metaMaskVersion: process.env.METAMASK_VERSION || dappeteer.RECOMMENDED_METAMASK_VERSION, metaMaskFlask: true, + playwrightOptions: { + headless: true, + }, + puppeteerOptions: { + headless: true, + }, }); const snapServers = await buildSnaps();