From b674ff45c0ff063daba2a9ea3a5e4e31fdb90b0b Mon Sep 17 00:00:00 2001 From: David Jay Date: Fri, 27 Jan 2017 17:29:23 -0500 Subject: [PATCH] Addressing errors with replies in e2e. --- client/coral-embed-stream/src/Comment.js | 2 +- .../graphql/fragments/commentView.graphql | 1 + client/coral-plugin-commentbox/CommentBox.js | 2 -- .../CommentContent.js | 2 +- test/e2e/tests/EmbedStreamTests.js | 36 +++++++++---------- 5 files changed, 19 insertions(+), 24 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 93c89ffb0..529420941 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -87,7 +87,7 @@ class Comment extends React.Component { return (

diff --git a/client/coral-framework/graphql/fragments/commentView.graphql b/client/coral-framework/graphql/fragments/commentView.graphql index b54c00e67..fb8051155 100644 --- a/client/coral-framework/graphql/fragments/commentView.graphql +++ b/client/coral-framework/graphql/fragments/commentView.graphql @@ -2,6 +2,7 @@ fragment commentView on Comment { id body created_at + status user { id name: displayName diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 258681a08..41c8f75fb 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -75,8 +75,6 @@ class CommentBox extends Component { } else if (postedComment.status === 'PREMOD') { addNotification('success', lang.t('comment-post-notif-premod')); } else { - - // appendItemArray(parent_id || id, related, commentId, !parent_id, parent_type); addNotification('success', 'Your comment has been posted.'); } diff --git a/client/coral-plugin-commentcontent/CommentContent.js b/client/coral-plugin-commentcontent/CommentContent.js index 542776c63..2dab237dd 100644 --- a/client/coral-plugin-commentcontent/CommentContent.js +++ b/client/coral-plugin-commentcontent/CommentContent.js @@ -1,5 +1,5 @@ import React from 'react'; -const name = 'coral-plugin-replies'; +const name = 'coral-plugin-content'; const Content = ({body, styles}) => { const textbreaks = body.split('\n'); diff --git a/test/e2e/tests/EmbedStreamTests.js b/test/e2e/tests/EmbedStreamTests.js index 63acf0f0d..7343c3d0a 100644 --- a/test/e2e/tests/EmbedStreamTests.js +++ b/test/e2e/tests/EmbedStreamTests.js @@ -1,7 +1,7 @@ const mongoose = require('../../helpers/mongoose'); const mocks = require('../mocks'); -const mockComment = 'This is a test comment.'; +const mockComment = 'I read the comments'; const mockReply = 'This is a test reply'; const mockUser = { email: `${new Date().getTime()}@test.com`, @@ -46,10 +46,10 @@ module.exports = { // Post a comment .setValue('.coral-plugin-commentbox-textarea', mockComment) .click('.coral-plugin-commentbox-button') - .waitForElementVisible('.comment', 1000) + .waitForElementVisible('.coral-plugin-content-text', 1000) // Verify that it appears - .assert.containsText('.comment', mockComment); + .assert.containsText('.coral-plugin-content-text', mockComment); done(); }) .catch((err) => { @@ -103,8 +103,8 @@ module.exports = { .click('.coral-plugin-replies-reply-button') .waitForElementVisible('#replyText') .setValue('#replyText', mockReply) - .click('.coral-plugin-replies-textarea button') - .waitForElementVisible('.reply', 2000) + .click('.coral-plugin-replies-textarea .coral-plugin-commentbox-button') + .waitForElementVisible('.reply', 20000) // Verify that it appears .assert.containsText('.reply', mockReply); @@ -121,22 +121,18 @@ module.exports = { mocks.settings({moderation: 'PRE'}) // Add a mock user - .then(() => { - return mocks.users([{ - displayName: 'Baby Blue', - email: 'whale@tale.sea', - password: 'krill' - }]); - }) + .then(() => mocks.users([{ + displayName: 'Baby Blue', + email: 'whale@tale.sea', + password: 'krill' + }])) // Add a mock preapproved comment by that user - .then((user) => { - return mocks.comments([{ - body: 'Whales are not fish.', - status: 'accepted', - author_id: user.id - }]); - }) + .then((user) => mocks.comments([{ + body: 'Whales are not fish.', + status: 'accepted', + author_id: user.id + }])) .then(() => { // Load Page @@ -169,7 +165,7 @@ module.exports = { // Verify that comment count is correct client.waitForElementVisible('.coral-plugin-comment-count-text', 2000) - .assert.containsText('.coral-plugin-comment-count-text', '2 Comments'); + .assert.containsText('.coral-plugin-comment-count-text', '4 Comments'); done(); }); },