XCUITest is failed when checking for interrupting elements

Here is log:

Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7 /Volumes/data/workspace/operator/UIOperaterUITests/CommonOnlineCase/NovelOLTests.m:794: error: -[NovelOLTests testGenuineNovelBodyCPUNotFirstTime] : *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil (NSInvalidArgumentException)

You should be able to perform this query without a predicate using the following code: XCUIApplication().alerts["NotificationShortLookView"]

Or, separately: XCUIApplication().alerts.allElementsBoundByIndex to iterate through each element yourself https://developer.apple.com/documentation/xctest/xcuielementquery/1500945-allelementsboundbyindex

The above crash seems to be an issue with the NSPredicate parser, which can be pretty particular in certain scenarios.

Feel free to file a report on Feedback Assistant if you see this issue persist: https://feedbackassistant.apple.com/

0   UIOperaterUITests                   0x0000000106da71ec -[NSArray(InsertExceptionCatcher) iec_insertObject:atIndex:] + 184
1   XCUIAutomation                      0x00000001011dffa8 __104-[XCAXClient_iOS interruptingUIElementsAffectingSnapshot:checkForHandledElement:containsHandledElement:]_block_invoke + 1012
2   XCTestCore                          0x0000000100c1bff0 -[XCTContext _runActivityNamed:type:block:] + 256
3   XCTestCore                          0x0000000100c1b184 +[XCTContext runInternalActivityNamed:block:] + 276
4   XCUIAutomation                      0x00000001011dfaec -[XCAXClient_iOS interruptingUIElementsAffectingSnapshot:checkForHandledElement:containsHandledElement:] + 424
5   XCUIAutomation                      0x00000001011cb83c __93-[XCUIElement(XCUIElementEventSynthesis) _allUIInterruptionsHandledForElementSnapshot:error:]_block_invoke + 136
6   XCTAutomationSupport                0x0000000100a09e34 +[XCTRuntimeIssueContext captureIssuesWithContext:inScope:] + 396
7   XCUIAutomation                      0x00000001011cb65c -[XCUIElement(XCUIElementEventSynthesis) _allUIInterruptionsHandledForElementSnapshot:error:] + 384
8   XCUIAutomation                      0x00000001011ca45c -[XCUIElement(XCUIElementEventSynthesis) _dispatchEventWithEventBuilder:error:] + 264
9   XCUIAutomation                      0x00000001011cabd4 __70-[XCUIElement(XCUIElementEventSynthesis) _dispatchEvent:eventBuilder:]_block_invoke + 132
10  XCTestCore                          0x0000000100c1bff0 -[XCTContext _runActivityNamed:type:block:] + 256
11  XCTestCore                          0x0000000100c1b184 +[XCTContext runInternalActivityNamed:block:] + 276
12  XCUIAutomation                      0x00000001011caa80 -[XCUIElement(XCUIElementEventSynthesis) _dispatchEvent:eventBuilder:] + 252
13  XCUIAutomation                      0x00000001011cdfd8 -[XCUIElement(XCUIElementTouchEvents) tap] + 464
14  UIOperaterUITests                   0x0000000106dcc750 -[Launch testFirstLaunch] + 1612
15  CoreFoundation                      0x00000001af679b24 6B22DD81-3585-3BE6-BC77-BA19810EC0F2 + 138020
16  CoreFoundation                      0x00000001af697610 6B22DD81-3585-3BE6-BC77-BA19810EC0F2 + 259600
17  XCTestCore                          0x0000000100c4d174 +[XCTFailableInvocation invokeStandardConventionInvocation:completion:] + 88
18  XCTestCore                          0x0000000100c4d114 __65+[XCTFailableInvocation invokeInvocation:lastObservedErrorIssue:]_block_invoke_3 + 28
19  XCTestCore                          0x0000000100c4c928 __81+[XCTFailableInvocation invokeWithAsynchronousWait:lastObservedErrorIssue:block:]_block_invoke.13 + 112
20  XCTestCore                          0x0000000100c0310c +[XCTSwiftErrorObservation observeErrorsInBlock:] + 92
21  XCTestCore                          0x0000000100c4c780 +[XCTFailableInvocation invokeWithAsynchronousWait:lastObservedErrorIssue:block:] + 500
22  XCTestCore                          0x0000000100c4cd64 +[XCTFailableInvocation invokeInvocation:lastObservedErrorIssue:] + 388
23  XCTestCore                          0x0000000100c37834 __24-[XCTestCase invokeTest]_block_invoke_2 + 104
24  XCTestCore                          0x0000000100c11d58 -[XCTMemoryChecker _assertInvalidObjectsDeallocatedAfterScope:] + 88
25  XCTestCore                          0x0000000100c4212c -[XCTestCase assertInvalidObjectsDeallocatedAfterScope:] + 116
26  XCTestCore                          0x0000000100c377a0 __24-[XCTestCase invokeTest]_block_invoke.296 + 204
27  XCTestCore                          0x0000000100bfaf10 -[XCTestCase(XCTIssueHandling) _caughtUnhandledDeveloperExceptionPermittingControlFlowInterruptions:caughtInterruptionException:whileExecutingBlock:] + 180
28  XCTestCore                          0x0000000100c372f0 -[XCTestCase invokeTest] + 944
29  XCTestCore                          0x0000000100c38ca8 __26-[XCTestCase performTest:]_block_invoke.423 + 48
30  XCTestCore                          0x0000000100bfaf10 -[XCTestCase(XCTIssueHandling) _caughtUnhandledDeveloperExceptionPermittingControlFlowInterruptions:caughtInterruptionException:whileExecutingBlock:] + 180
31  XCTestCore                          0x0000000100c386dc __26-[XCTestCase performTest:]_block_invoke.397 + 540
32  XCTestCore                          0x0000000100c1c69c +[XCTContext runInContextForTestCase:markAsReportingBase:block:] + 228
33  XCTestCore                          0x0000000100c382cc -[XCTestCase performTest:] + 372
34  XCTestCore                          0x0000000100be8304 -[XCTest runTest] + 64
35  XCTestCore                          0x0000000100c1f9f8 -[XCTestSuite runTestBasedOnRepetitionPolicy:testRun:] + 160
36  XCTestCore                          0x0000000100c1f864 __27-[XCTestSuite performTest:]_block_invoke + 216
37  XCTestCore                          0x0000000100c1f204 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 48
38  XCTestCore                          0x0000000100c1c69c +[XCTContext runInContextForTestCase:markAsReportingBase:block:] + 228
39  XCTestCore                          0x0000000100c1f1a0 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 192
40  XCTestCore                          0x0000000100c1f4dc -[XCTestSuite performTest:] + 240
41  XCTestCore                          0x0000000100be8304 -[XCTest runTest] + 64
42  XCTestCore                          0x0000000100c1f9f8 -[XCTestSuite runTestBasedOnRepetitionPolicy:testRun:] + 160
43  XCTestCore                          0x0000000100c1f864 __27-[XCTestSuite performTest:]_block_invoke + 216
44  XCTestCore                          0x0000000100c1f204 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 48
45  XCTestCore                          0x0000000100c1c69c +[XCTContext runInContextForTestCase:markAsReportingBase:block:] + 228
46  XCTestCore                          0x0000000100c1f1a0 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 192
47  XCTestCore                          0x0000000100c1f4dc -[XCTestSuite performTest:] + 240
48  XCTestCore                          0x0000000100be8304 -[XCTest runTest] + 64
49  XCTestCore                          0x0000000100c1f9f8 -[XCTestSuite runTestBasedOnRepetitionPolicy:testRun:] + 160
50  XCTestCore                          0x0000000100c1f864 __27-[XCTestSuite performTest:]_block_invoke + 216
51  XCTestCore                          0x0000000100c1f204 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 48
52  XCTestCore                          0x0000000100c1c69c +[XCTContext runInContextForTestCase:markAsReportingBase:block:] + 228

It's crashed when the framework tried to deal with the system alert which should have done by the handler of "UIInterruptionMonitor". And it seems that this error is happen inside the framework because that the program did not get inside the handler block.

XCUITest is failed when checking for interrupting elements
 
 
Q