Selenium: Update to WebdriverIO v5

Update NPM packages: webdriverio, wdio-mediawiki.
Update ESlint configuration.

Replace NPM packages:
- wdio-mocha-framework with @wdio/mocha-framework.
- wdio-spec-reporter with @wdio/spec-reporter.

New NPM packages: @wdio/cli, @wdio/local-runner, @wdio/sync.

Replace:
- `browser.element` with `$`.
- `chromeOptions` with `'goog:chromeOptions'`.
- `password` with `mwPwd`.
- `username` with `mwUser`.

Bug: T253167
Change-Id: Ia26da6d0f56398a908bd4e99ae77db603647f533
This commit is contained in:
vidhi-mody 2020-05-21 00:04:09 +05:30 committed by Vidhi-Mody
parent 8e96199a66
commit f2759a17c9
6 changed files with 2483 additions and 1700 deletions

4146
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,15 +7,18 @@
"selenium-test": "wdio tests/selenium/wdio.conf.js"
},
"devDependencies": {
"@wdio/cli": "5.22.4",
"@wdio/local-runner": "5.22.4",
"@wdio/mocha-framework": "5.18.7",
"@wdio/spec-reporter": "5.22.4",
"@wdio/sync": "5.20.1",
"eslint-config-wikimedia": "0.15.3",
"grunt": "1.1.0",
"grunt-banana-checker": "0.9.0",
"grunt-eslint": "22.0.0",
"grunt-stylelint": "0.15.0",
"stylelint-config-wikimedia": "0.10.1",
"wdio-mediawiki": "0.4.0",
"wdio-mocha-framework": "0.6.4",
"wdio-spec-reporter": "0.1.5",
"webdriverio": "4.14.0"
"wdio-mediawiki": "1.0.0",
"webdriverio": "5.22.4"
}
}

View file

@ -1,7 +1,8 @@
{
"root": true,
"extends": [
"wikimedia/server"
"wikimedia/server",
"wikimedia/jquery"
],
"env": {
"mocha": true
@ -9,5 +10,8 @@
"globals": {
"browser": "readonly",
"mw": "readonly"
},
"rules": {
"no-jquery/no-global-selector": "off"
}
}

View file

@ -1,13 +1,13 @@
const Page = require( 'wdio-mediawiki/Page' );
class ViewEditPage extends Page {
get title() { return browser.element( '#firstHeading' ); }
get filterId() { return browser.element( '#mw-abusefilter-edit-id .mw-input' ); }
get hiddenEditor() { return browser.element( '#wpFilterRules' ); }
get warnParams() { return browser.element( '#mw-abusefilter-warn-parameters' ); }
get title() { return $( '#firstHeading' ); }
get filterId() { return $( '#mw-abusefilter-edit-id .mw-input' ); }
get hiddenEditor() { return $( '#wpFilterRules' ); }
get warnParams() { return $( '#mw-abusefilter-warn-parameters' ); }
open( id ) {
super.openTitle( 'Special:AbuseFilter/' + id );
}
get error() { return browser.element( '.errorbox' ); }
get error() { return $( '.errorbox' ); }
}
module.exports = new ViewEditPage();

View file

@ -1,8 +1,8 @@
const Page = require( 'wdio-mediawiki/Page' );
class ViewListPage extends Page {
get title() { return browser.element( '#firstHeading' ); }
get newFilterButton() { return browser.element( '.oo-ui-buttonElement a' ); }
get title() { return $( '#firstHeading' ); }
get newFilterButton() { return $( '.oo-ui-buttonElement a' ); }
open() {
super.openTitle( 'Special:AbuseFilter' );
}

View file

@ -12,8 +12,8 @@ exports.config = {
// Defaults are for convenience with MediaWiki-Vagrant
// Wiki admin
username: process.env.MEDIAWIKI_USER || 'Admin',
password: process.env.MEDIAWIKI_PASSWORD || 'vagrant',
mwUser: process.env.MEDIAWIKI_USER || 'Admin',
mwPwd: process.env.MEDIAWIKI_PASSWORD || 'vagrant',
// Base for browser.url() and Page#openTitle()
baseUrl: ( process.env.MW_SERVER || 'http://127.0.0.1:8080' ) + (
@ -34,7 +34,7 @@ exports.config = {
// https://sites.google.com/a/chromium.org/chromedriver/capabilities
browserName: 'chrome',
maxInstances: 1,
chromeOptions: {
'goog:chromeOptions': {
// If DISPLAY is set, assume developer asked non-headless or CI with Xvfb.
// Otherwise, use --headless (added in Chrome 59)
// https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md