mirror of
https://github.com/appium/appium.git
synced 2026-10-27 03:25:54 +08:00
Merge pull request #5022 from moizjv/release-fix
Fixing perform touch with release action #5004
This commit is contained in:
@@ -1026,7 +1026,7 @@ androidController.performTouch = function (gestures, cb) {
|
||||
};
|
||||
|
||||
androidController.parseTouch = function (gestures, multi, cb) {
|
||||
if (_.last(gestures).action === 'release') {
|
||||
if (multi && _.last(gestures).action === 'release') {
|
||||
gestures.pop();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,3 +57,38 @@ describe("apidemo - touch - press", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("apidemo - touch - longpress - release", function () {
|
||||
var driver;
|
||||
setup(this, _.defaults({
|
||||
appActivity: '.view.SecureView'
|
||||
}, desired)).then(function (d) { driver= d;});
|
||||
describe('press released after pause should call release', function () {
|
||||
it('should open an alert dialog', function (done) {
|
||||
driver
|
||||
.elementByName("Don't click! It'll cost you!")
|
||||
.then(function (el) {
|
||||
var action = new TouchAction(driver);
|
||||
return action.press({el: el}).wait(1000).release().perform();
|
||||
})
|
||||
.elementByName("Oops...").should.eventually.exist
|
||||
.then(function (el) {
|
||||
el.click();
|
||||
})
|
||||
.nodeify(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('longPress should call release', function () {
|
||||
it('should open an alert dialog', function (done) {
|
||||
driver
|
||||
.elementByName("Don't click! It'll cost you!")
|
||||
.then(function (el) {
|
||||
var action = new TouchAction(driver);
|
||||
return action.longPress({el: el}).release().perform();
|
||||
})
|
||||
.elementByName("Oh no!").should.eventually.exist
|
||||
.nodeify(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,16 +17,19 @@ describe('android-controller', function () {
|
||||
{ action: 'moveTo', options: { x: -40, y: -41 } },
|
||||
{ action: 'release', options: {} } ];
|
||||
controller.parseTouch(actions, false, function (err, touchStates) {
|
||||
touchStates.length.should.equal(4);
|
||||
touchStates.length.should.equal(5);
|
||||
|
||||
var actions = [{action: 'press', x: 100, y: 101},
|
||||
{action: 'moveTo', x: 150, y: 152},
|
||||
{action: 'wait', x: 150, y: 152},
|
||||
{action: 'moveTo', x: 110, y: 111}];
|
||||
{action: 'moveTo', x: 110, y: 111},
|
||||
{action: 'release'}];
|
||||
_.each(touchStates, function (state, index) {
|
||||
state.action.should.equal(actions[index].action);
|
||||
state.options.x.should.equal(actions[index].x);
|
||||
state.options.y.should.equal(actions[index].y);
|
||||
if (actions[index].action !== 'release') {
|
||||
state.options.x.should.equal(actions[index].x);
|
||||
state.options.y.should.equal(actions[index].y);
|
||||
}
|
||||
});
|
||||
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user