Skip to content

Keep deviceName/osVersion filter on sessionPerTest rotated sessions - #9

Merged
jochen-testingbot merged 1 commit into
mainfrom
fix/session-per-test-device-filter
Nov 10, 2026
Merged

jochen-testingbot merged 1 commit into
mainfrom
fix/session-per-test-device-filter

Conversation

@jochen-testingbot

Copy link
Copy Markdown
Contributor

Problem

With sessionPerTest: true, only the first test on each pool slot respected the project's deviceName / osVersion filter. Every later test started a fresh session in connect(). mobilewright 0.0.68's connectDevice() calls connect() with only platform, deviceId, deviceType and timeout, so startFreshSession() picked from every real device on the platform. A customer reported getting a Pixel on Android 7.1 despite osVersion: '>=12' and a deviceName regex.

Fix

  • allocate() (coordinator) appends a slot record to the run log with the slot's deviceType, osVersion and deviceNamePattern. It only does this when sessionPerTest is on.
  • startFreshSession() (worker) looks that record up by the pool deviceId and uses it for the device pick. Values passed directly to connect() still take precedence.

Tests

  • New integration test in test/integration/pool-lifecycle.test.ts: a rotated session keeps the filter. It fails without the fix.
  • FakeHub's device list now has an old "Pixel" on 7.1 first, so an unfiltered pick lands on it.
  • Type-check passes and the full suite passes (133 tests).

mobilewright's connect() only forwards platform/deviceId/deviceType, so
sessions started on rotation picked any matching-platform device. allocate()
now records the slot's criteria in the run log and startFreshSession()
reads them back.
@jochen-testingbot
jochen-testingbot merged commit 3d26375 into main Nov 10, 2026
4 checks passed
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