3

Suppose you have a tableView or fileListView, and you would like to perform a pull to refresh action on the same. Tried performing with swipe and scroll, there was no result initially.

Arjun Kalidas
  • 919
  • 9
  • 14

1 Answers1

6
EarlGrey().selectElementWithMatcher(grey_accessibilityID("some element id")).atIndex(0).performAction(grey_swipeSlowInDirectionWithStartPoint(.Down, 0.7, 0.7))

atIndex(0) is context specific. In my case, I had a list view and I hooked on to the first element and did a slow swipe down. Similarly, the value '0.7' is also relative, you can change those to 0.1, 0.3, etc and try out yourself.

Arjun Kalidas
  • 919
  • 9
  • 14
  • Swipe fast just does a fast pull, but you won't see a spinner as well as data updation. It didn't have any effect on my app. But slow with these values I have mentioned for x and y worked. – Arjun Kalidas Oct 24 '16 at 17:42
  • It worked, but I needed slightly different values for the start point to get a refresh: grey_swipeSlowInDirectionWithStartPoint(.Down, 0.5, 0.5) – John M. P. Knox Nov 29 '16 at 00:04