2019-10-24 08:48:32 +00:00
|
|
|
const Page = require( 'wdio-mediawiki/Page' ),
|
|
|
|
Util = require( 'wdio-mediawiki/Util' );
|
2018-11-16 11:55:11 +00:00
|
|
|
|
|
|
|
class CitePage extends Page {
|
2018-11-19 16:00:32 +00:00
|
|
|
getReference( num ) { return browser.elements( '#mw-content-text .reference' ).value[ num - 1 ]; }
|
2019-03-20 15:31:00 +00:00
|
|
|
getCiteMultiBacklink( num ) { return browser.element( '.references li:nth-of-type(' + num + ') .mw-cite-up-arrow-backlink' ); }
|
|
|
|
getCiteSingleBacklink( num ) { return browser.element( '.references li:nth-of-type(' + num + ') .mw-cite-backlink a' ); }
|
2018-11-16 11:55:11 +00:00
|
|
|
getCiteSubBacklink( num ) { return browser.element( '.mw-cite-backlink sup:nth-of-type(' + num + ') a' ); }
|
2018-11-19 16:00:32 +00:00
|
|
|
|
2019-04-08 11:26:45 +00:00
|
|
|
scriptsReady() {
|
2019-10-24 08:48:32 +00:00
|
|
|
Util.waitForModuleState( 'ext.cite.ux-enhancements' );
|
2019-04-08 11:26:45 +00:00
|
|
|
}
|
|
|
|
|
2018-11-19 16:00:32 +00:00
|
|
|
getFragmentFromLink( linkElement ) {
|
|
|
|
// the href includes the full url so slice the fragment from it
|
2019-10-07 15:24:49 +00:00
|
|
|
const href = linkElement.getAttribute( 'href' );
|
2018-11-19 16:00:32 +00:00
|
|
|
return href.slice( href.indexOf( '#' ) + 1 );
|
|
|
|
}
|
2018-11-16 11:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = new CitePage();
|