Merge "Adapt Popups browser tests to recent breaking change"

This commit is contained in:
jenkins-bot 2019-02-02 01:04:43 +00:00 committed by Gerrit Code Review
commit 85d00ea85f
3 changed files with 25 additions and 10 deletions

View file

@ -1,7 +1,7 @@
=Popups test page=
==Valid links==
* [[Main Page]]
* [[Popups test page 2]]
==Invalid links==
# blah

View file

@ -0,0 +1,7 @@
=Popups test page 2=
==Valid links==
* [[Popups test page]]
==Invalid links==
# blah

View file

@ -8,18 +8,26 @@ const
REFERENCE_POPUPS_SELECTOR = '.mwe-popups-type-reference',
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` );
} );
} );
}