Skip to content

Instantly share code, notes, and snippets.

@TuHuynhVan
Created March 14, 2018 09:48
Show Gist options
  • Save TuHuynhVan/a4c3aaa7e17d1702a0891d6465af0992 to your computer and use it in GitHub Desktop.
Save TuHuynhVan/a4c3aaa7e17d1702a0891d6465af0992 to your computer and use it in GitHub Desktop.
class Swipe {
static swipeRight(selector) {
if (!selector) {
browser.touchAction([{action: 'press', x: 0, y: 100}, {action: 'moveTo', x: 200, y: 100}, 'release']);
} else {
let startX = $(selector).getLocation().x;
let endX = startX + 200;
let y = $(selector).getLocation().y;
browser.touchAction([{action: 'press', x: startX, y: y}, {action: 'moveTo', x: endX, y: y}, 'release']);
}
}
}
module.exports = Swipe;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment