2018-11-16 11:55:11 +00:00
|
|
|
const Page = require( 'wdio-mediawiki/Page' );
|
|
|
|
|
|
|
|
class CitePage extends Page {
|
2018-11-19 16:00:32 +00:00
|
|
|
getReference( num ) { return browser.elements( '#mw-content-text .reference' ).value[ num - 1 ]; }
|
|
|
|
getCiteBacklink( num ) { return browser.element( '.references li:nth-of-type(' + num + ') .mw-cite-up-arrow-backlink' ); }
|
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
|
|
|
|
|
|
|
getFragmentFromLink( linkElement ) {
|
|
|
|
// the href includes the full url so slice the fragment from it
|
|
|
|
let href = linkElement.getAttribute( 'href' );
|
|
|
|
return href.slice( href.indexOf( '#' ) + 1 );
|
|
|
|
}
|
2018-11-16 11:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = new CitePage();
|