From acc0a2ef781574880d1b5f90c6bd7476741e569a Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 8 Apr 2024 12:53:17 +0300 Subject: [PATCH] Support passing playwright browser options --- test/api/TestUtils.ts | 5 +++-- test/playwright/TestUtils.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index 9ebf67b6..cee59cce 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -74,9 +74,10 @@ export function getBrowserType(): playwright.BrowserType { +export function launchBrowser(opts?: playwright.LaunchOptions): Promise { const browserType = getBrowserType(); - const options: Record = { + const options: playwright.LaunchOptions = { + ...opts, headless: process.argv.includes('--headless') }; diff --git a/test/playwright/TestUtils.ts b/test/playwright/TestUtils.ts index 1427578c..79408d41 100644 --- a/test/playwright/TestUtils.ts +++ b/test/playwright/TestUtils.ts @@ -492,9 +492,10 @@ export function getBrowserType(): playwright.BrowserType { +export function launchBrowser(opts?: playwright.LaunchOptions): Promise { const browserType = getBrowserType(); - const options: Record = { + const options: playwright.LaunchOptions = { + ...opts, headless: process.argv.includes('--headless') };