File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Sources/Hammer/EventGenerator Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -11,5 +11,12 @@ extension EventGenerator {
1111
1212 /// The delay to wait after activating the accessibility engine for the first time in a simulator.
1313 public var accessibilityActivateFirstTimeDelay : TimeInterval = 5.0
14+
15+ /// The accessibility engine is required for finding accessibility labels. We proactively enable it
16+ /// to avoid issues with the first test case that uses it.
17+ public var forceActivateAccessibilityEngine : Bool = true
18+
19+ /// If we should wait for animations to complete when an event generator is created.
20+ public var waitForAnimations : Bool = false
1421 }
1522}
Original file line number Diff line number Diff line change @@ -115,6 +115,11 @@ public final class EventGenerator {
115115 do {
116116 try self . waitUntil ( self . isWindowReady, timeout: timeout)
117117 try self . waitUntilAccessibilityActivate ( )
118+
119+ if EventGenerator . settings. waitForAnimations {
120+ try self . waitUntilAnimationsAreFinished ( timeout: timeout)
121+ }
122+
118123 try self . waitUntilRunloopIsFlushed ( timeout: timeout)
119124 } catch {
120125 throw HammerError . windowIsNotReadyForInteraction
@@ -225,6 +230,10 @@ public final class EventGenerator {
225230 private var isAccessibilityActivated = false
226231
227232 private func waitUntilAccessibilityActivate( ) throws {
233+ guard EventGenerator . settings. forceActivateAccessibilityEngine else {
234+ return
235+ }
236+
228237 UIApplication . shared. accessibilityActivate ( )
229238 if self . isAccessibilityActivated {
230239 return
You can’t perform that action at this time.
0 commit comments