Skip to content

fix: respect autoAppLaunch config option in test fixture#110

Open
farhanlabib wants to merge 1 commit into
mobile-next:mainfrom
farhanlabib:fix/auto-app-launch-fixture
Open

fix: respect autoAppLaunch config option in test fixture#110
farhanlabib wants to merge 1 commit into
mobile-next:mainfrom
farhanlabib:fix/auto-app-launch-fixture

Conversation

@farhanlabib
Copy link
Copy Markdown
Contributor

Problem

autoAppLaunch: false in mobilewright.config was silently ignored by the @mobilewright/test fixture. Even with the option set, the fixture always called terminateApp + launchApp before every test whenever bundleId was configured.

The option was only respected in the launcher path (installAndLaunchApps), not in the test fixture.

Fix

  • Added autoAppLaunch as a proper fixture option (reads from config, overridable per-test — consistent with how bundleId works)
  • Threaded it into the device fixture
  • Guarded the terminate/launch block: the app is only relaunched when autoAppLaunch !== false

Behaviour

Config Before After
bundleId set, no autoAppLaunch relaunches app (default) relaunches app (default) ✓
bundleId set, autoAppLaunch: true relaunches app relaunches app ✓
bundleId set, autoAppLaunch: false relaunches app ✗ skips relaunch ✓

Use case

Useful for development workflows and test suites where the app is already in the foreground and a cold restart is undesirable (e.g. preserving session state, faster iteration).

// mobilewright.config.ts
export default defineConfig({
  platform: 'android',
  bundleId: 'com.example.app',
  autoAppLaunch: false, // now actually works
});

@farhanlabib farhanlabib force-pushed the fix/auto-app-launch-fixture branch from 8e5ffba to a609c89 Compare May 10, 2026 10:36
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.
@farhanlabib farhanlabib force-pushed the fix/auto-app-launch-fixture branch from a609c89 to 9e5db37 Compare May 12, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant