mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
Addressing errors with replies in e2e.
This commit is contained in:
@@ -87,7 +87,7 @@ class Comment extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="comment"
|
className={parentId ? 'reply' : 'comment'}
|
||||||
id={`c_${comment.id}`}
|
id={`c_${comment.id}`}
|
||||||
style={{marginLeft: depth * 30}}>
|
style={{marginLeft: depth * 30}}>
|
||||||
<hr aria-hidden={true} />
|
<hr aria-hidden={true} />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ fragment commentView on Comment {
|
|||||||
id
|
id
|
||||||
body
|
body
|
||||||
created_at
|
created_at
|
||||||
|
status
|
||||||
user {
|
user {
|
||||||
id
|
id
|
||||||
name: displayName
|
name: displayName
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ class CommentBox extends Component {
|
|||||||
} else if (postedComment.status === 'PREMOD') {
|
} else if (postedComment.status === 'PREMOD') {
|
||||||
addNotification('success', lang.t('comment-post-notif-premod'));
|
addNotification('success', lang.t('comment-post-notif-premod'));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// appendItemArray(parent_id || id, related, commentId, !parent_id, parent_type);
|
|
||||||
addNotification('success', 'Your comment has been posted.');
|
addNotification('success', 'Your comment has been posted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
const name = 'coral-plugin-replies';
|
const name = 'coral-plugin-content';
|
||||||
|
|
||||||
const Content = ({body, styles}) => {
|
const Content = ({body, styles}) => {
|
||||||
const textbreaks = body.split('\n');
|
const textbreaks = body.split('\n');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const mongoose = require('../../helpers/mongoose');
|
const mongoose = require('../../helpers/mongoose');
|
||||||
const mocks = require('../mocks');
|
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 mockReply = 'This is a test reply';
|
||||||
const mockUser = {
|
const mockUser = {
|
||||||
email: `${new Date().getTime()}@test.com`,
|
email: `${new Date().getTime()}@test.com`,
|
||||||
@@ -46,10 +46,10 @@ module.exports = {
|
|||||||
// Post a comment
|
// Post a comment
|
||||||
.setValue('.coral-plugin-commentbox-textarea', mockComment)
|
.setValue('.coral-plugin-commentbox-textarea', mockComment)
|
||||||
.click('.coral-plugin-commentbox-button')
|
.click('.coral-plugin-commentbox-button')
|
||||||
.waitForElementVisible('.comment', 1000)
|
.waitForElementVisible('.coral-plugin-content-text', 1000)
|
||||||
|
|
||||||
// Verify that it appears
|
// Verify that it appears
|
||||||
.assert.containsText('.comment', mockComment);
|
.assert.containsText('.coral-plugin-content-text', mockComment);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -103,8 +103,8 @@ module.exports = {
|
|||||||
.click('.coral-plugin-replies-reply-button')
|
.click('.coral-plugin-replies-reply-button')
|
||||||
.waitForElementVisible('#replyText')
|
.waitForElementVisible('#replyText')
|
||||||
.setValue('#replyText', mockReply)
|
.setValue('#replyText', mockReply)
|
||||||
.click('.coral-plugin-replies-textarea button')
|
.click('.coral-plugin-replies-textarea .coral-plugin-commentbox-button')
|
||||||
.waitForElementVisible('.reply', 2000)
|
.waitForElementVisible('.reply', 20000)
|
||||||
|
|
||||||
// Verify that it appears
|
// Verify that it appears
|
||||||
.assert.containsText('.reply', mockReply);
|
.assert.containsText('.reply', mockReply);
|
||||||
@@ -121,22 +121,18 @@ module.exports = {
|
|||||||
mocks.settings({moderation: 'PRE'})
|
mocks.settings({moderation: 'PRE'})
|
||||||
|
|
||||||
// Add a mock user
|
// Add a mock user
|
||||||
.then(() => {
|
.then(() => mocks.users([{
|
||||||
return mocks.users([{
|
displayName: 'Baby Blue',
|
||||||
displayName: 'Baby Blue',
|
email: 'whale@tale.sea',
|
||||||
email: 'whale@tale.sea',
|
password: 'krill'
|
||||||
password: 'krill'
|
}]))
|
||||||
}]);
|
|
||||||
})
|
|
||||||
|
|
||||||
// Add a mock preapproved comment by that user
|
// Add a mock preapproved comment by that user
|
||||||
.then((user) => {
|
.then((user) => mocks.comments([{
|
||||||
return mocks.comments([{
|
body: 'Whales are not fish.',
|
||||||
body: 'Whales are not fish.',
|
status: 'accepted',
|
||||||
status: 'accepted',
|
author_id: user.id
|
||||||
author_id: user.id
|
}]))
|
||||||
}]);
|
|
||||||
})
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
||||||
// Load Page
|
// Load Page
|
||||||
@@ -169,7 +165,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Verify that comment count is correct
|
// Verify that comment count is correct
|
||||||
client.waitForElementVisible('.coral-plugin-comment-count-text', 2000)
|
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();
|
done();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user