1 const Page
= require( 'wdio-mediawiki/Page' ),
2 Api
= require( 'wdio-mediawiki/Api' ),
3 Util
= require( 'wdio-mediawiki/Util' );
5 class HistoryPage
extends Page
{
6 get heading() { return $( '#firstHeading' ); }
7 get comment() { return $( '#pagehistory .comment' ); }
8 get rollback() { return $( '.mw-rollback-link' ); }
9 get rollbackLink() { return $( '.mw-rollback-link a' ); }
10 get rollbackConfirmable() { return $( '.mw-rollback-link .jquery-confirmable-text' ); }
11 get rollbackConfirmableYes() { return $( '.mw-rollback-link .jquery-confirmable-button-yes' ); }
12 get rollbackConfirmableNo() { return $( '.mw-rollback-link .jquery-confirmable-button-no' ); }
13 get rollbackNonJsConfirmable() { return $( '.mw-htmlform .oo-ui-fieldsetLayout-header .oo-ui-labelElement-label' ); }
14 get rollbackNonJsConfirmableYes() { return $( '.mw-htmlform .mw-htmlform-submit-buttons button' ); }
17 super.openTitle( title
, { action
: 'history' } );
20 toggleRollbackConfirmationSetting( enable
) {
21 Util
.waitForModuleState( 'mediawiki.api', 'ready', 5000 );
22 return browser
.execute( function ( enable
) {
23 return new mw
.Api().saveOption(
24 'showrollbackconfirmation',
30 vandalizePage( name
, content
) {
31 const vandalUsername
= 'Evil_' + browser
.config
.mwUser
;
33 browser
.call( function () {
34 return Api
.edit( name
, content
);
37 browser
.call( function () {
38 return Api
.createAccount(
39 vandalUsername
, browser
.config
.mwPwd
43 browser
.call( function () {
46 'Vandalized: ' + content
,
53 module
.exports
= new HistoryPage();