diff --git a/src/jest/config.ts b/src/jest/config.ts index ae37f7e9..e481a749 100644 --- a/src/jest/config.ts +++ b/src/jest/config.ts @@ -10,6 +10,14 @@ import { DapeteerJestConfig } from "./global"; export const DAPPETEER_DEFAULT_CONFIG: DappeteerLaunchOptions = { metaMaskVersion: RECOMMENDED_METAMASK_VERSION, browser: "chrome", + playwrightOptions: { + headless: true, + args: ["--headless=chrome"], + }, + puppeteerOptions: { + headless: true, + args: ["--headless=chrome"], + }, }; export async function getDappeteerConfig(): Promise { diff --git a/src/setup/playwright.ts b/src/setup/playwright.ts index 127ce860..add604bf 100644 --- a/src/setup/playwright.ts +++ b/src/setup/playwright.ts @@ -18,12 +18,11 @@ export async function launchPlaywright( browser = await ( await import("playwright") ).chromium.launchPersistentContext(tmpdir, { - headless: true, + headless: options.playwrightOptions?.headless, args: [ `--disable-extensions-except=${metamaskPath}`, `--load-extension=${metamaskPath}`, ...(options.playwrightOptions?.args || []), - `--headless=chrome`, ], ...(options.playwrightOptions ?? {}), }); diff --git a/src/setup/puppeteer.ts b/src/setup/puppeteer.ts index acc3a6f3..ea9f5bd4 100644 --- a/src/setup/puppeteer.ts +++ b/src/setup/puppeteer.ts @@ -8,12 +8,11 @@ export async function launchPuppeteer( const pBrowser = await ( await import("puppeteer") ).default.launch({ - headless: true, + headless: options.puppeteerOptions?.headless, args: [ `--disable-extensions-except=${metamaskPath}`, `--load-extension=${metamaskPath}`, ...(options.puppeteerOptions?.args || []), - `--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 {