Enable parallel UI test execution via per-session data isolation

Each test class now gets a unique session ID (UUID) passed to the app
via UI_TEST_SESSION_ID environment variable. The app uses this to:

- Route GroupUserDefaults to a session-specific UserDefaults suite,
  preventing tests from clobbering each other's AppStorage state
- Create an in-memory SwiftData container instead of the shared
  on-disk App Group store, eliminating SQLite contention

Refactored 8 test classes that bypassed BaseUITestCase.setUp() with
custom launch args — they now use overridable `localeArguments` and
`extraLaunchArguments` properties, keeping session ID injection
centralized. Added `relaunchApp(resetState:bypassSubscription:)` to
BaseUITestCase for tests that need mid-test relaunch with different
subscription state.

Includes a ParallelUITests.xctestplan with class-level parallelism
enabled and random execution ordering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-03-24 15:04:55 -05:00
parent 8231750cff
commit 2ef1c1ec51
13 changed files with 128 additions and 145 deletions

View File

@@ -20,20 +20,8 @@ final class TrialBannerTests: BaseUITestCase {
settingsScreen.assertVisible()
// With default settings (bypassSubscription = true), the banner is hidden.
// We need to launch without bypass to see the banner.
// Re-launch with bypass disabled.
app.terminate()
let freshApp = XCUIApplication()
var args = ["--ui-testing", "--reset-state", "--disable-animations", "--skip-onboarding",
"-AppleLanguages", "(en)", "-AppleLocale", "en_US"]
// Do NOT add --bypass-subscription
freshApp.launchArguments = args
if let fixture = seedFixture {
freshApp.launchEnvironment = ["UI_TEST_FIXTURE": fixture]
}
freshApp.launch()
app = freshApp
// Re-launch without bypass to see the banner.
relaunchApp(resetState: true, bypassSubscription: false)
// Navigate to Settings
let freshTabBar = TabBarScreen(app: app)