Skip to content

Appium test fixes #1607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
17 changes: 12 additions & 5 deletions lib/helper/Appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -985,10 +991,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
Expand Down Expand Up @@ -1026,6 +1032,7 @@ class Appium extends Webdriver {
}

/**
*
* Perform a swipe left on an element.
*
* ```js
Expand Down
8 changes: 4 additions & 4 deletions test/helper/Appium_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down