Addressing errors with replies in e2e.

This commit is contained in:
David Jay
2017-01-27 17:29:23 -05:00
parent 1da61784b4
commit b674ff45c0
5 changed files with 19 additions and 24 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ class Comment extends React.Component {
return (
<div
className="comment"
className={parentId ? 'reply' : 'comment'}
id={`c_${comment.id}`}
style={{marginLeft: depth * 30}}>
<hr aria-hidden={true} />
@@ -2,6 +2,7 @@ fragment commentView on Comment {
id
body
created_at
status
user {
id
name: displayName
@@ -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.');
}
@@ -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');
+16 -20
View File
@@ -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();
});
},