Merge "Add browser test for highlighting of jump mark symbols"

This commit is contained in:
jenkins-bot 2018-11-19 17:37:15 +00:00 committed by Gerrit Code Review
commit e728ef92f8
2 changed files with 37 additions and 0 deletions

View 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();

View file

@ -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'
);
} );
} );