Skip to content

Commit 0676ab9

Browse files
committed
test(macos): await Talk overlay animation completion
1 parent ff8b569 commit 0676ab9

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎apps/macos/Tests/OpenClawIPCTests/TalkOverlayTests.swift‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import AppKit
2+
import QuartzCore
23
import SwiftUI
34
import Testing
45
@testable import OpenClaw
@@ -16,10 +17,18 @@ struct TalkOverlayTests {
1617
})
1718
defer { window.orderOut(nil) }
1819

19-
controller.dismiss()
20-
controller.present()
21-
if dismissAgain { controller.dismiss() }
22-
try await Task.sleep(for: .milliseconds(400))
20+
await withCheckedContinuation { (continuation: CheckedContinuation<Void, Never>) in
21+
NSAnimationContext.runAnimationGroup { _ in
22+
controller.dismiss()
23+
controller.present()
24+
if dismissAgain { controller.dismiss() }
25+
} completionHandler: {
26+
// The factory queues its dismissal completion on MainActor after AppKit finishes.
27+
Task { @MainActor in continuation.resume() }
28+
}
29+
// Commit animations without relying on the test runner's next run-loop iteration.
30+
CATransaction.flush()
31+
}
2332

2433
#expect(controller.model.isVisible == !dismissAgain)
2534
#expect(window.isVisible == !dismissAgain)

0 commit comments

Comments
 (0)