Stabilize update UI test flow
This commit is contained in:
parent
03ee628fb6
commit
db17170b26
6 changed files with 97 additions and 32 deletions
|
|
@ -81,6 +81,23 @@ class UpdateController {
|
|||
}
|
||||
}
|
||||
|
||||
/// Check for updates once the updater is ready (used by UI tests).
|
||||
func checkForUpdatesWhenReady(retries: Int = 10) {
|
||||
let canCheck = updater.canCheckForUpdates
|
||||
UpdateLogStore.shared.append("checkForUpdatesWhenReady invoked (canCheck=\(canCheck))")
|
||||
if canCheck {
|
||||
checkForUpdates()
|
||||
return
|
||||
}
|
||||
guard retries > 0 else {
|
||||
UpdateLogStore.shared.append("checkForUpdatesWhenReady timed out")
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in
|
||||
self?.checkForUpdatesWhenReady(retries: retries - 1)
|
||||
}
|
||||
}
|
||||
|
||||
/// Validate the check for updates menu item.
|
||||
func validateMenuItem(_ item: NSMenuItem) -> Bool {
|
||||
if item.action == #selector(checkForUpdates) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue