mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2026-04-06 03:00:07 +02:00
♻️ UITestCase.launch now waits for status item to be enabled
This commit is contained in:
@@ -19,10 +19,19 @@ class UITestCase: XCTestCase {
|
|||||||
app.withConfiguration(config)
|
app.withConfiguration(config)
|
||||||
app.launch()
|
app.launch()
|
||||||
|
|
||||||
|
let statusItem = app.statusItems.firstMatch
|
||||||
|
let isEnabled = NSPredicate(format: "isEnabled == true")
|
||||||
|
let expectation = expectation(for: isEnabled, evaluatedWith: statusItem, handler: nil)
|
||||||
|
let result = XCTWaiter().wait(for: [expectation], timeout: 15)
|
||||||
|
|
||||||
|
if result == .timedOut {
|
||||||
|
XCTFail("PHP Monitor did not initialize with an available UI element within 15 seconds.")
|
||||||
|
}
|
||||||
|
|
||||||
// Note: If this fails here, make sure the menu bar item can be displayed
|
// Note: If this fails here, make sure the menu bar item can be displayed
|
||||||
// If you use Bartender or something like this, this item may be hidden and tests will fail
|
// If you use Bartender or something like this, this item may be hidden and tests will fail
|
||||||
if openMenu {
|
if openMenu {
|
||||||
app.statusItems.firstMatch.click()
|
statusItem.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|||||||
Reference in New Issue
Block a user