diff --git a/test/e2e/page_objects/adminCommunity.js b/test/e2e/page_objects/adminCommunity.js new file mode 100644 index 000000000..6eca507a6 --- /dev/null +++ b/test/e2e/page_objects/adminCommunity.js @@ -0,0 +1,14 @@ +module.exports = { + commands: [{ + url: function() { + return `${this.api.launchUrl}/admin/community`; + }, + ready() { + return this + .waitForElementVisible('body'); + }, + }], + elements: { + container: '.talk-admin-community', + } +}; diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 76065ba5e..dd90f66b0 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -41,10 +41,21 @@ module.exports = { signInButton: '#coralSignInButton', commentBoxTextarea: '#commentText', commentBoxPostButton: '.talk-plugin-commentbox-button', + firstComment: '.talk-stream-comment.talk-stream-comment-level-0', firstCommentContent: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-content', + flagButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-flags-button', respectButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button' }, sections: { + flag: { + selector: '.talk-plugin-flags-popup', + elements: { + offensiveUsernameRadio: '.talk-plugin-flags-popup-radio#USERNAME_OFFENSIVE', + flagUsernameRadio: '.talk-plugin-flags-popup-radio#USERS', + continueButton: '.talk-plugin-flags-popup-button', + popUpText: '.talk-plugin-flags-popup-text' + } + }, profile: { selector: '.talk-embed-stream-profile-tab-pane', elements: { diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js new file mode 100644 index 000000000..f3eaee0c6 --- /dev/null +++ b/test/e2e/specs/04_userStatus.js @@ -0,0 +1,56 @@ +module.exports = { + 'admin logs in': (client) => { + const adminPage = client.page.admin(); + const {testData: {admin}} = client.globals; + + adminPage + .navigate() + .waitForElementVisible('@loginLayout') + .waitForElementVisible('@signInForm') + .setValue('@emailInput', admin.email) + .setValue('@passwordInput', admin.password) + .waitForElementVisible('@signInButton') + .click('@signInButton'); + + client.pause(3000); + + adminPage + .waitForElementVisible('@moderationContainer'); + }, + 'admin flags user\'s username as offensive': (client) => { + const embedStream = client.page.embedStream(); + const flagSection = client.page.embedStream().section.embed.section.flag; + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@firstComment') + .waitForElementVisible('@flagButton') + .click('@flagButton'); + + flagSection + .waitForElementVisible('@flagUsernameRadio') + .click('@flagUsernameRadio') + .waitForElementVisible('@continueButton') + .click('@continueButton') + .waitForElementVisible('@offensiveUsernameRadio') + .click('@offensiveUsernameRadio') + .click('@continueButton') + .waitForElementVisible('@popUpText') + .click('@continueButton'); + }, + 'admin goes to Reported Usernames': (client) => { + const community = client.page.adminCommunity(); + + community + .navigate(); + + community + .waitForElementVisible('@container'); + }, + after: (client) => { + client.end(); + } +};