test: wait for command palette rename field to dismiss
This commit is contained in:
parent
82d6086d69
commit
ab1ca8130a
1 changed files with 10 additions and 2 deletions
|
|
@ -322,8 +322,10 @@ final class BrowserPaneNavigationKeybindUITests: XCTestCase {
|
|||
let window = app.windows.firstMatch
|
||||
XCTAssertTrue(window.waitForExistence(timeout: 2.0), "Expected main window for browser-pane click")
|
||||
window.coordinate(withNormalizedOffset: CGVector(dx: 0.82, dy: 0.78)).click()
|
||||
RunLoop.current.run(until: Date().addingTimeInterval(0.2))
|
||||
XCTAssertFalse(renameField.exists, "Expected clicking the browser pane to dismiss the command palette")
|
||||
XCTAssertTrue(
|
||||
waitForNonExistence(renameField, timeout: 5.0),
|
||||
"Expected clicking the browser pane to dismiss the command palette"
|
||||
)
|
||||
|
||||
// Cmd+L behavior is context-aware:
|
||||
// - If terminal is still focused: opens a new browser in that pane.
|
||||
|
|
@ -707,6 +709,12 @@ final class BrowserPaneNavigationKeybindUITests: XCTestCase {
|
|||
return false
|
||||
}
|
||||
|
||||
private func waitForNonExistence(_ element: XCUIElement, timeout: TimeInterval) -> Bool {
|
||||
let predicate = NSPredicate(format: "exists == false")
|
||||
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: element)
|
||||
return XCTWaiter().wait(for: [expectation], timeout: timeout) == .completed
|
||||
}
|
||||
|
||||
private func loadData() -> [String: String]? {
|
||||
guard let data = try? Data(contentsOf: URL(fileURLWithPath: dataPath)) else {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue