Skip to content

Commit 959e8be

Browse files
committed
test: add test for mergeAllWindows
1 parent 1f3fb34 commit 959e8be

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
5454
let app = try ghosttyApplication()
5555
app.launch()
5656
XCTAssertTrue(app.windows.firstMatch.waitForExistence(timeout: 1), "Main window should exist")
57-
// create 3 tabs
57+
// create another 2 tabs
5858
app.groups["Terminal pane"].typeKey("t", modifierFlags: .command)
5959
app.groups["Terminal pane"].typeKey("t", modifierFlags: .command)
6060

@@ -87,6 +87,23 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
8787
checkTabsGeometry(app.windows.firstMatch)
8888
}
8989

90+
@MainActor
91+
func testTabsGeometryAfterMergingAllWindows() throws {
92+
let app = try ghosttyApplication()
93+
app.launch()
94+
XCTAssertTrue(app.windows.firstMatch.waitForExistence(timeout: 1), "Main window should exist")
95+
96+
// create another 2 windows
97+
app.typeKey("n", modifierFlags: .command)
98+
app.typeKey("n", modifierFlags: .command)
99+
100+
// merge into one window, resulting 3 tabs
101+
app.menuItems["mergeAllWindows:"].firstMatch.click()
102+
103+
XCTAssertTrue(app.wait(for: \.tabs.count, toEqual: 3, timeout: 1), "There should be 3 tabs")
104+
checkTabsGeometry(app.windows.firstMatch)
105+
}
106+
90107
func checkTabsGeometry(_ window: XCUIElement) {
91108
let closeTabButtons = window.buttons.matching(identifier: "_closeButton")
92109

@@ -95,7 +112,6 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase {
95112
var previousTabHeight: CGFloat?
96113
for idx in 0 ..< window.tabs.count {
97114
let currentTab = window.tabs.element(boundBy: idx)
98-
XCTAssertTrue(currentTab.waitForExistence(timeout: 1))
99115
// focus
100116
currentTab.click()
101117
// switch to the tab

0 commit comments

Comments
 (0)