selenium: Refactor Echo WebdriverIO tests from sync to async mode

WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests of Echo have been changed to async.

Bug: T293073
Change-Id: I8327d33c99e495b109d97df7b525181dfc41c18d
This commit is contained in:
osamaahmed17 2022-01-17 03:42:52 +05:00
parent 732f73a9ce
commit 9903581028
4 changed files with 5733 additions and 6102 deletions

11788
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,12 +11,11 @@
"selenium-daily": "npm run selenium-test -- --mochaOpts.grep @daily"
},
"devDependencies": {
"@wdio/cli": "6.1.16",
"@wdio/dot-reporter": "6.11.0",
"@wdio/junit-reporter": "6.11.0",
"@wdio/local-runner": "6.1.16",
"@wdio/mocha-framework": "6.1.14",
"@wdio/sync": "6.1.14",
"@wdio/cli": "7.4.6",
"@wdio/dot-reporter": "7.4.2",
"@wdio/junit-reporter": "7.4.2",
"@wdio/local-runner": "7.16.11",
"@wdio/mocha-framework": "7.13.2",
"eslint-config-wikimedia": "0.21.0",
"grunt": "1.4.0",
"grunt-banana-checker": "0.9.0",
@ -25,7 +24,7 @@
"grunt-stylelint": "0.16.0",
"stylelint-config-wikimedia": "0.11.1",
"svgo": "2.3.1",
"wdio-mediawiki": "1.1.1",
"wdio-mediawiki": "2.0.0",
"webdriverio": "6.1.16"
}
}

View file

@ -13,49 +13,49 @@ describe( 'Echo', function () {
bot = await Api.bot();
} );
it( 'alerts and notices are visible after logging in @daily', function () {
it( 'alerts and notices are visible after logging in @daily', async function () {
UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
assert( EchoPage.alerts.isExisting() );
assert( EchoPage.notices.isExisting() );
} );
it( 'flyout for alert appears when clicked @daily', function () {
it( 'flyout for alert appears when clicked @daily', async function () {
UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
EchoPage.alerts.click();
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
await EchoPage.alerts.click();
EchoPage.alertsFlyout.waitForDisplayed();
assert( EchoPage.alertsFlyout.isExisting() );
} );
it( 'flyout for notices appears when clicked @daily', function () {
it( 'flyout for notices appears when clicked @daily', async function () {
UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
EchoPage.notices.click();
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
await EchoPage.notices.click();
EchoPage.noticesFlyout.waitForDisplayed();
assert( EchoPage.noticesFlyout.isExisting() );
} );
it( 'checks for welcome message after signup', function () {
it( 'checks for welcome message after signup', async function () {
const username = Util.getTestString( 'NewUser-' );
const password = Util.getTestString();
browser.call( async () => {
await Api.createAccount( bot, username, password );
} );
UserLoginPage.login( username, password );
await UserLoginPage.login( username, password );
EchoPage.notices.click();
await EchoPage.notices.click();
EchoPage.alertMessage.waitForDisplayed();
await EchoPage.alertMessage.waitForDisplayed();
const regexp = /Welcome to .*, .*! We're glad you're here./;
assert( regexp.test( EchoPage.alertMessage.getText() ) );
assert( regexp.test( await EchoPage.alertMessage.getText() ) );
} );

View file

@ -6,12 +6,12 @@ const assert = require( 'assert' ),
describe( 'Notifications', function () {
it( 'checks for Notifications Page @daily', function () {
it( 'checks for Notifications Page @daily', async function () {
UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
NotificationsPage.open();
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd );
await NotificationsPage.open();
assert.strictEqual( NotificationsPage.notificationHeading.getText(), 'Notifications' );
assert.strictEqual( await NotificationsPage.notificationHeading.getText(), 'Notifications' );
} );