Merge "Remove "probably you" from password reset email information"
[lhc/web/wiklou.git] / tests / selenium / pageobjects / edit.page.js
1 'use strict';
2 const Page = require( './page' );
3
4 class EditPage extends Page {
5
6 get content() { return browser.element( '#wpTextbox1' ); }
7 get displayedContent() { return browser.element( '#mw-content-text' ); }
8 get heading() { return browser.element( '#firstHeading' ); }
9 get save() { return browser.element( '#wpSave' ); }
10
11 openForEditing( name ) {
12 super.open( name + '&action=edit' );
13 }
14
15 edit( name, content ) {
16 this.openForEditing( name );
17 this.content.setValue( content );
18 this.save.click();
19 }
20
21 apiEdit( name, content ) {
22
23 const MWBot = require( 'mwbot' ), // https://github.com/Fannon/mwbot
24 Promise = require( 'bluebird' );
25 let bot = new MWBot();
26
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
32 } );
33 yield bot.edit( name, content, `Created page with "${content}"` );
34 } ).call( this );
35
36 }
37
38 }
39 module.exports = new EditPage();