test: wait for finishedLaunching before returning from launch helper#310
Merged
Conversation
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.
36d8d5d to
ed0c858
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the intermittent
SQRLTerminationListenerSpecfailures the matrix CI surfaced (#305, #306).launchApplicationAtURL:returns immediately while the spawned process is still doing itsNSApplicationstartup.-[SQRLTerminationListener waitForTermination]then callsrunningApplicationsWithBundleIdentifier:— 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 == YESfrom the start (one-instance test)completedgoing true after only one of two terminates (multi-instance — listener only saw one app at subscribe time)Block in the fixture until
app.finishedLaunchingso every caller (these two specs plus the sevenSKIP_IF_RUNNING_ON_TRAVIS-taggedSQRLUpdaterSpeccases) sees a stable starting state.