1

I have a `UICollectionView', in which I'm able to scroll downward, but can't scroll upward. I'm not sure if I'm missing something very simple - Here's the code below:

(The formatting was weird, so here's a screenshot)

enter image description here

The first block executes perfectly, but the app won't scroll up again, and the button I need to tap remains offscreen.

Edit: Tried adding grey_sufficientlyVisible as per @gran_profaci, and still unable to find the element.

no UI element matching (matcherForSufficientlyVisible(>=0.750000) && (respondsToSelector(accessibilityIdentifier) && accessibilityID("bar"))) was found. But, it still exists in the logged hierarchy.

enter image description here

ArielSD
  • 829
  • 10
  • 27
  • Could you possibly provide the error that you're seeing? I'm suspecting that the issue is that the element is present in the hierarchy, but is not yet visible. – gran_profaci Jan 31 '17 at 00:08

1 Answers1

2

Here's a simple test that you could do with EarlGrey - set up a Table View or use EarlGrey's FunctionalTestApp and try scrolling to one content edge and then back. In the middle of one of the scrolls, pause the test and add the following to the debug console:

po [GREYElementHierarchy hierarchyStringForAllUIWindows]

What you might notice is that in the hierarchy, there might be a few cells that are not visible on the screen. When you used the scrolling search action to find grey_accessibilityID(@"bar"), you're searching to ensure only that the cell is present in the hierarchy and not if you can see / interact with it.

Please add grey_sufficientlyVisible() to the grey_accessibilityID(@"...") matchers and see what you get.

gran_profaci
  • 8,087
  • 15
  • 66
  • 99
  • Thanks so much for the response. I'm still getting this error, after adding `grey_interactable()`: `Exception: NoMatchingElementException Reason: Assertion 'assertWithMatcher: interactable' was not performed because no UI element matching ((respondsToSelector(accessibilityIdentifier) && accessibilityID("bar")) && interactable) was found. ` In the hierarchy, I can see that the button exists. I think it may be in the bounds of the screen, but there is another view obscuring it, that's why I'm trying to scroll it into view. Any ideas? – ArielSD Jan 31 '17 at 17:18
  • Why did you add grey_interactable()? That only ensures that the element present has it's activation point in the window's frame, but nothing about it being visible. Could you add grey_sufficientlyVisible() ? – gran_profaci Jan 31 '17 at 21:33
  • 1
    That's cool, I didn't know that! I'll include that in an edit, so I don't muddy up the comments. – ArielSD Jan 31 '17 at 22:43