Skip to content

Commit

Permalink
Merge pull request #528 from webdriverio/ws/use-new-methods
Browse files Browse the repository at this point in the history
feat: use new native commands
  • Loading branch information
wswebcreation authored Jan 7, 2025
2 parents 9d6309f + 6ac72e1 commit 9b8ce00
Show file tree
Hide file tree
Showing 9 changed files with 708 additions and 963 deletions.
1,266 changes: 656 additions & 610 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@
"lint": "eslint config tests"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@typescript-eslint/parser": "^8.19.0",
"@wdio/appium-service": "^9.5.0",
"@wdio/browserstack-service": "^9.5.0",
"@wdio/cli": "^9.5.0",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@wdio/appium-service": "^9.5.1",
"@wdio/browserstack-service": "^9.5.1",
"@wdio/cli": "^9.5.1",
"@wdio/cucumber-framework": "^9.5.0",
"@wdio/globals": "^9.5.0",
"@wdio/local-runner": "^9.5.0",
"@wdio/globals": "^9.5.1",
"@wdio/local-runner": "^9.5.1",
"@wdio/mocha-framework": "^9.5.0",
"@wdio/sauce-service": "^9.5.0",
"@wdio/sauce-service": "^9.5.1",
"@wdio/spec-reporter": "^9.5.0",
"@wdio/testingbot-service": "^9.5.0",
"appium": "^2.13.1",
"appium-uiautomator2-driver": "^3.9.6",
"appium-xcuitest-driver": "7.35.0",
"@wdio/testingbot-service": "^9.5.1",
"appium": "^2.14.1",
"appium-uiautomator2-driver": "^3.9.7",
"appium-xcuitest-driver": "7.35.1",
"eslint-plugin-wdio": "^9.4.4",
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
Expand Down
215 changes: 0 additions & 215 deletions tests/helpers/Gestures.ts

This file was deleted.

33 changes: 0 additions & 33 deletions tests/screenobjects/DragScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,6 @@ class DragScreen extends AppScreen {
async waitForRenewButton(){
return this.renew.waitForDisplayed();
}

/**
* Drag an element to a position.
*/
async dragElementTo(elementOne: WebdriverIO.Element, elementTwo: WebdriverIO.Element) {
await driver.performActions([
{
// 1. Create the event
type: 'pointer',
id: 'finger1',
parameters: { pointerType: 'touch' },
actions: [
// 2. Move finger into start position where the element is
// Appium can automatically determine the location of the element instead
// of doing it ourselves
{ type: 'pointerMove', duration: 0, origin: elementOne.elementId },
// 3. Finger comes down into contact with screen
{ type: 'pointerDown', button: 0 },
// 4. Pause for a little bit
{ type: 'pause', duration: 100 },
// 5. Finger moves to the second element.
// Appium can automatically determine the location of the element instead
// of doing it ourselves
{ type: 'pointerMove', duration: 250, origin: elementTwo.elementId },
// 6. Finger lets up, off the screen
{ type: 'pointerUp', button: 0 },
],
},
]);

// Add a pause, just to make sure the drag and drop is done
await driver.pause(1000);
}
}

export default new DragScreen();
15 changes: 5 additions & 10 deletions tests/screenobjects/LoginScreen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import AppScreen from './AppScreen.js';
import Gestures from '../helpers/Gestures.js';

const SELECTORS = {
SCREEN: '~Login-screen',
Expand Down Expand Up @@ -55,10 +54,9 @@ class LoginScreen extends AppScreen {
await $('~Login-screen').click();
}
// On smaller screens there could be a possibility that the button is not shown
await Gestures.checkIfDisplayedWithSwipe({
scrollContainer: await this.screen,
searchableElement: await this.loginButton,
maxScrolls: 2,
// This uses the "new" `scrollIntoView` method that now also supports native apps
await this.loginButton.scrollIntoView({
scrollableElement: await this.screen,
});
await this.loginButton.click();
}
Expand All @@ -83,11 +81,8 @@ class LoginScreen extends AppScreen {
await $('~Login-screen').click();
}
// On smaller screens there could be a possibility that the button is not shown
await Gestures.checkIfDisplayedWithSwipe({
scrollContainer: await this.screen,
searchableElement: await this.signUpButton,
maxScrolls: 2,
});
// This uses the "new" `scrollIntoView` method that now also supports native apps
await this.signUpButton.scrollIntoView({scrollableElement: await this.screen});
await this.signUpButton.click();
}
}
Expand Down
Loading

0 comments on commit 9b8ce00

Please sign in to comment.