I have a navigator structure like so:
stack
drawer
stack
tab
My hierarchy from there is:
view
view
flatlist
I'm trying to get my flatlist to scroll downward. You can see the finger animation but the list isn't moving. You can see it in this gif:
Screen Recording 2018-03-16 at 11.30 p.m..gifHere's my code:
it('should have infinite scrolling', async () => {
await expect(element(by.id('NewsFeed.Scroller'))).toBeVisible();
await expect(element(by.id('NewsFeedScreen.ArticleListing-0'))).toExist();
await expect(element(by.id('NewsFeedScreen.ArticleListing-10'))).toNotExist();
await element(by.id('NewsFeed.Scroller')).scroll(10000, 'down');
await expect(element(by.id('NewsFeedScreen.ArticleListing-10'))).toExist();
});
I believe the issue is that scroll action begins at the bottom of my screen. When I attempt to start a scroll form there myself it does not work either. I'm not seeing anything in the API to allow me to put an offset on where that gesture begins. Looking that element in the inspect reveals that its not in the area which Detox begins its gesture: https://d3vv6lp55qjaqc.cloudfront.net/items/323C3D3U3y1Y2Z1B2L2J/Screen%20Shot%202018-03-16%20at%2023.47.48.png?X-CloudApp-Visitor-Id=2852073&v=31521c3c
I've found a solution which is good enough while we wait for https://github.com/wix/detox/issues/589 to be resolved.
await element(by.id('NewsFeedScreen.ArticleListing-0')).swipe('up', 'fast', 0.9);
Results in the behaviour I'm looking for, scrolling down in my list