Skip to content

Commit 48157bc

Browse files
lucaswerkmeisterjenkins-bot
authored andcommitted
Update wdio (v8), wdio-mediawiki (v3), wdio-wikibase (v6.3)
browser.config is gone; get the waitforTimeout and baseUrl from the browser.options, and move everything else (our custom variables) into the capabilities. Also pass the user and password into wdio-wikibase’s initialize() method – compare #72 and [1]. In linkitem.js, change the window size. The viewport width was previously 1185px under wdio v7, but became 1050 in wdio v8 by default, which is below MediaWiki core’s @min-width-breakpoint-desktop (1120px) and thus seems to mess with the display of the tools menu where the link lives. Increase the size explicitly to make the test pass. (Setting the *window* width to 1185px actually only results in a viewport width of 1180px, but that’s still enough to fix the test, so I can’t be bothered to work out what exactly the correct window size would be. There’s also a setViewport() method, but the docs don’t make it clear whether it can also be used to increase the size beyond the window or only decrease it further, and in any case that method is missing a getViewport() counterpart that would let us clean up the size afterwards.) [1]: https://github.com/wmde/wikibase-release-pipeline/blob/6c6d285059/test/setup/make-test-settings.ts#L26 Bug: T406844 Change-Id: Ief5eeb23801ab95dcc283ab11a1faaafa020785a
1 parent dbdabf2 commit 48157bc

File tree

16 files changed

+49800
-30235
lines changed

16 files changed

+49800
-30235
lines changed

client/data-bridge/dist/data-bridge.app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/data-bridge/package-lock.json

Lines changed: 28690 additions & 16852 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/data-bridge/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
"@vue/eslint-config-typescript": "^9.1.0",
4444
"@vue/test-utils": "^2.3.0",
4545
"@vue/vue3-jest": "^28.1.0",
46-
"@wdio/cli": "^7.16.13",
47-
"@wdio/devtools-service": "^7.16.13",
48-
"@wdio/local-runner": "^7.16.13",
49-
"@wdio/mocha-framework": "^7.16.13",
50-
"@wdio/spec-reporter": "^7.16.13",
46+
"@wdio/cli": "^8.46.0",
47+
"@wdio/devtools-service": "^8.42.0",
48+
"@wdio/local-runner": "^8.46.0",
49+
"@wdio/mocha-framework": "^8.46.0",
50+
"@wdio/spec-reporter": "^8.43.0",
5151
"@wmde/eslint-config-wikimedia-typescript": "^0.2.1",
5252
"@wmde/vuex-helpers": "^0.1.2",
5353
"@wmde/wikibase-datamodel-types": "^0.2.0",
@@ -90,8 +90,8 @@
9090
"url-search-params-polyfill": "^8.1.1",
9191
"vue-eslint-parser": "^7.11.0",
9292
"vuex": "4.0.2",
93-
"wdio-mediawiki": "^1.2.0",
94-
"wdio-wikibase": "^5.2.0",
93+
"wdio-mediawiki": "3.0.1",
94+
"wdio-wikibase": "6.3.0",
9595
"wikimedia-ui-base": "^0.19.0"
9696
}
9797
}

client/data-bridge/tests/selenium/VideoUtil.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
* @param {Object} test Mocha Test object
2222
*/
2323
startVideoRecording( test ) {
24-
videoPath = filePath( test, browser.config.screenshotPath, 'mp4' );
24+
videoPath = filePath( test, browser.options.capabilities[ 'mw:screenshotPath' ], 'mp4' );
2525
const { spawn } = require( 'child_process' );
2626
ffmpeg = spawn( 'ffmpeg', [
2727
'-f', 'x11grab', // grab the X11 display

client/data-bridge/tests/selenium/pageobjects/dataBridge.page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class DataBridgePage extends Page {
122122

123123
open( title ) {
124124
await super.openTitle( title );
125-
Util.waitForModuleState( 'wikibase.client.data-bridge.app', 'ready', browser.config.waitforTimeout );
125+
Util.waitForModuleState( 'wikibase.client.data-bridge.app', 'ready', browser.options.waitforTimeout );
126126
}
127127

128128
openAppOnPage( title ) {
@@ -132,7 +132,7 @@ class DataBridgePage extends Page {
132132

133133
launchApp() {
134134
this.overloadedLink.click();
135-
this.app.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
135+
this.app.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
136136
WarningAnonymousEdit.dismiss();
137137
}
138138

client/data-bridge/tests/selenium/specs/canSave.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ describe( 'App', () => {
102102
browser.switchWindow( title );
103103

104104
DataBridgePage.app.waitForDisplayed( {
105-
timeout: browser.config.nonApiTimeout,
105+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
106106
reverse: true,
107107
timeoutMsg: 'App is still being displayed after clicking the save button',
108108
} );
109109
DataBridgePage.app.waitForExist( {
110-
timeout: browser.config.nonApiTimeout,
110+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
111111
reverse: true,
112112
timeoutMsg: 'App still exists in the DOM after clicking the save button',
113113
} );
@@ -185,7 +185,7 @@ describe( 'App', () => {
185185
DataBridgePage.closeButton.click();
186186

187187
DataBridgePage.app.waitForDisplayed( {
188-
timeout: browser.config.nonApiTimeout,
188+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
189189
reverse: true,
190190
timeoutMsg: 'App is still being displayed after clicking the save button',
191191
} );

client/data-bridge/tests/selenium/specs/errorHandling.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ describe( 'App', () => {
6161

6262
NetworkUtil.disableNetwork();
6363
DataBridgePage.launchApp();
64-
DataBridgePage.error.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
64+
DataBridgePage.error.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
6565

6666
assert.ok( DataBridgePage.showsErrorUnknown() );
6767

6868
NetworkUtil.enableNetwork();
6969
DataBridgePage.errorUnknownRelaunch.click();
70-
DataBridgePage.app.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
70+
DataBridgePage.app.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
7171
WarningAnonymousEdit.dismiss();
7272
DataBridgePage.bridge.waitForDisplayed();
7373
} );
@@ -107,7 +107,7 @@ describe( 'App', () => {
107107

108108
// show License
109109
DataBridgePage.saveButton.click();
110-
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
110+
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
111111

112112
// lose internet connection
113113
NetworkUtil.disableNetwork();
@@ -116,7 +116,7 @@ describe( 'App', () => {
116116
DataBridgePage.saveButton.click();
117117

118118
// show ErrorSaving screen
119-
DataBridgePage.error.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
119+
DataBridgePage.error.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
120120

121121
assert.ok( DataBridgePage.showsErrorSaving() );
122122

@@ -161,7 +161,7 @@ describe( 'App', () => {
161161

162162
// show License
163163
DataBridgePage.saveButton.click();
164-
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
164+
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
165165

166166
// lose internet connection
167167
NetworkUtil.disableNetwork();
@@ -222,7 +222,9 @@ describe( 'App', () => {
222222
DataBridgePage.editDecision( 'replace' ).click();
223223

224224
DataBridgePage.saveButton.click();
225-
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
225+
DataBridgePage.licensePopup.waitForDisplayed( {
226+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
227+
} );
226228

227229
// log out
228230
browser.deleteCookies();
@@ -238,7 +240,9 @@ describe( 'App', () => {
238240
// go back, try again
239241
ErrorSavingAssertUser.clickBackButton();
240242
DataBridgePage.saveButton.click();
241-
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
243+
DataBridgePage.licensePopup.waitForDisplayed( {
244+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
245+
} );
242246
DataBridgePage.saveButton.click();
243247
DataBridgePage.error.waitForDisplayed();
244248

@@ -257,8 +261,8 @@ describe( 'App', () => {
257261
ErrorSavingAssertUser.loginButton.click();
258262
WindowUtil.doInOtherWindow( () => {
259263
LoginPage.username.waitForDisplayed();
260-
DomUtil.setValue( LoginPage.username, browser.config.mwUser );
261-
DomUtil.setValue( LoginPage.password, browser.config.mwPwd );
264+
DomUtil.setValue( LoginPage.username, browser.options.capabilities[ 'mw:user' ] );
265+
DomUtil.setValue( LoginPage.password, browser.options.capabilities[ 'mw:pwd' ] );
262266
LoginPage.loginButton.click();
263267
LoginPage.username.waitForDisplayed( {
264268
reverse: true,
@@ -349,7 +353,9 @@ describe( 'App', () => {
349353
DataBridgePage.editDecision( 'replace' ).click();
350354

351355
DataBridgePage.saveButton.click();
352-
DataBridgePage.licensePopup.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
356+
DataBridgePage.licensePopup.waitForDisplayed( {
357+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
358+
} );
353359

354360
// clear the item, removing the target statement
355361
browser.call( () => Api.bot().then( ( bot ) => bot.request( {

client/data-bridge/tests/selenium/specs/init.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe( 'init', () => {
7070
}, {
7171
timeout: {
7272
interval: 500,
73-
timeout: browser.config.nonApiTimeout,
73+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
7474
},
7575
} );
7676
DataBridgePage.loadingBar.waitForExist( {
@@ -222,7 +222,7 @@ describe( 'init', () => {
222222
DataBridgePage.bridge.waitForDisplayed();
223223

224224
browser.waitUntil( () => DataBridgePage.propertyLabel.getText() === expectedLabel, {
225-
timeout: browser.config.nonApiTimeout,
225+
timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ],
226226
timeoutMsg: `${DataBridgePage.propertyLabel.getText()} is not equal to ${expectedLabel}`,
227227
} );
228228
}
@@ -279,7 +279,7 @@ describe( 'init', () => {
279279

280280
DataBridgePage.open( title );
281281
DataBridgePage.overloadedLink.click();
282-
DataBridgePage.app.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
282+
DataBridgePage.app.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
283283

284284
assert.ok( WarningAnonymousEdit.root.isDisplayed() );
285285

@@ -312,7 +312,7 @@ describe( 'init', () => {
312312

313313
DataBridgePage.open( title );
314314
DataBridgePage.overloadedLink.click();
315-
DataBridgePage.app.waitForDisplayed( { timeout: browser.config.nonApiTimeout } );
315+
DataBridgePage.app.waitForDisplayed( { timeout: browser.options.capabilities[ 'mw:nonApiTimeout' ] } );
316316

317317
assert.ok( WarningAnonymousEdit.root.isDisplayed() );
318318

client/data-bridge/tests/selenium/specs/permissionChecks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function blockUser( username, expiry ) {
88
browser.call( () => Api.bot().then( ( bot ) => {
99
return bot.request( {
1010
action: 'block',
11-
user: username || browser.config.mwUser,
11+
user: username || browser.options.capabilities[ 'mw:user' ],
1212
reason: 'browser test',
1313
token: bot.editToken,
1414
expiry,
@@ -20,7 +20,7 @@ function unblockUser( username ) {
2020
browser.call( () => Api.bot().then( ( bot ) => {
2121
return bot.request( {
2222
action: 'unblock',
23-
user: username || browser.config.mwUser,
23+
user: username || browser.options.capabilities[ 'mw:user' ],
2424
reason: 'browser test done',
2525
token: bot.editToken,
2626
} );
@@ -71,7 +71,7 @@ describe( 'permission checks', () => {
7171
title,
7272
token: bot.editToken,
7373
reason: 'browser test',
74-
user: browser.config.mwUser,
74+
user: browser.options.capabilities[ 'mw:user' ],
7575
protections: 'edit=sysop|move=sysop',
7676
} );
7777
} )

client/data-bridge/tests/selenium/wdio.conf.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ const WikibaseApi = require( 'wdio-wikibase/wikibase.api' );
99

1010
exports.config = {
1111

12-
// Wiki admin
13-
mwUser: process.env.MEDIAWIKI_USER || 'Admin',
14-
mwPwd: process.env.MEDIAWIKI_PASSWORD || 'vagrant',
15-
//
1612
// Set a base URL in order to shorten url command calls. If your `url` parameter starts
1713
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
1814
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
@@ -22,10 +18,6 @@ exports.config = {
2218
process.env.MW_SCRIPT_PATH || '/w'
2319
),
2420

25-
// Setting this enables automatic screenshots for when a browser command fails
26-
// It is also used by afterTest for capturig failed assertions.
27-
screenshotPath: process.env.LOG_DIR || `${__dirname}/log`,
28-
2921
//
3022
// ====================
3123
// Runner Configuration
@@ -60,6 +52,17 @@ exports.config = {
6052
services: [ 'devtools' ],
6153

6254
capabilities: [ {
55+
// Wiki admin
56+
'mw:mwUser': process.env.MEDIAWIKI_USER || 'Admin',
57+
'mw:mwPwd': process.env.MEDIAWIKI_PASSWORD || 'vagrant',
58+
59+
// Setting this enables automatic screenshots for when a browser command fails
60+
// It is also used by afterTest for capturig failed assertions.
61+
'mw:screenshotPath': process.env.LOG_DIR || `${__dirname}/log`,
62+
63+
// custom config to be used for waitFor* timeouts where we're not waiting for an API call or such
64+
'mw:nonApiTimeout': 10000,
65+
6366
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
6467
// grid with only 5 firefox instances available you can make sure that not more than
6568
// 5 instances get started at a time.
@@ -94,9 +97,6 @@ exports.config = {
9497
// Default timeout for all waitFor* commands.
9598
waitforTimeout: 20000,
9699

97-
// custom config to be used for waitFor* timeouts where we're not waiting for an API call or such
98-
nonApiTimeout: 10000,
99-
100100
// Default timeout in milliseconds for request
101101
// if Selenium Grid doesn't send response
102102
connectionRetryTimeout: 90000,
@@ -136,7 +136,11 @@ exports.config = {
136136
// resolved to continue.
137137

138138
beforeSuite() {
139-
browser.call( () => WikibaseApi.initialize() );
139+
browser.call( () => WikibaseApi.initialize(
140+
undefined,
141+
browser.options.capabilities[ 'mw:user' ],
142+
browser.options.capabilities[ 'mw:pwd' ]
143+
) );
140144
},
141145

142146
/**

0 commit comments

Comments
 (0)