Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.moveTo({x:3, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:3, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:2, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.moveTo({x:1, y:-1})
.release();
var ma = new wd.MultiAction().add(a1, a2, smile);
return driver.performMultiAction(ma)
// so you can see it
.sleep(10000)
.back().sleep(1000)
.back().sleep(1000);
});
});
.then(function (el) {
var multiAction = (new MultiAction()).add(
(new TouchAction()).press({el: el}).moveTo({el: el, x: 25, y: 25 })
.wait(3000).moveTo({el: el, x: 100, y: 100 }).release(),
(new TouchAction()).press({el: el}).moveTo({el: el, x: 100, y: 0 })
.wait({ ms: 3000 }).moveTo({el: el, x: 0, y: 0 }).release()
);
return driver.performMultiAction(multiAction);
})
.nodeify(done);
it('should scroll two different lists', async function () {
let [leftEl, rightEl] = await driver.elementsByClassName('android.widget.ListView');
const leftGesture = new wd.TouchAction()
.press({element: leftEl})
.moveTo({element: leftEl, x: 10, y: 0})
.moveTo({element: leftEl, x: 10, y: -75})
.moveTo({element: leftEl, x: 10, y: -150});
const rightGesture = new wd.TouchAction()
.press({element: rightEl})
.moveTo({element: rightEl, x: 10, y: 0})
.moveTo({element: rightEl, x: 10, y: -75})
.moveTo({element: rightEl, x: 10, y: -150});
const multiAction = new wd.MultiAction();
multiAction.add(leftGesture, rightGesture);
await driver.performMultiAction(multiAction);
});
});
async function doZoom () {
let el = await driver.elementByClassName('XCUIElementTypeApplication');
let thumb = new wd.TouchAction(driver);
thumb.press({el, x: 100, y: 0}).moveTo({el, x: 50, y: 0}).release();
let foreFinger = new wd.TouchAction(driver);
foreFinger.press({el, x: 100, y: 0}).moveTo({el, x: 105, y: 0}).release();
let zoom = new wd.MultiAction(driver);
zoom.add(thumb, foreFinger);
await zoom.perform();
}
await doZoom();
async function doPinch () {
let el = await driver.elementByClassName('XCUIElementTypeApplication');
let thumb = new wd.TouchAction(driver);
thumb.press({el, x: 50, y: 0}).moveTo({el, x: 100, y: 0}).release();
let foreFinger = new wd.TouchAction(driver);
foreFinger.press({el, x: 100, y: 0}).moveTo({el, x: 50, y: 0}).release();
let pinch = new wd.MultiAction(driver);
pinch.add(thumb, foreFinger);
await pinch.perform();
}
await doPinch();
.then(function (el) {
var a1 = new wd.TouchAction();
a1
.tap({el: el, x: 10, y: 10});
var a2 = new wd.TouchAction();
a2
.tap({el: el});
var m = new wd.MultiAction();
m.add(a1, a2);
return driver.performMultiAction(m);
});
})
var innerArcMulti = function() {
var multi = new MultiAction();
multi.add(
innerArcAction(2*pi/3*1 + pi/3, 2*pi/3*1 + pi + pi/8 + pi/3),
innerArcAction(2*pi/3*2 + pi/3, 2*pi/3*2 + pi + pi/8 + pi/3),
innerArcAction(2*pi/3*3 + pi/3, 2*pi/3*3 + pi + pi/8 + pi/3)
);
return multi;
}
.then(function (el) {
var a1 = new wd.TouchAction();
a1
.tap({el: el, x: 10, y: 10});
var a2 = new wd.TouchAction();
a2
.tap({el: el});
var m = new wd.MultiAction(driver);
m.add(a1, a2);
return m.perform();
});
});
]).then(function (res) {
var size = res[0];
var loc = res[1];
var center = {
x: loc.x + size.width / 2,
y: loc.y + size.height / 2
};
var a1 = new wd.TouchAction(this);
a1.press({el: el}).moveTo({el: el, x: center.x, y: center.y - 100}).release();
var a2 = new wd.TouchAction(this);
a2.press({el: el}).moveTo({el: el, x: center.x, y: center.y + 100}).release();
var m = new wd.MultiAction(this);
m.add(a1, a2);
return m.perform();
}.bind(this));
};