From 9950595245e5a8c4e649c901b06763a5b61d351a Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Sun, 18 Dec 2016 19:34:41 -0300 Subject: [PATCH] Commenter likes a comment --- client/coral-plugin-likes/LikeButton.js | 2 +- tests/e2e/pages/embedStreamPage.js | 8 +++++ tests/e2e/tests/Commenter/LikeCommentTest.js | 37 ++++++++++++-------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/client/coral-plugin-likes/LikeButton.js b/client/coral-plugin-likes/LikeButton.js index 9e7d06f33..fae30c8c7 100644 --- a/client/coral-plugin-likes/LikeButton.js +++ b/client/coral-plugin-likes/LikeButton.js @@ -2,7 +2,7 @@ import React from 'react'; import {I18n} from '../coral-framework'; import translations from './translations.json'; -const name = 'coral-plugin-flags'; +const name = 'coral-plugin-likes'; const LikeButton = ({like, id, postAction, deleteAction, addItem, showSignInDialog, updateItem, currentUser, banned}) => { const liked = like && like.current_user; diff --git a/tests/e2e/pages/embedStreamPage.js b/tests/e2e/pages/embedStreamPage.js index 67798036e..4737694b8 100644 --- a/tests/e2e/pages/embedStreamPage.js +++ b/tests/e2e/pages/embedStreamPage.js @@ -33,6 +33,11 @@ const embedStreamCommands = { .waitForElementVisible('@commentBox', 2000) .setValue('@commentBox', comment) .click('@postButton'); + }, + likeComment() { + return this + .waitForElementVisible('@likeButton', 2000) + .click('@likeButton'); } }; @@ -62,6 +67,9 @@ export default { }, postButton: { selector: '#commentBox .coral-plugin-commentbox-button' + }, + likeButton: { + selector: '.comment:first-child .coral-plugin-likes-button' } } }; diff --git a/tests/e2e/tests/Commenter/LikeCommentTest.js b/tests/e2e/tests/Commenter/LikeCommentTest.js index a6eb952a5..c00fca62b 100644 --- a/tests/e2e/tests/Commenter/LikeCommentTest.js +++ b/tests/e2e/tests/Commenter/LikeCommentTest.js @@ -1,15 +1,24 @@ -// Given I am signed into my commenter account -// And I am on the comment stream page -// And I see the option to like a comment -// And I see the number of likes on a comment -// When I like a comment -// Then the comment should show as Liked -// And the like count should increase by one +module.exports = { + '@tags': ['like', 'comments', 'commenter'], + before: client => { + const embedStreamPage = client.page.embedStreamPage(); + const {users} = client.globals; -// Given I am a visitor and not logged in -// And I am on the comment stream page -// And I see the option to like a comment -// And I see the number of likes on a comment -// When I like a comment -// Then I should be prompted to login to like a comment -// And the like count should not be increased + embedStreamPage + .navigate() + .ready(); + + embedStreamPage + .login(users.commenter); + }, + 'Commenter likes a comment': client => { + const embedStreamPage = client.page.embedStreamPage(); + + embedStreamPage + .likeComment(); + + }, + after: client => { + client.end(); + } +};