+
this.viewNewComments()}
count={comments.length - view.length}
diff --git a/test/e2e/globals.js b/test/e2e/globals.js
index aeecd204e..6a7eb07fb 100644
--- a/test/e2e/globals.js
+++ b/test/e2e/globals.js
@@ -23,9 +23,6 @@ module.exports = {
username: 'user',
password: 'testtest',
},
- comment: {
- body: 'This is a test comment',
- },
organizationName: 'Coral',
organizationContactEmail: 'coral@coralproject.net',
},
diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js
index 8e319e499..64d22c97b 100644
--- a/test/e2e/page_objects/admin.js
+++ b/test/e2e/page_objects/admin.js
@@ -70,9 +70,28 @@ module.exports = {
},
moderate: {
selector: '.talk-admin-moderation-container',
+ commands: [
+ {
+ url: function() {
+ return `${this.api.launchUrl}/admin/moderate`;
+ },
+ ready() {
+ return this.waitForElementVisible('body');
+ },
+ goToQueue(queue) {
+ this.click(`#talk-admin-moderate-tab-${queue}`).expect.section(
+ `.talk-admin-moderate-queue-${queue}`
+ ).to.be.visible;
+ return this;
+ },
+ },
+ ],
elements: {
- comment: '.talk-admin-moderate-comment',
- commentUsername: '.talk-admin-moderate-comment-username',
+ firstComment: '.talk-admin-moderate-comment',
+ firstCommentUsername: '.talk-admin-moderate-comment-username',
+ firstCommentContent: '.talk-admin-comment',
+ firstCommentApprove: '.talk-admin-approve-button',
+ firstCommentReject: '.talk-admin-reject-button',
},
},
stories: {
diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js
index 4b6831271..9eca7a736 100644
--- a/test/e2e/specs/03_embedStream.js
+++ b/test/e2e/specs/03_embedStream.js
@@ -1,3 +1,5 @@
+const commentBody = 'Embed Stream Test';
+
module.exports = {
'@tags': ['embedStream', 'login'],
@@ -40,28 +42,26 @@ module.exports = {
},
'user posts a comment': client => {
const comments = client.page.embedStream().section.comments;
- const { testData: { comment } } = client.globals;
comments
.waitForElementVisible('@commentBoxTextarea')
- .setValue('@commentBoxTextarea', comment.body)
+ .setValue('@commentBoxTextarea', commentBody)
.waitForElementVisible('@commentBoxPostButton')
.click('@commentBoxPostButton')
.waitForElementVisible('@firstCommentContent')
.getText('@firstCommentContent', result => {
- comments.assert.equal(result.value, comment.body);
+ comments.assert.equal(result.value, commentBody);
});
},
'signed in user sees comment history': client => {
const profile = client.page.embedStream().goToProfileSection();
- const { testData: { comment } } = client.globals;
profile
.waitForElementVisible('@myCommentHistory')
.waitForElementVisible('@myCommentHistoryComment')
.getText('@myCommentHistoryComment', result => {
- profile.assert.equal(result.value, comment.body);
+ profile.assert.equal(result.value, commentBody);
});
},
'user sees replies and reactions to comments': client => {
diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js
index 45ab0c347..51055a180 100644
--- a/test/e2e/specs/05_banUser.js
+++ b/test/e2e/specs/05_banUser.js
@@ -1,3 +1,5 @@
+const commentBody = 'Ban User Test';
+
module.exports = {
before: client => {
client.setWindowPosition(0, 0);
@@ -109,4 +111,51 @@ module.exports = {
.waitForElementVisible('@commentBoxTextarea')
.waitForElementVisible('@commentBoxPostButton');
},
+ 'user posts comment, karma should stop it from happening': client => {
+ const comments = client.page.embedStream().section.comments;
+
+ comments
+ .waitForElementVisible('@commentBoxTextarea')
+ .setValue('@commentBoxTextarea', commentBody)
+ .waitForElementVisible('@commentBoxPostButton')
+ .click('@commentBoxPostButton');
+
+ client.pause(2000);
+
+ comments.waitForElementNotPresent('@firstCommentContent');
+ },
+ 'user logs out 3': client => {
+ const embedStream = client.page.embedStream();
+ const comments = embedStream.section.comments;
+
+ comments.logout();
+ },
+ 'admin logs in (3)': client => {
+ const adminPage = client.page.admin();
+ const { testData: { admin } } = client.globals;
+
+ adminPage.navigateAndLogin(admin);
+ },
+ 'admin goes to moderation queue reported': client => {
+ const adminPage = client.page.admin();
+
+ adminPage.goToModerate().goToQueue('reported');
+ },
+ 'comment should be in reported queue': client => {
+ const moderate = client.page.admin().section.moderate;
+
+ moderate
+ .waitForElementVisible('@firstComment')
+ .getText('@firstCommentContent', result => {
+ moderate.assert.equal(result.value, commentBody);
+ });
+ },
+ 'approve comment to restore karma': client => {
+ const moderate = client.page.admin().section.moderate;
+
+ moderate.click('@firstCommentApprove');
+
+ // TODO: check why this fails.
+ // .waitForElementNotPresent('@firstComment');
+ },
};
diff --git a/test/e2e/specs/06_suspendUser.js b/test/e2e/specs/06_suspendUser.js
index 81fde3781..e02f21db9 100644
--- a/test/e2e/specs/06_suspendUser.js
+++ b/test/e2e/specs/06_suspendUser.js
@@ -1,3 +1,5 @@
+const commentBody = 'Suspend User Test';
+
module.exports = {
before: client => {
client.setWindowPosition(0, 0);
@@ -25,16 +27,15 @@ module.exports = {
},
'user posts comment': client => {
const comments = client.page.embedStream().section.comments;
- const { testData: { comment } } = client.globals;
comments
.waitForElementVisible('@commentBoxTextarea')
- .setValue('@commentBoxTextarea', comment.body)
+ .setValue('@commentBoxTextarea', commentBody)
.waitForElementVisible('@commentBoxPostButton')
.click('@commentBoxPostButton')
.waitForElementVisible('@firstCommentContent')
.getText('@firstCommentContent', result => {
- comments.assert.equal(result.value, comment.body);
+ comments.assert.equal(result.value, commentBody);
});
},
'user logs out': client => {
@@ -84,9 +85,9 @@ module.exports = {
.goToModerate();
moderate
- .waitForElementVisible('@comment')
- .waitForElementVisible('@commentUsername')
- .click('@commentUsername');
+ .waitForElementVisible('@firstComment')
+ .waitForElementVisible('@firstCommentUsername')
+ .click('@firstCommentUsername');
userDetailDrawer
.waitForElementVisible('@actionsMenu')
@@ -112,9 +113,9 @@ module.exports = {
const { moderate, userDetailDrawer } = adminPage.section;
moderate
- .waitForElementVisible('@comment')
- .waitForElementVisible('@commentUsername')
- .click('@commentUsername');
+ .waitForElementVisible('@firstComment')
+ .waitForElementVisible('@firstCommentUsername')
+ .click('@firstCommentUsername');
userDetailDrawer
.waitForElementVisible('@tabBar')