2 const Page
= require( './page' );
4 class DeletePage
extends Page
{
6 get reason() { return browser
.element( '#wpReason' ); }
7 get watch() { return browser
.element( '#wpWatch' ); }
8 get submit() { return browser
.element( '#wpConfirmB' ); }
9 get displayedContent() { return browser
.element( '#mw-content-text' ); }
12 super.open( name
+ '&action=delete' );
15 delete( name
, reason
) {
17 this.reason
.setValue( reason
);
21 apiDelete( name
, reason
) {
23 const MWBot
= require( 'mwbot' ), // https://github.com/Fannon/mwbot
24 Promise
= require( 'bluebird' );
25 let bot
= new MWBot();
27 return Promise
.coroutine( function* () {
28 yield bot
.loginGetEditToken( {
29 apiUrl
: `${browser.options.baseUrl}/api.php`,
30 username
: browser
.options
.username
,
31 password
: browser
.options
.password
33 yield bot
.delete( name
, reason
);
39 module
.exports
= new DeletePage();