2021-04-21 17:47:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const Page = require( 'wdio-mediawiki/Page' );
|
|
|
|
|
|
|
|
class EditPage extends Page {
|
|
|
|
get content() { return $( '#wikitext-editor' ); }
|
|
|
|
get displayedContent() { return $( '#mw-content-text .mw-parser-output' ); }
|
2021-11-05 18:21:09 +00:00
|
|
|
get heading() { return $( 'h1.mw-first-heading' ); }
|
2021-04-21 17:47:08 +00:00
|
|
|
get next() { return $( '.mw-ui-icon-mf-next-invert' ); }
|
|
|
|
get save() { return $( 'button.mw-ui-button' ); }
|
|
|
|
|
|
|
|
openForEditing( title ) {
|
2021-05-07 15:34:58 +00:00
|
|
|
super.openTitle( title, { action: 'edit', mobileaction: 'toggle_view_mobile' } );
|
2021-04-21 17:47:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
edit( name, content ) {
|
|
|
|
this.openForEditing( name );
|
|
|
|
this.content.setValue( content );
|
|
|
|
this.next.click();
|
|
|
|
this.save.click();
|
|
|
|
browser.acceptAlert();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = new EditPage();
|