XCUITest tapping-on-permission-dialog throws exceptions when test is built by Xcode 13.2.1 and run on OS older than 13.0
Originator: | dmaclach | ||
Number: | rdar://FB9858932 | Date Originated: | 2022-01-25 |
Status: | Open | Resolved: | |
Product: | Product Version: | ||
Classification: | Reproducible: |
Sending a tap event to a button on a system dialog throws an exception deep inside XCTest if your app is built with Xcode 13.2.1 and is run on iOS 12.x simulators. Testing environment: built by Xcode 13.2.1 and run on iPhone SE 12.4 - failed with exceptions Testing environment: built by Xcode 13.2.1 and run on iPhone SE 13.0 - passed Steps to reproduce: * At launch, app calls [CNContactStore -requestAccessForEntityType:completionHandler:] to trigger Contact permission dialog. * In UI test, launch the app process, then call [[[[[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"] descendantsMatchingType:XCUIElementTypeAlert] firstMatch].buttons[@"OK"] tap]. Expected behavior: the "OK" button of the permission dialog is tapped and dismissed. Actual Behavior: Test failed with error "-[__NSArrayM insertObject:atIndex:]: object cannot be nil (NSInvalidArgumentException)". Stack-trace: 0 CoreFoundation 0x0000000101c278db __exceptionPreprocess + 331 1 libobjc.A.dylib 0x00000001011caac5 objc_exception_throw + 48 2 CoreFoundation 0x0000000101b75fac _CFThrowFormattedException + 194 3 CoreFoundation 0x0000000101b52cb5 -[__NSArrayM insertObject:atIndex:] + 1269 4 XCUIAutomation 0x0000000114d1459f __104-[XCAXClient_iOS interruptingUIElementsAffectingSnapshot:checkForHandledElement:containsHandledElement:]_block_invoke + 1362 5 XCTestCore 0x0000000114e6d9ad -[XCTContext _runActivityNamed:type:block:] + 245 6 XCTestCore 0x0000000114e6cb70 +[XCTContext runInternalActivityNamed:block:] + 244 7 XCUIAutomation 0x0000000114d13f8d -[XCAXClient_iOS interruptingUIElementsAffectingSnapshot:checkForHandledElement:containsHandledElement:] + 451 8 XCUIAutomation 0x0000000114d0069d __93-[XCUIElement(XCUIElementEventSynthesis) _allUIInterruptionsHandledForElementSnapshot:error:]_block_invoke + 115 9 XCTAutomationSupport 0x000000011530266f +[XCTRuntimeIssueContext captureIssuesWithContext:inScope:] + 403 10 XCUIAutomation 0x0000000114d004b5 -[XCUIElement(XCUIElementEventSynthesis) _allUIInterruptionsHandledForElementSnapshot:error:] + 337 11 XCUIAutomation 0x0000000114cff26f -[XCUIElement(XCUIElementEventSynthesis) _dispatchEventWithEventBuilder:error:] + 245 12 XCUIAutomation 0x0000000114cff9f2 __70-[XCUIElement(XCUIElementEventSynthesis) _dispatchEvent:eventBuilder:]_block_invoke + 136 13 XCTestCore 0x0000000114e6d9ad -[XCTContext _runActivityNamed:type:block:] + 245 14 XCTestCore 0x0000000114e6cb70 +[XCTContext runInternalActivityNamed:block:] + 244 15 XCUIAutomation 0x0000000114cff891 -[XCUIElement(XCUIElementEventSynthesis) _dispatchEvent:eventBuilder:] + 242 16 XCUIAutomation 0x0000000114d030d8 -[XCUIElement(XCUIElementTouchEvents) tap] + 435
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!