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' ); }
|
2023-09-12 21:22:20 +00:00
|
|
|
// Sync with src/mobile.editor.overlay/EditorOverlayBase.js in MobileFrontend
|
|
|
|
// FIXME: T346184
|
|
|
|
get next() { return $( '.mw-ui-icon-mf-next-invert, .mf-icon-next-invert' ); }
|
2023-08-09 21:49:19 +00:00
|
|
|
get save() { return $( 'button.cdx-button' ); }
|
2021-04-21 17:47:08 +00:00
|
|
|
|
|
|
|
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();
|