Skip to content

Commit

Permalink
Fix AccessibilityIdentifierTests_ViewTestActor.testEnteringTextIntoVi…
Browse files Browse the repository at this point in the history
…ewWithAccessibilityIdentifier flaking

We're trying to tap on `Select All` while it is still being animated into view. The problem is two-fold:

1. The `longPress` action doesn't wait for animations to complete, it just uses a hardcoded .5s before starting the next action.
2. Even after switching to use `waitForAnimationsToFinish`, the timeout defaults to .5s as the max to wait for animations to complete.

To fix this, I switched `longPress` action to use `waitForAnimationsToFinish` and I upped the default timeout to wait up to 2s for animations to complete. This seems to work much more reliably now.
  • Loading branch information
justinseanmartin committed Sep 18, 2024
1 parent c3cc4cc commit d1cff7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/KIF/Classes/KIFTestActor.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ - (void)runBlock:(KIFTestExecutionBlock)executionBlock

#pragma mark Class Methods

static NSTimeInterval KIFTestStepDefaultAnimationWaitingTimeout = 0.5;
static NSTimeInterval KIFTestStepDefaultAnimationWaitingTimeout = 2.0;
static NSTimeInterval KIFTestStepDefaultAnimationStabilizationTimeout = 0.5;
static NSTimeInterval KIFTestStepDefaultMainThreadDispatchStabilizationTimeout = 0.5;
static NSTimeInterval KIFTestStepDefaultTimeout = 10.0;
Expand Down
2 changes: 1 addition & 1 deletion Sources/KIF/Classes/KIFUITestActor.m
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ - (void)longPressAccessibilityElement:(UIAccessibilityElement *)element inView:(
}];

// Wait for view to settle.
[self waitForTimeInterval:0.5 relativeToAnimationSpeed:YES];
[self waitForAnimationsToFinish];
}

- (void)waitForKeyboard
Expand Down

0 comments on commit d1cff7d

Please sign in to comment.