diff --git a/cmuxTests/RemoteTmuxMirrorCloseDetachTests.swift b/cmuxTests/RemoteTmuxMirrorCloseDetachTests.swift index b2a339f12939..f875fe047dcf 100644 --- a/cmuxTests/RemoteTmuxMirrorCloseDetachTests.swift +++ b/cmuxTests/RemoteTmuxMirrorCloseDetachTests.swift @@ -489,10 +489,15 @@ import Testing func closeWindow(_ id: UUID) { let identifier = "cmux.main.\(id.uuidString)" + if let manager = appDelegate.tabManagerFor(windowId: id) { + manager.tabs.forEach { $0.teardownAllPanels() } + } if let window = NSApp.windows.first(where: { $0.identifier?.rawValue == identifier }) { - window.performClose(nil) - RunLoop.main.run(until: Date(timeIntervalSinceNow: 0.05)) + appDelegate.suppressClosedWindowHistoryForTesting(windowId: id) + window.close() } + appDelegate.forgetRecoverableMainWindowRoute(windowId: id) + RunLoop.main.run(until: Date(timeIntervalSinceNow: 0.05)) } } }