bd28ca8cefd9e0693327b38e784ee843692026c8
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
) {
22 const url
= require( 'url' ), // https://nodejs.org/docs/latest/api/url.html
23 baseUrl
= url
.parse( browser
.options
.baseUrl
), // http://webdriver.io/guide/testrunner/browserobject.html
24 Bot
= require( 'nodemw' ), // https://github.com/macbre/nodemw
26 protocol
: baseUrl
.protocol
,
27 server
: baseUrl
.hostname
,
30 username
: browser
.options
.username
,
31 password
: browser
.options
.password
,
35 return new Promise( ( resolve
, reject
) => {
36 client
.logIn( function ( err
) {
41 client
.delete( name
, reason
, function ( err
) {
52 module
.exports
= new DeletePage();