mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-23 12:02:41 +00:00
e5228999e1
WebdriverIO has dropped support of sync mode, hence changed to async.
Update npm packages: @wdio/*, wdio-mediawiki
because async mode needs at least @wdio v7.9.
Remove npm packages: @wdio/dot-reporter and @wdio/sync.
Bug: T300196
Change-Id: I8a2ba7f87496b19cc22c347088d52e56741cac71
(cherry picked from commit 27ab8a437d
)
24 lines
880 B
JavaScript
24 lines
880 B
JavaScript
'use strict';
|
|
|
|
const Page = require( 'wdio-mediawiki/Page' ),
|
|
Util = require( 'wdio-mediawiki/Util' );
|
|
|
|
class CitePage extends Page {
|
|
getReference( num ) { return $$( '#mw-content-text .reference' )[ num - 1 ]; }
|
|
getCiteMultiBacklink( num ) { return $( '.references li:nth-of-type(' + num + ') .mw-cite-up-arrow-backlink' ); }
|
|
getCiteSingleBacklink( num ) { return $( '.references li:nth-of-type(' + num + ') .mw-cite-backlink a' ); }
|
|
getCiteSubBacklink( num ) { return $( '.mw-cite-backlink sup:nth-of-type(' + num + ') a' ); }
|
|
|
|
async scriptsReady() {
|
|
await Util.waitForModuleState( 'ext.cite.ux-enhancements' );
|
|
}
|
|
|
|
async getFragmentFromLink( linkElement ) {
|
|
// the href includes the full url so slice the fragment from it
|
|
const href = await linkElement.getAttribute( 'href' );
|
|
return href.slice( href.indexOf( '#' ) + 1 );
|
|
}
|
|
}
|
|
|
|
module.exports = new CitePage();
|