From 9e5db3758a93aa6877237e37c14056bd89e24920 Mon Sep 17 00:00:00 2001 From: "farhan.labib" Date: Tue, 12 May 2026 13:01:37 +0600 Subject: [PATCH] fix: respect autoAppLaunch config option in test fixture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The autoAppLaunch config option was already honoured by the launcher (installAndLaunchApps), but the @mobilewright/test fixture ignored it and always terminated + relaunched the app before every test whenever bundleId was set. This adds autoAppLaunch as a proper fixture option (read from config, overridable per-test) and guards the terminate/launch block so that setting autoAppLaunch: false skips the relaunch — leaving the app in whatever state it is already in. --- packages/test/src/fixtures.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/test/src/fixtures.ts b/packages/test/src/fixtures.ts index 56ded3e..c556afa 100644 --- a/packages/test/src/fixtures.ts +++ b/packages/test/src/fixtures.ts @@ -31,6 +31,7 @@ async function attachVideo(testInfo: TestInfo, url: string | undefined, localPat type MobilewrightTestFixtures = { screen: Screen; bundleId: string | undefined; + autoAppLaunch: boolean | undefined; platform: 'ios' | 'android' | undefined; deviceName: RegExp | undefined; device: Device; @@ -50,10 +51,15 @@ export const test = base.extend({ await use(config.bundleId); }, { option: true }], + autoAppLaunch: [async ({}, use, testInfo) => { + const config = await loadConfig(process.cwd(), testInfo.config.configFile); + await use(config.autoAppLaunch); + }, { option: true }], + platform: [undefined, { option: true }], deviceName: [undefined, { option: true }], - device: async ({ platform, deviceName, bundleId }, use, testInfo) => { + device: async ({ platform, deviceName, bundleId, autoAppLaunch }, use, testInfo) => { const config = await loadConfig(process.cwd(), testInfo.config.configFile); const merged = { ...config, @@ -88,7 +94,7 @@ export const test = base.extend({ } } - if (bundleId) { + if (bundleId && autoAppLaunch !== false) { try { await device.terminateApp(bundleId); } catch {