mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 11:35:48 +00:00
test: read config before launching XCUIApplication
This commit is contained in:
@@ -15,13 +15,6 @@ class GhosttyCustomConfigCase: XCTestCase {
|
||||
var configFile: URL?
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
guard let customGhosttyConfig else {
|
||||
return
|
||||
}
|
||||
let temporaryConfig = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
|
||||
.appendingPathExtension("ghostty")
|
||||
try customGhosttyConfig.write(to: temporaryConfig, atomically: true, encoding: .utf8)
|
||||
configFile = temporaryConfig
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
@@ -34,10 +27,17 @@ class GhosttyCustomConfigCase: XCTestCase {
|
||||
nil
|
||||
}
|
||||
|
||||
func ghosttyApplication() -> XCUIApplication {
|
||||
func ghosttyApplication() throws -> XCUIApplication {
|
||||
let app = XCUIApplication()
|
||||
app.launchEnvironment["GHOSTTY_CONFIG_PATH"] = configFile?.path
|
||||
app.launchArguments.append(contentsOf: ["-ApplePersistenceIgnoreState", "YES"])
|
||||
guard let customGhosttyConfig else {
|
||||
return app
|
||||
}
|
||||
let temporaryConfig = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
|
||||
.appendingPathExtension("ghostty")
|
||||
try customGhosttyConfig.write(to: temporaryConfig, atomically: true, encoding: .utf8)
|
||||
configFile = temporaryConfig
|
||||
app.launchEnvironment["GHOSTTY_CONFIG_PATH"] = configFile?.path
|
||||
return app
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ final class GhosttyTitleUITests: GhosttyCustomConfigCase {
|
||||
|
||||
@MainActor
|
||||
func testTitle() throws {
|
||||
let app = ghosttyApplication()
|
||||
let app = try ghosttyApplication()
|
||||
app.launch()
|
||||
|
||||
XCTAssert(app.windows.firstMatch.title == "GhosttyUITestsLaunchTests", "Oops, `title=` doesn't work!")
|
||||
|
||||
@@ -17,7 +17,7 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
|
||||
|
||||
@MainActor
|
||||
func testCustomTitlebar() throws {
|
||||
let app = ghosttyApplication()
|
||||
let app = try ghosttyApplication()
|
||||
app.launch()
|
||||
// create a split
|
||||
app.groups["Terminal pane"].typeKey("d", modifierFlags: .command)
|
||||
@@ -31,7 +31,7 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
|
||||
|
||||
@MainActor
|
||||
func testTabsGeometryInNormalWindow() throws {
|
||||
let app = ghosttyApplication()
|
||||
let app = try ghosttyApplication()
|
||||
app.launch()
|
||||
app.groups["Terminal pane"].typeKey("t", modifierFlags: .command)
|
||||
XCTAssert(app.tabs.count == 2, "There should be 2 tabs")
|
||||
@@ -40,7 +40,7 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
|
||||
|
||||
@MainActor
|
||||
func testTabsGeometryInFullscreen() throws {
|
||||
let app = ghosttyApplication()
|
||||
let app = try ghosttyApplication()
|
||||
app.launch()
|
||||
app.typeKey("f", modifierFlags: [.command, .control])
|
||||
// using app to type ⌘+t might not be able to create tabs
|
||||
@@ -51,7 +51,7 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
|
||||
|
||||
@MainActor
|
||||
func testTabsGeometryAfterMovingTabs() throws {
|
||||
let app = ghosttyApplication()
|
||||
let app = try ghosttyApplication()
|
||||
app.launch()
|
||||
// create 3 tabs
|
||||
app.groups["Terminal pane"].typeKey("t", modifierFlags: .command)
|
||||
|
||||
Reference in New Issue
Block a user