I'm having difficulty getting `XCUIElementEventSynthesis` methods to consistently work. Here's a sample UI Test:
- (void)testPostingQuestion
{
XCUIApplication *app = [[XCUIApplication alloc] init];
[app.tabBars.buttons[@"discussion"] tap];
XCUIElement *addQuestionButton = app.navigationBars[@"Discussion"].buttons[@"Add"];
[addQuestionButton tap];
XCUIElement *addQuestionTitleTextField = app.textFields[@"Add question title..."];
[addQuestionTitleTextField tap];
[addQuestionTitleTextField typeText:@"Test Question"];
XCUIElement *addQuestionBodyTextView = [app.textViews elementBoundByIndex:0];
[addQuestionBodyTextView tap];
[addQuestionBodyTextView typeText:@"Test Body"];
XCUIElement *postQuestioButton = app.navigationBars[@"add question"].buttons[@"post"];
[postQuestioButton tap];
}
When the event synthesis calls are made, the console outputs...
> t = 4.59s Synthesize event
> t = 4.85s Wait for app to idle
... then hangs for 30 seconds, and finally fails with ...
> UI Testing Failure - App failed to quiesce within 30.0s
The surprising part is that the event synthesis call that fails is different on almost every test run.
Finally, I've discovered that if I watch the simulator during a UI Test and notice that it is pausing for longer-than-expected on a event synthesis call, if I rotate clockwise and then counter-clockwise (or vice versa) the event synthesis will successfully continue onward until the next `tap` event. Maybe my assessment isn't that the synthesized event is hanging, but the "wait for app to idle" never notices that the tab bar controller switched view controllers or a new view controller was pushed on the stack or ... etc. Might this be an accessibility problem with my code (I don't think so, VoiceOver recognizes the transitions just fine)?
Is anyone else noticing similar behavior?
Some background context about the project that may prove helpful:
- The project has been under active development since 2012
- It supports iOS 8 only
- It builds without compiler warnings using the -Weverything flag
- Xcode 7 has "touched" all of the various files it likes auto-modifying (storyboard, xibs, build scheme, etc)
- Xcode 7 has upgraded info.plists and build settings