From 34b56a3044b3ed53672f412479789773156ff3ca Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Sun, 18 Dec 2016 20:21:26 -0300 Subject: [PATCH] Visitor tries to flag a comment --- tests/e2e/pages/embedStreamPage.js | 9 ++++- tests/e2e/tests/Commenter/FlagCommentTest.js | 39 ++++++++++++-------- tests/e2e/tests/Visitor/FlagCommentTest.js | 20 ++++++++++ 3 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 tests/e2e/tests/Visitor/FlagCommentTest.js diff --git a/tests/e2e/pages/embedStreamPage.js b/tests/e2e/pages/embedStreamPage.js index 7e8940f6a..85899360d 100644 --- a/tests/e2e/pages/embedStreamPage.js +++ b/tests/e2e/pages/embedStreamPage.js @@ -47,6 +47,11 @@ const embedStreamCommands = { .waitForElementVisible('@likesCount') .click('@likeButton') .waitForElementVisible('@signInDialog', 2000); + }, + flagComment() { + return this + .waitForElementVisible('@flagButton') + .click('@likeButton'); } }; @@ -83,8 +88,8 @@ export default { likeText: { selector: '.comment .coral-plugin-likes-container .coral-plugin-likes-button .coral-plugin-likes-button-text' }, - likesCount: { - selector: '.comment .coral-plugin-likes-container .coral-plugin-likes-like-count' + flagButton: { + selector: '.comment .coral-plugin-flags-container .coral-plugin-flags-button' } } }; diff --git a/tests/e2e/tests/Commenter/FlagCommentTest.js b/tests/e2e/tests/Commenter/FlagCommentTest.js index 7d9a6678d..f7ab69bb4 100644 --- a/tests/e2e/tests/Commenter/FlagCommentTest.js +++ b/tests/e2e/tests/Commenter/FlagCommentTest.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 report a comment -// When I report the comment -// And choose to flag the comment -// Then I should see the option to give a flag reason -// Then I should see a thank you message -// And the comment should still show on the comment stream -// And the comment should show in the Flagged moderation queue -// -// Given I am a visitor and not logged in -// And I am on the comment stream page -// And I see the option to report a comment -// When I click to report the comment -// Then I should be prompted to login to report +export default { + '@tags': ['flag', 'comments', 'commenter'], + before: client => { + const embedStreamPage = client.page.embedStreamPage(); + const {users} = client.globals; + + embedStreamPage + .navigate() + .ready(); + + embedStreamPage + .login(users.commenter); + }, + 'Commenter likes a comment': client => { + const embedStreamPage = client.page.embedStreamPage(); + + embedStreamPage + .likeComment(); + + }, + after: client => { + client.end(); + } +}; diff --git a/tests/e2e/tests/Visitor/FlagCommentTest.js b/tests/e2e/tests/Visitor/FlagCommentTest.js new file mode 100644 index 000000000..93f9aa8e8 --- /dev/null +++ b/tests/e2e/tests/Visitor/FlagCommentTest.js @@ -0,0 +1,20 @@ +export default { + '@tags': ['flag', 'comments', 'visitor'], + before: client => { + const embedStreamPage = client.page.embedStreamPage(); + + embedStreamPage + .navigate() + .ready(); + }, + 'Visitor tries to flag a comment': client => { + const embedStreamPage = client.page.embedStreamPage(); + + embedStreamPage + .flagComment() + .waitForElementVisible('@signInDialog', 2000); + }, + after: client => { + client.end(); + } +};