mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-12 09:10:32 +00:00
Merge "Add browser test for highlighting of jump mark symbols"
This commit is contained in:
commit
e728ef92f8
8
tests/selenium/pageobjects/cite.page.js
Normal file
8
tests/selenium/pageobjects/cite.page.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const Page = require( 'wdio-mediawiki/Page' );
|
||||
|
||||
class CitePage extends Page {
|
||||
getCiteLink( num ) { return browser.elements( '#mw-content-text .reference a' ).value[ num - 1 ]; }
|
||||
getCiteSubBacklink( num ) { return browser.element( '.mw-cite-backlink sup:nth-of-type(' + num + ') a' ); }
|
||||
}
|
||||
|
||||
module.exports = new CitePage();
|
|
@ -1,9 +1,38 @@
|
|||
var assert = require( 'assert' ),
|
||||
Api = require( 'wdio-mediawiki/Api' ),
|
||||
CitePage = require( '../pageobjects/cite.page' ),
|
||||
Util = require( 'wdio-mediawiki/Util' ),
|
||||
VersionPage = require( '../pageobjects/version.page' );
|
||||
|
||||
describe( 'Cite', function () {
|
||||
var title;
|
||||
|
||||
before( function () {
|
||||
title = Util.getTestString( 'CiteTest-title-' );
|
||||
|
||||
browser.call( function () {
|
||||
return Api.edit(
|
||||
title,
|
||||
'abc<ref name="a">reftext</ref>\n\ndef<ref name="a" />\n\n<references />'
|
||||
);
|
||||
} );
|
||||
} );
|
||||
|
||||
it( 'is configured correctly', function () {
|
||||
VersionPage.open();
|
||||
assert( VersionPage.extension.isExisting() );
|
||||
} );
|
||||
|
||||
it( 'highlights the jump mark symbol in the reference list', function () {
|
||||
CitePage.openTitle( title );
|
||||
|
||||
browser.pause( 300 ); // make sure JS is loaded
|
||||
|
||||
CitePage.getCiteLink( 2 ).click();
|
||||
assert(
|
||||
CitePage.getCiteSubBacklink( 2 ).getAttribute( 'class' )
|
||||
.indexOf( 'mw-cite-targeted-backlink' ) !== -1,
|
||||
'the jump mark symbol of the backlink is highlighted'
|
||||
);
|
||||
} );
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue