mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-19 17:21:07 +00:00
c8ce9608c0
Bug: T255447 Change-Id: I4cdde3070a6dc4e742ea37a78a17dfd556103dd6
73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require( 'assert' );
|
|
const { ArticlePageWithEditorOverlay, ArticlePage } = require( '../support/world.js' );
|
|
|
|
const iClickTheEditButton = () => {
|
|
ArticlePage.edit_link_element.waitForDisplayed();
|
|
ArticlePage.edit_link_element.click();
|
|
};
|
|
const iSeeTheWikitextEditorOverlay = () => {
|
|
ArticlePageWithEditorOverlay.editor_overlay_element.waitForDisplayed();
|
|
ArticlePageWithEditorOverlay.editor_textarea_element.waitForExist();
|
|
};
|
|
const iClearTheEditor = () => {
|
|
ArticlePageWithEditorOverlay.editor_textarea_element.setValue( '' );
|
|
};
|
|
const iDoNotSeeTheWikitextEditorOverlay = () => {
|
|
browser.waitUntil( () => {
|
|
return ArticlePageWithEditorOverlay.editor_overlay_element.isDisplayed() === false;
|
|
}, 10000 );
|
|
};
|
|
const iTypeIntoTheEditor = ( text ) => {
|
|
ArticlePageWithEditorOverlay.editor_overlay_element.waitForExist();
|
|
ArticlePageWithEditorOverlay.editor_textarea_element.waitForExist();
|
|
ArticlePageWithEditorOverlay.editor_textarea_element.waitForDisplayed();
|
|
ArticlePageWithEditorOverlay.editor_textarea_element.addValue( text );
|
|
browser.waitUntil( () => {
|
|
return !ArticlePageWithEditorOverlay
|
|
.continue_element.getAttribute( 'disabled' );
|
|
} );
|
|
};
|
|
const iClickContinue = () => {
|
|
ArticlePageWithEditorOverlay.continue_element.waitForExist();
|
|
ArticlePageWithEditorOverlay.continue_element.click();
|
|
};
|
|
const iClickSubmit = () => {
|
|
ArticlePageWithEditorOverlay.submit_element.waitForExist();
|
|
ArticlePageWithEditorOverlay.submit_element.click();
|
|
};
|
|
const iSayOkayInTheConfirmDialog = () => {
|
|
browser.waitUntil( () => {
|
|
try {
|
|
const text = browser.getAlertText();
|
|
return text && true;
|
|
} catch ( e ) {
|
|
return false;
|
|
}
|
|
}, 2000 );
|
|
browser.acceptAlert();
|
|
};
|
|
const theTextOfTheFirstHeadingShouldBe = ( title ) => {
|
|
ArticlePage.first_heading_element.waitForDisplayed();
|
|
assert.strictEqual(
|
|
ArticlePage.first_heading_element.getText(),
|
|
title
|
|
);
|
|
};
|
|
const thereShouldBeARedLinkWithText = ( text ) => {
|
|
ArticlePage.red_link_element.waitForExist();
|
|
assert.strictEqual(
|
|
ArticlePage.red_link_element.getText(),
|
|
text
|
|
);
|
|
};
|
|
|
|
module.exports = {
|
|
iClickTheEditButton, iSeeTheWikitextEditorOverlay, iClearTheEditor,
|
|
thereShouldBeARedLinkWithText,
|
|
iDoNotSeeTheWikitextEditorOverlay,
|
|
iTypeIntoTheEditor, iClickContinue, iClickSubmit, iSayOkayInTheConfirmDialog,
|
|
theTextOfTheFirstHeadingShouldBe
|
|
};
|