KIF crashes app in special case where modal covers stale UITableView containing JCBCollectionView

48 views
Skip to first unread message

mike...@aol.com

unread,
Apr 13, 2016, 9:16:01 AM4/13/16
to KIF iOS Automated Testing Framework
I'll start off by saying that most users will not encounter this.

In our app, we have a view that contains a tableview. Each row embeds a JCBDirectionalCollectionView. 

When a user taps on one of the items (a video) in the JCBDirectionalCollectionView it opens a player View controller as a MODAL. The modal is full screen so that it appears that the table view beneath is no longer visible. To make matters worse, when this modal is open, refreshes to the data in the tableview beneath are queued for performance reasons. This queuing means that the table data can (and usually does) become stale and is not yet reflected in the UI.

Now, when we perform a waitForViewWithAccessibilityLabel on that modal, KIF searches all the views as children of the window including the table view beneath that's not seen. 
This is where things start to get unstable.
When KIF encounters one of these bidirectional collection views that have changed, but the view has not been updated, the app crashes (call stack included way at the bottom).

Our developers have commented that KIF recursively searches the entire view hierarchy from the window down till either the view with the matching predicate is found or the stack is exhausted. They further commented that views have no idea if the view controller that contains them is visible (or not). 

I said all that to ask this: 
If we changed KIF to traverse the views by way of the view controller instead of the window, what unintended side-effects would that create? 
I can imagine cases where windows are transparent, or extended off the screen (scrollable) that might cause KIF to miss views in its search as a result from "waitForViewWith..." API methods and the like.

@BNickel @Phatmann, I'm looking for some ideas to explore or if you've experienced these kinds of issues in the past.


and without further ado...
======= the call stack way at the bottom =======

caught NSInternalInconsistencyException, Invalid item index 5, has only 5 items

(

0   CoreFoundation                      0x26e68007 <redacted> + 150

1   libobjc.A.dylib                     0x357abc8b objc_exception_throw + 38

2   CoreFoundation                      0x26e67ec5 <redacted> + 0

3   Foundation                          0x27b67f73 <redacted> + 86

4   AppUITest                        0x000ea567 -[GridViewDataSet itemAt:itemIndex:] + 2854

5   AppUITest                        0x000e9a19 -[GridViewDataSet itemAtIndexPath:] + 904

6   AppUITest                        0x000fdd1d -[GridViewController contentForItemAtIndexPath:] + 96

7   AppUITest                        0x000f96cd -[GridViewController configureCell:atIndexPath:] + 1280

8   AppUITest                        0x000f9197 -[GridViewController bidirectionalCollectionView:cellForItemAtIndexPath:] + 138

9   AppUITest                        0x001a8d89 -[JCBidirectionalCollectionView bidirectionalCollectionView:cellForItemAtIndexPath:] + 292

10  AppUITest                        0x001aaebd -[JCBidirectionalCollectionView collectionView:cellForItemAtIndexPath:] + 320

11  Func_UIAutomationTests        0x03ff7211 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 4440

12  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

13  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

14  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

15  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

16  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

17  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

18  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

19  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

20  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

21  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

22  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

23  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

24  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

25  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

26  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

27  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

28  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

29  Func_UIAutomationTests        0x03ff6423 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:notHidden:] + 874

30  Func_UIAutomationTests        0x03ff6097 -[UIView(KIFAdditions) accessibilityElementMatchingBlock:] + 78

31  Func_UIAutomationTests        0x03ff57bb -[UIView(KIFAdditions) accessibilityElementWithLabel:accessibilityValue:traits:] + 242

32  Func_UIAutomationTests        0x03ff1f65 -[UIApplication(KIFAdditions) accessibilityElementWithLabel:accessibilityValue:traits:] + 456

33  Func_UIAutomationTests        0x03fefe7f +[UIAccessibilityElement(KIFAdditions) accessibilityElementWithLabel:value:traits:error:] + 202

34  Func_UIAutomationTests        0x03fef8db +[UIAccessibilityElement(KIFAdditions) accessibilityElement:view:withLabel:value:traits:tappable:error:] + 194

