Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions lib/helper/Appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let webdriverio;

const fs = require('fs');
const axios = require('axios').default;
const { v4: uuidv4 } = require('uuid');

const Webdriver = require('./WebDriver');
const AssertionFailedError = require('../assert/error');
Expand Down Expand Up @@ -1088,17 +1089,40 @@ class Appium extends Webdriver {
* Appium: support Android and iOS
*/
async performSwipe(from, to) {
await this.browser.touchPerform([{
action: 'press',
options: from,
}, {
action: 'wait',
options: { ms: 1000 },
}, {
action: 'moveTo',
options: to,
}, {
action: 'release',
await this.browser.performActions([{
id: uuidv4(),
type: 'pointer',
parameters: {
pointerType: 'touch',
},
actions: [
{
duration: 0,
x: from.x,
y: from.y,
type: 'pointerMove',
origin: 'viewport',
},
{
button: 1,
type: 'pointerDown',
},
{
duration: 200,
type: 'pause',
},
{
duration: 600,
x: to.x,
y: to.y,
type: 'pointerMove',
origin: 'viewport',
},
{
button: 1,
type: 'pointerUp',
},
],
}]);
await this.browser.pause(1000);
}
Expand Down Expand Up @@ -1128,7 +1152,7 @@ class Appium extends Webdriver {
yoffset = 100;
}

return this.swipe(locator, 0, yoffset, speed);
return this.swipe(parseLocator.call(this, locator), 0, yoffset, speed);
}

/**
Expand Down