CodeceptJS
CodeceptJS copied to clipboard
Method `swipe` and derivatives are broken
Faced that
await I.swipe('correct-locator', -100, 1, 50);
do nothing
while debugging I add log inside performSwipe
console.log("!performSwipe!", from, to);
and find that destination is incorrect
!performSwipe! { x: 176, y: 1544 } { x: NaN, y: NaN }
problem is here: https://github.com/codeceptjs/CodeceptJS/blob/master/lib/helper/Appium.js#L928
when you do await res.getLocation().x it works like await (res.getLocation().x) but you need (await res.getLocation()).x
So the correct return is:
return this.performSwipe(await res.getLocation(), { x: (await res.getLocation()).x + xoffset, y: (await res.getLocation()).y + yoffset });