X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fselenium%2Fpageobjects%2Fedit.page.js;h=8bc7dc635acfb5678b46dd40646d1e033ffecb64;hb=16a4d9da7bb81;hp=33a27f0f8ca12da60944669afe21c47ddcba04bc;hpb=f1d64e2fc641673c0b3c15a591b522f4ce813be9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/selenium/pageobjects/edit.page.js b/tests/selenium/pageobjects/edit.page.js index 33a27f0f8c..8bc7dc635a 100644 --- a/tests/selenium/pageobjects/edit.page.js +++ b/tests/selenium/pageobjects/edit.page.js @@ -1,15 +1,14 @@ -'use strict'; -const Page = require( './page' ); +const Page = require( 'wdio-mediawiki/Page' ), + Api = require( 'wdio-mediawiki/Api' ); class EditPage extends Page { - get content() { return browser.element( '#wpTextbox1' ); } get displayedContent() { return browser.element( '#mw-content-text' ); } get heading() { return browser.element( '#firstHeading' ); } get save() { return browser.element( '#wpSave' ); } - openForEditing( name ) { - super.open( name + '&action=edit' ); + openForEditing( title ) { + super.openTitle( title, { action: 'edit' } ); } edit( name, content ) { @@ -18,22 +17,10 @@ class EditPage extends Page { this.save.click(); } + // @deprecated Use wdio-mediawiki/Api#edit() instead. apiEdit( name, content ) { - - 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.edit( name, content, `Created page with "${content}"` ); - } ).call( this ); - + return Api.edit( name, content ); } - } + module.exports = new EditPage();