Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix launchOptions being reset in some test files (#37220)

Dmitry Gozman15a7e7e12e6b
diff --git a/tests/android/android.spec.ts b/tests/android/android.spec.ts
index 1142551d3c..4accaa3cc6 100644
--- a/tests/android/android.spec.ts
+++ b/tests/android/android.spec.ts
@@ -18,7 +18,7 @@ import net from 'net';
import { androidTest as test, expect } from './androidTest';
// Force a separate worker to avoid messing up with `androidDevice` fixture.
-test.use({ launchOptions: {} });
+test.use({ launchOptions: [async ({ launchOptions }, use) => use(launchOptions), { scope: 'worker' }] });
test('androidDevice.close', async function({ playwright }) {
const devices = await playwright._android.devices();
diff --git a/tests/android/launch-server.spec.ts b/tests/android/launch-server.spec.ts
index 21c01b8e4d..bcb51b9ac7 100644
--- a/tests/android/launch-server.spec.ts
+++ b/tests/android/launch-server.spec.ts
@@ -19,7 +19,7 @@ import { androidTest as test, expect } from './androidTest';
import { kTargetClosedErrorMessage } from '../config/errors';
// Force a separate worker to avoid messing up with `androidDevice` fixture.
-test.use({ launchOptions: {} });
+test.use({ launchOptions: [async ({ launchOptions }, use) => use(launchOptions), { scope: 'worker' }] });
test('android.launchServer should connect to a device', async ({ playwright }) => {
const browserServer = await playwright._android.launchServer();
diff --git a/tests/library/debug-controller.spec.ts b/tests/library/debug-controller.spec.ts
index fb560db964..b34f0582e7 100644
--- a/tests/library/debug-controller.spec.ts
+++ b/tests/library/debug-controller.spec.ts
@@ -78,7 +78,7 @@ test.skip(({ mode }) => mode.startsWith('service') || mode === 'driver');
// Force a separate worker to avoid registered selector engines from other tests.
// See https://github.com/microsoft/playwright/pull/37103.
-test.use({ launchOptions: {} });
+test.use({ launchOptions: [async ({ launchOptions }, use) => use(launchOptions), { scope: 'worker' }] });
test('should pick element', async ({ backend, connectedBrowser }) => {
const events = [];