From d9ed325818fabcac2450f1a856a797d33cdd835f Mon Sep 17 00:00:00 2001 From: Lars <134181853+bo2themax@users.noreply.github.com> Date: Mon, 27 Oct 2025 10:43:59 +0100 Subject: [PATCH] update config explicitly --- .../GhosttyCustomConfigCase.swift | 23 +++++++++---------- .../GhosttyUITests/GhosttyTitleUITests.swift | 6 ++--- .../GhosttyTitlebarTabsUITests.swift | 15 +++++++----- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/macos/GhosttyUITests/GhosttyCustomConfigCase.swift b/macos/GhosttyUITests/GhosttyCustomConfigCase.swift index d4e2e5b89..709533bcc 100644 --- a/macos/GhosttyUITests/GhosttyCustomConfigCase.swift +++ b/macos/GhosttyUITests/GhosttyCustomConfigCase.swift @@ -23,24 +23,23 @@ class GhosttyCustomConfigCase: XCTestCase { } } - var customGhosttyConfig: String? { - nil - } - - func ghosttyApplication() throws -> XCUIApplication { - let app = XCUIApplication() - app.launchArguments.append(contentsOf: ["-ApplePersistenceIgnoreState", "YES"]) - guard let customGhosttyConfig else { - return app - } + func updateConfig(_ newConfig: String) throws { if let configFile { try FileManager.default.removeItem(at: configFile) } let temporaryConfig = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) .appendingPathExtension("ghostty") - try customGhosttyConfig.write(to: temporaryConfig, atomically: true, encoding: .utf8) + try newConfig.write(to: temporaryConfig, atomically: true, encoding: .utf8) configFile = temporaryConfig - app.launchEnvironment["GHOSTTY_CONFIG_PATH"] = configFile?.path + } + + func ghosttyApplication() throws -> XCUIApplication { + let app = XCUIApplication() + app.launchArguments.append(contentsOf: ["-ApplePersistenceIgnoreState", "YES"]) + guard let configFile else { + return app + } + app.launchEnvironment["GHOSTTY_CONFIG_PATH"] = configFile.path return app } } diff --git a/macos/GhosttyUITests/GhosttyTitleUITests.swift b/macos/GhosttyUITests/GhosttyTitleUITests.swift index e6f6d67e6..01bc64023 100644 --- a/macos/GhosttyUITests/GhosttyTitleUITests.swift +++ b/macos/GhosttyUITests/GhosttyTitleUITests.swift @@ -8,9 +8,9 @@ import XCTest final class GhosttyTitleUITests: GhosttyCustomConfigCase { - - override var customGhosttyConfig: String? { - #"title = "GhosttyUITestsLaunchTests""# + override func setUp() async throws { + try await super.setUp() + try updateConfig(#"title = "GhosttyUITestsLaunchTests""#) } @MainActor diff --git a/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift b/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift index 29694a96b..7f92779e4 100644 --- a/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift +++ b/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift @@ -8,13 +8,16 @@ import XCTest final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase { - override var customGhosttyConfig: String? { - """ - macos-titlebar-style = tabs - title = "GhosttyTitlebarTabsUITests" - """ - } + override func setUp() async throws { + try await super.setUp() + try updateConfig( + """ + macos-titlebar-style = tabs + title = "GhosttyTitlebarTabsUITests" + """ + ) + } @MainActor func testCustomTitlebar() throws { let app = try ghosttyApplication()