: null
}
diff --git a/client/coral-framework/components/RestrictedContent.js b/client/coral-framework/components/RestrictedContent.js
index 01c5ddd93..02df566a4 100644
--- a/client/coral-framework/components/RestrictedContent.js
+++ b/client/coral-framework/components/RestrictedContent.js
@@ -1,16 +1,25 @@
import React from 'react';
-
+import PropTypes from 'prop-types';
import t from 'coral-framework/services/i18n';
import RestrictedMessageBox from './RestrictedMessageBox';
-export default ({children, restricted, message = t('framework.content_not_available'), restrictedComp}) => {
+const RestrictedContent = ({children, restricted, message = t('framework.content_not_available'), restrictedComp}) => {
if (restricted) {
return restrictedComp ? restrictedComp :
+
{children}
);
}
};
+
+RestrictedContent.propTypes = {
+ children: PropTypes.node,
+ restricted: PropTypes.bool,
+ message: PropTypes.string,
+ restrictedComp: PropTypes.node,
+};
+
+export default RestrictedContent;
diff --git a/client/coral-framework/components/RestrictedMessageBox.js b/client/coral-framework/components/RestrictedMessageBox.js
index c579a4731..05c8c89aa 100644
--- a/client/coral-framework/components/RestrictedMessageBox.js
+++ b/client/coral-framework/components/RestrictedMessageBox.js
@@ -1,4 +1,13 @@
import React from 'react';
+import PropTypes from 'prop-types';
+import cn from 'classnames';
import styles from './RestrictedMessageBox.css';
-export default ({children}) =>
{children}
;
+const RestrictedMessageBox = ({children}) =>
+
{children}
;
+
+RestrictedMessageBox.propTypes = {
+ children: PropTypes.node,
+};
+
+export default RestrictedMessageBox;
diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js
index 92f2ac0e1..94ce82826 100644
--- a/test/e2e/page_objects/admin.js
+++ b/test/e2e/page_objects/admin.js
@@ -23,5 +23,7 @@ module.exports = {
'moderationContainer': '.talk-admin-moderation-container',
'drawerButton': '.mdl-layout__drawer-button',
'drawerOverlay': 'div.mdl-layout__obfuscator.is-visible',
+ 'settingsButton': '.talk-admin-header-settings-button',
+ 'signOutButton': '.talk-admin-header-sign-out',
}
};
diff --git a/test/e2e/page_objects/adminCommunity.js b/test/e2e/page_objects/adminCommunity.js
index 6eca507a6..ef3ccbb4c 100644
--- a/test/e2e/page_objects/adminCommunity.js
+++ b/test/e2e/page_objects/adminCommunity.js
@@ -10,5 +10,13 @@ module.exports = {
}],
elements: {
container: '.talk-admin-community',
+ flaggedAccountsContainer: '.talk-adnin-community-flagged-accounts',
+ flaggedUser:'.talk-admin-community-flagged-user',
+ flaggedUserApproveButton: '.talk-admin-flagged-user-approve-button',
+ flaggedUserRejectButton: '.talk-admin-flagged-user-reject-button',
+ usernameDialog: '.talk-reject-username-dialog',
+ usernameDialogButtons: '.talk-reject-username-dialog-buttons',
+ usernameDialogSuspend: '.talk-reject-username-dialog-button-k',
+ usernameDialogSuspensionMessage: '.talk-reject-username-dialog-suspension-message'
}
};
diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js
index dd90f66b0..85a0480da 100644
--- a/test/e2e/page_objects/embedStream.js
+++ b/test/e2e/page_objects/embedStream.js
@@ -44,7 +44,10 @@ module.exports = {
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'
+ respectButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button',
+ restrictedMessageBox: '.talk-restricted-message-box',
+ suspendedAccountInput: '.talk-suspended-account-username-input',
+ suspendedAccountSubmitButton: '.talk-suspended-account-submit-button',
},
sections: {
flag: {
@@ -53,7 +56,7 @@ module.exports = {
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'
+ popUpText: '.talk-plugin-flags-popup-text',
}
},
profile: {
@@ -63,7 +66,7 @@ module.exports = {
myCommentHistory: '.talk-my-profile-comment-history',
myCommentHistoryReactions: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions',
myCommentHistoryReactionCount: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions .comment-summary-reaction-count',
- myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body'
+ myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body',
},
},
comments: {
diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js
index 4a60780bb..432666a38 100644
--- a/test/e2e/specs/02_admin.js
+++ b/test/e2e/specs/02_admin.js
@@ -51,6 +51,7 @@ module.exports = {
.click('@drawerOverlay')
.waitForElementVisible('@communitySection');
},
+
after: (client) => {
client.end();
}
diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js
index f3eaee0c6..32bf6b72a 100644
--- a/test/e2e/specs/04_userStatus.js
+++ b/test/e2e/specs/04_userStatus.js
@@ -48,7 +48,108 @@ module.exports = {
.navigate();
community
- .waitForElementVisible('@container');
+ .waitForElementVisible('@container')
+ .waitForElementVisible('@flaggedAccountsContainer')
+ .waitForElementVisible('@flaggedUser');
+ },
+ 'admin rejects the user flag': (client) => {
+ const community = client.page.adminCommunity();
+
+ community
+ .waitForElementVisible('@flaggedUserRejectButton')
+ .click('@flaggedUserRejectButton');
+ },
+ 'admin suspends the user': (client) => {
+ const community = client.page.adminCommunity();
+
+ community
+ .waitForElementVisible('@usernameDialog')
+ .waitForElementVisible('@usernameDialogButtons')
+ .waitForElementVisible('@usernameDialogSuspend')
+ .click('@usernameDialogSuspend')
+ .waitForElementVisible('@usernameDialogSuspensionMessage')
+ .click('@usernameDialogSuspend')
+ .waitForElementNotPresent('@flaggedUser');
+ },
+ 'admin logs out': (client) => {
+ const admin = client.page.admin();
+
+ admin
+ .waitForElementVisible('@settingsButton')
+ .click('@settingsButton')
+ .waitForElementVisible('@signOutButton')
+ .click('@signOutButton');
+ },
+ 'user logs in': (client) => {
+ const {testData: {user}} = client.globals;
+ const embedStream = client.page.embedStream();
+
+ const embed = embedStream
+ .navigate()
+ .getEmbedSection();
+
+ embed
+ .waitForElementVisible('@signInButton')
+ .click('@signInButton');
+
+ client.pause(3000);
+
+ // Focusing on the Login PopUp
+ client.windowHandles((result) => {
+ const handle = result.value[1];
+ client.switchWindow(handle);
+ });
+
+ const login = client.page.login();
+
+ login
+ .setValue('@emailInput', user.email)
+ .setValue('@passwordInput', user.password)
+ .waitForElementVisible('@signIn')
+ .waitForElementVisible('@loginButton')
+ .click('@loginButton');
+
+ // Focusing on the Embed Window
+ client.windowHandles((result) => {
+ const handle = result.value[0];
+ client.switchWindow(handle);
+ });
+ },
+ 'user account is suspended, should see restricted message box': (client) => {
+ const embedStream = client.page.embedStream();
+
+ const embed = embedStream
+ .navigate()
+ .getEmbedSection();
+
+ embed
+ .waitForElementVisible('@restrictedMessageBox');
+ },
+
+ 'user picks another username': (client) => {
+ const {testData: {user}} = client.globals;
+ const embedStream = client.page.embedStream();
+
+ const embed = embedStream
+ .navigate()
+ .getEmbedSection();
+
+ embed
+ .waitForElementVisible('@suspendedAccountInput')
+ .setValue('@suspendedAccountInput', `${user.username}-alternative`)
+ .waitForElementVisible('@suspendedAccountSubmitButton')
+ .click('@suspendedAccountSubmitButton');
+ },
+ 'user should not be able to comment': (client) => {
+ const embedStream = client.page.embedStream();
+
+ const embed = embedStream
+ .navigate()
+ .getEmbedSection();
+
+ embed
+ .waitForElementNotPresent('@commentBoxTextarea')
+ .waitForElementNotPresent('@commentBoxPostButton');
},
after: (client) => {
client.end();