2021-04-21 17:47:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const Page = require( 'wdio-mediawiki/Page' );
|
|
|
|
|
|
|
|
class EditPage extends Page {
|
2024-01-24 22:02:12 +00:00
|
|
|
get content() {
|
|
|
|
return $( '#wikitext-editor' );
|
|
|
|
}
|
|
|
|
|
|
|
|
get displayedContent() {
|
|
|
|
return $( '#mw-content-text .mw-parser-output' );
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2024-01-24 22:02:12 +00:00
|
|
|
get next() {
|
|
|
|
return $( '.mf-icon-next-invert' );
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|