blob: d43cb9f6121c5751b86dc972874af791d1ef0188 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
'use strict';
const Page = require( './page' );
class DeletePage extends Page {
get reason() { return browser.element( '#wpReason' ); }
get watch() { return browser.element( '#wpWatch' ); }
get submit() { return browser.element( '#wpConfirmB' ); }
get displayedContent() { return browser.element( '#mw-content-text' ); }
open( name ) {
super.open( name + '&action=delete' );
}
delete( name, reason ) {
this.open( name );
this.reason.setValue( reason );
this.submit.click();
}
apiDelete( name, reason ) {
const MWBot = require( 'mwbot' ), // https://github.com/Fannon/mwbot
Promise = require( 'bluebird' );
let bot = new MWBot();
return Promise.coroutine( function* () {
yield bot.loginGetEditToken( {
apiUrl: `${browser.options.baseUrl}/api.php`,
username: browser.options.username,
password: browser.options.password
} );
yield bot.delete( name, reason );
} ).call( this );
}
}
module.exports = new DeletePage();
|