2017-03-28 13:59:35 +00:00
|
|
|
'use strict';
|
|
|
|
const Page = require( 'wdio-mediawiki/Page' );
|
|
|
|
|
|
|
|
class EditPage extends Page {
|
|
|
|
|
2022-12-02 22:38:34 +00:00
|
|
|
get bulletListOption() { return $( '.oo-ui-tool-name-bullet' ); }
|
2022-12-02 23:10:17 +00:00
|
|
|
get boldTextStyleOption() { return $( '.oo-ui-tool-name-bold' ); }
|
2021-09-14 16:32:09 +00:00
|
|
|
get content() { return $( '#content' ); }
|
|
|
|
get edited() { return $( '*=Your edit was saved' ); }
|
2022-12-02 23:38:54 +00:00
|
|
|
get formatParagraphElement() { return $( '.ve-ui-toolbar-group-format' ); }
|
2023-06-07 14:48:43 +00:00
|
|
|
get helpPopup() { return $( '.ve-ui-mwHelpListToolGroup-tools' ); }
|
|
|
|
get helpElement() { return $( '.ve-ui-toolbar-group-help' ); }
|
2022-10-12 13:16:39 +00:00
|
|
|
get insert() { return $( '.ve-ui-toolbar-group-insert' ); }
|
2022-12-02 22:07:49 +00:00
|
|
|
get insertMenu() { return $( '.oo-ui-tool-name-media' ); }
|
2022-10-12 13:16:39 +00:00
|
|
|
get insertTableElement() { return $( '.oo-ui-tool-name-insertTable' ); }
|
|
|
|
get insertedTable() { return $( 'table.ve-ce-branchNode' ); }
|
2021-09-14 16:32:09 +00:00
|
|
|
get notices() { return $( '.ve-ui-mwNoticesPopupTool-items' ); }
|
2022-05-31 14:36:52 +00:00
|
|
|
get notification() { return $( 'div.mw-notification-content span.oo-ui-labelElement-label' ); }
|
2022-10-20 05:42:31 +00:00
|
|
|
get options() { return $( '.oo-ui-tool-name-meta' ); }
|
|
|
|
get pageOptionsElement() { return $( '.ve-ui-toolbar-group-pageMenu' ); }
|
2022-12-02 23:38:54 +00:00
|
|
|
get paragraphFormatMenu() { return $( '.oo-ui-tool-name-paragraph' ); }
|
2022-10-20 05:42:31 +00:00
|
|
|
get popupToolGroup() { return $( '.oo-ui-popupToolGroup-active-tools' ); }
|
2021-09-14 16:32:09 +00:00
|
|
|
get savePage() { return $( '.ve-ui-overlay-global .oo-ui-processDialog-actions-primary' ); }
|
|
|
|
get savePageDots() { return $( '.ve-ui-toolbar-saveButton' ); }
|
2022-11-30 14:17:33 +00:00
|
|
|
get specialCharacterElement() { return $( '.oo-ui-tool-name-specialCharacter' ); }
|
|
|
|
get specialCharacterMenu() { return $( '.oo-ui-menuLayout' ); }
|
2022-12-02 22:38:34 +00:00
|
|
|
get structureOptionsElement() { return $( '.ve-ui-toolbar-group-structure' ); }
|
2022-12-02 23:10:17 +00:00
|
|
|
get styleTextElement() { return $( '.ve-ui-toolbar-group-style' ); }
|
2022-10-19 13:04:49 +00:00
|
|
|
get switchEditorElement() { return $( '.ve-ui-toolbar-group-editMode' ); }
|
2022-03-21 14:54:47 +00:00
|
|
|
get toolbar() { return $( '.ve-init-mw-desktopArticleTarget-toolbar-open' ); }
|
2021-09-14 16:32:09 +00:00
|
|
|
get veBodyContent() { return $( '.mw-body-content.ve-ui-surface' ); }
|
2022-04-04 15:28:07 +00:00
|
|
|
get veRootNode() { return $( '.ve-ce-rootNode[role="textbox"]' ); }
|
2022-10-20 05:42:31 +00:00
|
|
|
get visualEditing() { return $( '.oo-ui-tool-name-editModeVisual' ); }
|
2017-03-28 13:59:35 +00:00
|
|
|
|
|
|
|
openForEditing( title ) {
|
2022-06-13 11:39:52 +00:00
|
|
|
super.openTitle( title, { veaction: 'edit', cxhidebetapopup: 1, hidewelcomedialog: 1, vehidebetadialog: 1 } );
|
2017-03-28 13:59:35 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 15:53:17 +00:00
|
|
|
activationComplete() {
|
|
|
|
return browser.executeAsync( function ( done ) {
|
|
|
|
mw.hook( 've.activationComplete' ).add( function () {
|
|
|
|
done();
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2022-10-12 13:16:39 +00:00
|
|
|
async insertTable() {
|
|
|
|
await this.insert.click();
|
|
|
|
await this.insertTableElement.click();
|
|
|
|
}
|
|
|
|
|
2022-06-08 14:56:24 +00:00
|
|
|
saveComplete() {
|
|
|
|
return browser.executeAsync( function ( done ) {
|
|
|
|
ve.init.target.on( 'save', function () {
|
|
|
|
done();
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2017-03-28 13:59:35 +00:00
|
|
|
}
|
|
|
|
module.exports = new EditPage();
|