35  Func_UIAutomationTests        0x04005063 __110-[KIFUITestActor(ConditionalTests) tryFindingAccessibilityElement:view:withLabel:value:traits:tappable:error:]_block_invoke + 150

36  Func_UIAutomationTests        0x03fff789 -[KIFTestActor tryRunningBlock:complete:timeout:error:] + 192

37  Func_UIAutomationTests        0x04004f89 -[KIFUITestActor(ConditionalTests) tryFindingAccessibilityElement:view:withLabel:value:traits:tappable:error:] + 356

38  Func_UIAutomationTests        0x04004df7 -[KIFUITestActor(ConditionalTests) tryFindingViewWithAccessibilityLabel:value:traits:tappable:error:] + 222

39  Func_UIAutomationTests        0x04004b59 -[KIFUITestActor(ConditionalTests) tryFindingTappableViewWithAccessibilityLabel:error:] + 140

40  Func_UIAutomationTests        0x03fc36d9 -[KIFUITestActor(KIF_Automation_Helper) promiscuouslyNavigateBackToScreenName:WithTimeout:] + 316

41  Func_UIAutomationTests        0x03fc4a69 -[KIFUITestActor(KIF_Automation_Helper) promiscuouslyNavigateBackToGridViewWithTimeout:] + 96

42  Func_UIAutomationTests        0x03f1b1d9 -[VideoPlayerTests afterEach] + 280

43  Func_UIAutomationTests        0x040012cb -[KIFTestCase tearDown] + 134

44  XCTest                              0x00cd1f47 __24-[XCTestCase invokeTest]_block_invoke_2 + 610

45  XCTest                              0x00d017cd -[XCTestContext performInScope:] + 304

46  XCTest                              0x00cd1cdb -[XCTestCase invokeTest] + 182

47  XCTest                              0x00cd228b -[XCTestCase performTest:] + 562

48  XCTest                              0x00ccff21 -[XCTestSuite performTest:] + 468

49  XCTest                              0x00ccff21 -[XCTestSuite performTest:] + 468

50  XCTest                              0x00ccff21 -[XCTestSuite performTest:] + 468

51  XCTest                              0x00cbd3b9 __25-[XCTestDriver _runSuite]_block_invoke + 52

52  XCTest                              0x00cdd101 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 660

53  XCTest                              0x00cbd2f7 -[XCTestDriver _runSuite] + 486

54  XCTest                              0x00cbe091 -[XCTestDriver _checkForTestManager] + 300

55  XCTest                              0x00d02b75 _XCTestMain + 684

56  CoreFoundation                      0x26e2dfd5 <redacted> + 12

57  CoreFoundation                      0x26e2d299 <redacted> + 216

58  CoreFoundation                      0x26e2ba1b <redacted> + 762

59  CoreFoundation                      0x26d78201 CFRunLoopRunSpecific + 476

60  CoreFoundation                      0x26d78013 CFRunLoopRunInMode + 106

61  GraphicsServices                    0x2e849201 GSEventRunModal + 136

62  UIKit                               0x2a544a09 UIApplicationMain + 1440

63  AppUITest                        0x0013f977 main + 134

64  libdyld.dylib                       0x35d5daaf <redacted> + 2

)



Tony Mann

unread,
Apr 23, 2016, 2:09:15 AM4/23/16
to KIF Group
A similar argument was made a while back that KIF should not find views with an alpha of 0. See https://github.com/kif-framework/KIF/issues/190. The response from bnickel: "alpha is simply a one aspect of a view's visibility. A 0 alpha view may still be tappable or announced by a VoiceOver.  hidden is the correct way to make a view "absent”.

So, is the obscured collection view tappable or discoverable by VoiceOver? If not, then KIF is doing it wrong and this should be fixed. Whether that means looking at the state of the view controllers instead of traversing the window/view hierarchy is something we would need to brainstorm about.

I recommend that we open this as an issue in the KIF repo and continue the discussion there.

Tony

--
You received this message because you are subscribed to the Google Groups "KIF iOS Automated Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kif-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages