mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 03:34:03 +00:00
Adapt Popups browser tests to recent breaking change
The previous Popups test page pointed to the "Main page" which as of Ie15487184a7f9fc08603fc42cfad3aeac6642dcc has specially handling This makes a new test page "Popups test page 2" that is linked to from "Popups test page" which previously linked to the Main page which now leads to the display of a broken Popup This gets our test fixed but the problem with main page previews will remain (T215080) Bug: T214974 Change-Id: If855c7c0a2ad65d96d03d6a1411b453ecbe8752b
This commit is contained in:
parent
83a28d177f
commit
a8b9dc6c07
|
@ -1,7 +1,7 @@
|
|||
=Popups test page=
|
||||
|
||||
==Valid links==
|
||||
* [[Main Page]]
|
||||
* [[Popups test page 2]]
|
||||
|
||||
==Invalid links==
|
||||
# blah
|
||||
|
|
7
tests/selenium/fixtures/test_page_2.wikitext
Normal file
7
tests/selenium/fixtures/test_page_2.wikitext
Normal file
|
@ -0,0 +1,7 @@
|
|||
=Popups test page 2=
|
||||
|
||||
==Valid links==
|
||||
* [[Popups test page]]
|
||||
|
||||
==Invalid links==
|
||||
# blah
|
|
@ -6,18 +6,26 @@ const
|
|||
POPUPS_SELECTOR = '.mwe-popups',
|
||||
POPUPS_MODULE_NAME = 'ext.popups.main';
|
||||
|
||||
function makePage( title, path ) {
|
||||
return new Promise( ( resolve ) => {
|
||||
fs.readFile( path, 'utf-8', ( err, content ) => {
|
||||
if ( err ) {
|
||||
throw err;
|
||||
}
|
||||
resolve( content );
|
||||
} );
|
||||
} ).then( ( content ) => {
|
||||
return Api.edit( title, content );
|
||||
} );
|
||||
}
|
||||
class PopupsPage extends Page {
|
||||
setup() {
|
||||
browser.call( () => {
|
||||
return new Promise( ( resolve ) => {
|
||||
fs.readFile( `${ __dirname }/../fixtures/test_page.wikitext`, 'utf-8', ( err, content ) => {
|
||||
if ( err ) {
|
||||
throw err;
|
||||
}
|
||||
resolve( content );
|
||||
} );
|
||||
} ).then( ( content ) => {
|
||||
return Api.edit( TEST_PAGE_TITLE, content );
|
||||
const path = `${ __dirname }/../fixtures/`;
|
||||
// FIXME: Cannot use Promise.all as wdio-mediawiki/Api will trigger a bad
|
||||
// token error.
|
||||
return makePage( `${TEST_PAGE_TITLE} 2`, `${path}/test_page_2.wikitext` ).then( () => {
|
||||
return makePage( TEST_PAGE_TITLE, `${path}test_page.wikitext` );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue