Features
/*
* @param {'up' | 'down' | 'left' | 'right'} direction - direction to swipe
* @param {'fast' | 'slow'} [speed] - swipe speed
* @param {number} [normalizedSwipeOffset] - swipe amount relative to the screen width/height
* @param {number} [normalizedStartingPointX] - X coordinate of swipe starting point, relative to the view width
* @param {number} [normalizedStartingPointY] - Y coordinate of swipe starting point, relative to the view height
*/
function swipe(
direction,
speed = 'fast',
normalizedSwipeOffset = NaN, // NaN - use optimal value by default
normalizedStartingPointX = NaN, // NaN - use optimal value by default
normalizedStartingPointY = NaN // NaN - use optimal value by default
) {}
Usage:
await element(by.id('someScrollView')).swipe('up');
await element(by.id('someScrollView')).swipe('down', 'slow');
await element(by.id('someScrollView')).swipe('left', 'fast', 0.95);
await element(by.id('someScrollView')).swipe('right', 'slow', NaN, 0.3);
await element(by.id('someScrollView')).swipe('up', 'fast', undefined, 0.5, 0.95);