2020-06-02 21:21:44 +00:00
|
|
|
'use strict';
|
|
|
|
|
2019-04-08 23:45:11 +00:00
|
|
|
const assert = require( 'assert' );
|
|
|
|
const { iSeeAnOverlay, waitForPropagation } = require( './common_steps' );
|
|
|
|
const ArticlePageWithEditorOverlay = require( '../support/pages/article_page_with_editor_overlay' );
|
|
|
|
const { ArticlePage } = require( '../support/world.js' );
|
|
|
|
|
2019-10-17 22:46:07 +00:00
|
|
|
const iClickTheAddTalkButton = () => {
|
2019-09-18 23:07:21 +00:00
|
|
|
ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.scripts' );
|
2020-06-15 14:54:05 +00:00
|
|
|
ArticlePage.talk_add_element.waitForDisplayed();
|
2019-10-17 22:46:07 +00:00
|
|
|
ArticlePage.talk_add_element.click();
|
2019-04-08 23:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const iAddATopic = ( subject ) => {
|
|
|
|
const overlay = ArticlePageWithEditorOverlay.editor_overlay_element;
|
2020-06-15 14:54:05 +00:00
|
|
|
overlay.$( '.overlay input' ).waitForExist();
|
|
|
|
overlay.$( '.overlay input' ).setValue( subject );
|
|
|
|
overlay.$( '.overlay textarea' ).setValue( 'Topic body is a really long text.' );
|
2020-06-25 15:18:56 +00:00
|
|
|
ArticlePageWithEditorOverlay.submit_element.waitForEnabled();
|
2019-04-08 23:45:11 +00:00
|
|
|
ArticlePageWithEditorOverlay.submit_element.click();
|
|
|
|
waitForPropagation( 5000 );
|
|
|
|
};
|
|
|
|
|
|
|
|
const iSeeTheTalkOverlay = () => {
|
|
|
|
iSeeAnOverlay();
|
|
|
|
};
|
|
|
|
|
|
|
|
const thereShouldBeASaveDiscussionButton = () => {
|
|
|
|
const submit = ArticlePageWithEditorOverlay.submit_element;
|
|
|
|
submit.waitForExist();
|
2020-06-15 14:54:05 +00:00
|
|
|
assert.strictEqual( submit.isDisplayed(), true );
|
2019-04-08 23:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const noTopicIsPresent = () => {
|
2019-10-17 22:46:07 +00:00
|
|
|
assert.strictEqual( ArticlePage.first_section_element.isExisting(), false );
|
2019-04-08 23:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const thereShouldBeAnAddDiscussionButton = () => {
|
2020-06-15 14:54:05 +00:00
|
|
|
assert.strictEqual( ArticlePage.talk_add_element.isDisplayed(), true );
|
2019-10-17 22:46:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const thereShouldBeATalkButton = () => {
|
2020-06-15 14:54:05 +00:00
|
|
|
assert.strictEqual( ArticlePage.talk_element.isDisplayed(), true );
|
2019-04-08 23:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const thereShouldBeNoTalkButton = () => {
|
2020-06-15 14:54:05 +00:00
|
|
|
assert.strictEqual( ArticlePage.talk_element.isDisplayed(), false );
|
2019-04-08 23:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const iShouldSeeTheTopicInTheListOfTopics = ( subject ) => {
|
|
|
|
assert.strictEqual(
|
2021-11-09 14:48:40 +00:00
|
|
|
ArticlePage.first_section_element.getText().includes( subject ),
|
2019-04-08 23:45:11 +00:00
|
|
|
true
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-12-13 19:51:24 +00:00
|
|
|
const thereShouldBeATalkTab = () => {
|
2020-06-15 14:54:05 +00:00
|
|
|
assert.strictEqual( ArticlePage.talk_tab_element.isDisplayed(), true );
|
2019-12-13 19:51:24 +00:00
|
|
|
};
|
|
|
|
|
2019-04-08 23:45:11 +00:00
|
|
|
module.exports = {
|
|
|
|
iAddATopic,
|
|
|
|
iSeeTheTalkOverlay,
|
|
|
|
thereShouldBeASaveDiscussionButton,
|
|
|
|
noTopicIsPresent,
|
|
|
|
thereShouldBeAnAddDiscussionButton,
|
2019-12-13 19:51:24 +00:00
|
|
|
thereShouldBeATalkTab,
|
2019-10-17 22:46:07 +00:00
|
|
|
thereShouldBeATalkButton,
|
2019-04-08 23:45:11 +00:00
|
|
|
thereShouldBeNoTalkButton,
|
|
|
|
iShouldSeeTheTopicInTheListOfTopics,
|
2019-10-17 22:46:07 +00:00
|
|
|
iClickTheAddTalkButton
|
2019-04-08 23:45:11 +00:00
|
|
|
};
|