@@ -1929,6 +1929,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
19291929 Self.cachedIsRunningUnderXCTest
19301930 }
19311931
1932+ private var shouldEnableTitlebarAccessories: Bool {
1933+ let env = ProcessInfo.processInfo.environment
1934+ if env["CMUX_UI_TEST_MODE"] == "1" {
1935+ return true
1936+ }
1937+ return !isRunningUnderXCTest(env)
1938+ }
1939+
19321940 private static func detectRunningUnderXCTest(_ env: [String: String]) -> Bool {
19331941 if env["XCTestConfigurationFilePath"] != nil { return true }
19341942 if env["XCTestBundlePath"] != nil { return true }
@@ -2338,7 +2346,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
23382346 syncMenuBarExtraVisibility()
23392347 updateController.startUpdaterIfNeeded()
23402348 }
2341- if !isRunningUnderXCTest {
2349+ if shouldEnableTitlebarAccessories {
23422350 titlebarAccessoryController.start()
23432351 }
23442352 windowDecorationsController.start()
@@ -8628,7 +8636,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
86288636#endif
86298637
86308638 func attachUpdateAccessory(to window: NSWindow) {
8631- guard !isRunningUnderXCTestCached else { return }
8639+ guard shouldEnableTitlebarAccessories else { return }
86328640 titlebarAccessoryController.start()
86338641 titlebarAccessoryController.attach(to: window)
86348642 }
0 commit comments