From bdbc17e5dbb9bd8039e4ea6df808590894184f52 Mon Sep 17 00:00:00 2001 From: Davert Date: Sat, 13 Apr 2019 22:57:00 +0300 Subject: [PATCH 1/2] Appium test fixes --- lib/helper/Appium.js | 9 +++++---- test/helper/Appium_test.js | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/helper/Appium.js b/lib/helper/Appium.js index 74660a532..d6c9ccb23 100644 --- a/lib/helper/Appium.js +++ b/lib/helper/Appium.js @@ -985,10 +985,10 @@ class Appium extends Webdriver { * Perform a certain touch action on the screen such as swipeDown, swipeUp, swipeLeft, swipeRight. * * ```js - * I.swipeDown('swipeDown'); // perform swipe down on the screen - * I.swipeDown('swipeUp'); // perform swipe up on the screen - * I.swipeDown('swipeLeft'); // perform swipe left on the screen - * I.swipeDown('swipeRight'); // perform swipe right on the screen + * I.performTouchAction('swipeDown'); // perform swipe down on the screen + * I.performTouchAction('swipeUp'); // perform swipe up on the screen + * I.performTouchAction('swipeLeft'); // perform swipe left on the screen + * I.performTouchAction('swipeRight'); // perform swipe right on the screen * ``` * * @param action @@ -1026,6 +1026,7 @@ class Appium extends Webdriver { } /** + * * Perform a swipe left on an element. * * ```js diff --git a/test/helper/Appium_test.js b/test/helper/Appium_test.js index f219e0e3e..4f674486f 100644 --- a/test/helper/Appium_test.js +++ b/test/helper/Appium_test.js @@ -88,7 +88,7 @@ describe('Appium', function () { }, ); - it.only('should remove App and install it again', () => app.seeAppIsInstalled('io.selendroid.testapp') + it('should remove App and install it again', () => app.seeAppIsInstalled('io.selendroid.testapp') .then(() => app.removeApp('io.selendroid.testapp')) .then(() => app.seeAppIsNotInstalled('io.selendroid.testapp')) .then(() => app.installApp(apk_path)) @@ -220,7 +220,7 @@ describe('Appium', function () { assert.equal(val, '.WebViewActivity'); }); - it('should react on swipe action @second', function* () { + it('should react on swipe action', function* () { yield app.click("//android.widget.Button[@resource-id = 'io.selendroid.testapp:id/touchTest']"); yield app.waitForText( 'Gesture Type', 10, @@ -345,7 +345,7 @@ describe('Appium', function () { }); describe('#performTouchAction', () => { - it('should react on swipeUp action', function* () { + it('should react on swipeUp action @second', function* () { yield app.click("//android.widget.Button[@resource-id = 'io.selendroid.testapp:id/touchTest']"); yield app.waitForText( 'Gesture Type', 10, @@ -359,7 +359,7 @@ describe('Appium', function () { expect(vy.split(' ')[1]).to.be.below(1006); }); - it('should react on swipeDown action', function* () { + it('should react on swipeDown action @second', function* () { yield app.click("//android.widget.Button[@resource-id = 'io.selendroid.testapp:id/touchTest']"); yield app.waitForText( 'Gesture Type', 10, From 83e7b91822e0e754869c14277ce127d844f368fa Mon Sep 17 00:00:00 2001 From: Davert Date: Mon, 15 Apr 2019 12:18:20 +0300 Subject: [PATCH 2/2] fixed w3c/jsonwire compatibility --- lib/helper/Appium.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/helper/Appium.js b/lib/helper/Appium.js index d6c9ccb23..c66620601 100644 --- a/lib/helper/Appium.js +++ b/lib/helper/Appium.js @@ -893,7 +893,13 @@ class Appium extends Webdriver { } async _swipeOnPercentage(from, to) { - SCREEN_SIZE = SCREEN_SIZE || await this.browser.getWindowRect(); + if (!SCREEN_SIZE) { + if (this.browser.isW3C) { + SCREEN_SIZE = await this.browser.getWindowRect(); + } else { + SCREEN_SIZE = await this.browser.getWindowSize(); + } + } const pressOptions = this._getDeviceScreenCoordinates(SCREEN_SIZE, from); const moveToScreenCoordinates = this._getDeviceScreenCoordinates(SCREEN_SIZE, to); await this.performSwipe(