Skip to content

test: wait for finishedLaunching before returning from launch helper#310

Merged
MarshallOfSound merged 1 commit into
mainfrom
sam/deflake-termination-listener
May 3, 2026
Merged

test: wait for finishedLaunching before returning from launch helper#310
MarshallOfSound merged 1 commit into
mainfrom
sam/deflake-termination-listener

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Collaborator

Fixes the intermittent SQRLTerminationListenerSpec failures the matrix CI surfaced (#305, #306).

launchApplicationAtURL: returns immediately while the spawned process is still doing its NSApplication startup. -[SQRLTerminationListener waitForTermination] then calls runningApplicationsWithBundleIdentifier: — if the app hasn't checked in with Launch Services yet, that returns an empty array and the signal completes immediately.

Both observed failure modes are this same window:

  • observedApp == nil + completed == YES from the start (one-instance test)
  • completed going true after only one of two terminates (multi-instance — listener only saw one app at subscribe time)

Block in the fixture until app.finishedLaunching so every caller (these two specs plus the seven SKIP_IF_RUNNING_ON_TRAVIS-tagged SQRLUpdaterSpec cases) sees a stable starting state.

launchApplicationAtURL: returns immediately while the spawned process is
still starting up. SQRLTerminationListener (and any other caller of
runningApplicationsWithBundleIdentifier:) queries Launch Services before
the app has checked in, sees zero matches, and completes immediately.

Block until app.finishedLaunching so every test that launches the
fixture observes a stable starting state. Covers both flaky cases in
SQRLTerminationListenerSpec.
@MarshallOfSound MarshallOfSound force-pushed the sam/deflake-termination-listener branch from 36d8d5d to ed0c858 Compare May 3, 2026 00:09
@MarshallOfSound MarshallOfSound merged commit e542f2f into main May 3, 2026
9 checks passed
@MarshallOfSound MarshallOfSound deleted the sam/deflake-termination-listener branch May 3, 2026 03:20
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