update config explicitly

This commit is contained in:
Lars
2025-10-27 10:43:59 +01:00
committed by Mitchell Hashimoto
parent 6ada9c7844
commit d9ed325818
3 changed files with 23 additions and 21 deletions

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -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()