mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Merge "Adapt Popups browser tests to recent breaking change"
This commit is contained in:
commit
85d00ea85f
|
@ -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
|
|
@ -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` );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue