Repository navigation
test(zbugs-swift): open a new window on each macOS screenshot-test launch - #236
Merged
Merged
Conversation
…unch A Mac launch of zbugs restores the windows its last run left. When that saved state holds no window, the app opens none, and keeps opening none on every launch until the state changes. That is how CI's macOS testScreens, and the offline run 12 minutes later, each waited two minutes with only a menu bar: zero-cache saw the windowless app ask for its preloads and never for a list, issue, or filter query, so SwiftUI never built the window's views. The tests now launch with -ApplePersistenceIgnoreState YES, so each launch opens a new window instead of restoring the last test's. Amp-Thread-ID: https://ampcode.com/threads/T-01a1ecca-7f5f-74f3-af23-3f0aaa149aa1 Co-authored-by: tmm <tmm@tmm.dev>
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.
On #230, the macOS
testScreenswaited two minutes for a window that never opened, online and again in the offline run 12 minutes later (job 134391266294). The app launched, connected, and answered accessibility queries, but it had only a menu bar, and its Window menu was empty.Cause. A Mac launch of zbugs restores the windows its last run left. When that saved state holds no window, the app opens none, and every later launch does the same until the state changes. That explains both CI symptoms:
How CI's paging test came to leave saved state with no window isn't established. On a Mac, its app always left its window in the saved state, across kills at different moments and torn or damaged state files. The repeat runs below record what CI actually saves.
Fix. The tests launch the macOS app with
-ApplePersistenceIgnoreState YES, so each launch opens a new window instead of restoring what the last test left. As a side effect,testScreensno longer starts from the paging test's restored selection.Checks. On a Mac (macos-26, Xcode 26.3), each run started
testScreensfrom saved state with no window:ScreenshotTests.swift:224, and the UI tree held only the menu bar.The tests then stop at a "New Issue" button that Xcode 26.3 matches twice. CI's Xcode 26.6 passes that step.
CI repeat runs. I ran the macOS sequence 20 times on each branch, from fresh state each round: the paging test, then
testScreens, in one xcodebuild run. Runs 44245082890 (current tests) and 44245087183 (this change).These runs didn't reproduce the failure. In all 40 rounds, neither launch had saved state to restore (
hasPersistentStateToRestore=0), and the paging test left no saved window behind. So the failure needs a saved state that CI rarely produces: 1 of 18 screenshot jobs since #204. The runs show that this change passes CI's macOS sequence. The Mac checks above show that it fixes the windowless case.The iPhone timeout in job 134463464281 is unrelated and not fixed here.