From 89709a80c158f0214a10f68ffc438066879e2979 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 19 Dec 2016 10:31:51 -0300 Subject: [PATCH] Flag Comment --- tests/e2e/globals.js | 14 ------ tests/e2e/pages/embedStreamPage.js | 45 ++++++++++++++++++- tests/e2e/tests/Commenter/FlagCommentTest.js | 3 +- tests/e2e/tests/Commenter/FlagUsernameTest.js | 19 +++++++- 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/tests/e2e/globals.js b/tests/e2e/globals.js index 14d0dda20..ece635fae 100644 --- a/tests/e2e/globals.js +++ b/tests/e2e/globals.js @@ -1,18 +1,4 @@ export default { - beforeEach: function(browser, done) { - console.log('Before Each'); - setTimeout(function() { - // finished async duties - done(); - }, 100); - }, - afterEach: function(browser, done) { - console.log('After Each'); - setTimeout(function() { - // finished async duties - done(); - }, 200); - }, waitForConditionTimeout: 8000, baseUrl: 'http://localhost:3000', users: { diff --git a/tests/e2e/pages/embedStreamPage.js b/tests/e2e/pages/embedStreamPage.js index c3a181f98..7e80397a2 100644 --- a/tests/e2e/pages/embedStreamPage.js +++ b/tests/e2e/pages/embedStreamPage.js @@ -43,7 +43,32 @@ const embedStreamCommands = { flagComment() { return this .waitForElementVisible('@flagButton') - .click('@flagButton'); + .click('@flagButton') + .waitForElementVisible('@flagPopUp') + .waitForElementVisible('@flagCommentOption') + .click('@flagCommentOption') + .waitForElementVisible('@flagDoneButton') + .click('@flagDoneButton') + .waitForElementVisible('@flagOtherOption') + .click('@flagOtherOption') + .waitForElementVisible('@flagDoneButton') + .click('@flagDoneButton') + .click('@flagDoneButton'); + }, + flagUsername() { + return this + .waitForElementVisible('@flagButton') + .click('@flagButton') + .waitForElementVisible('@flagPopUp') + .waitForElementVisible('@flagUsernameOption') + .click('@flagUsernameOption') + .waitForElementVisible('@flagDoneButton') + .click('@flagDoneButton') + .waitForElementVisible('@flagOtherOption') + .click('@flagOtherOption') + .waitForElementVisible('@flagDoneButton') + .click('@flagDoneButton') + .click('@flagDoneButton'); } }; @@ -88,6 +113,24 @@ export default { }, flagPopUp: { selector: '.comment .coral-plugin-flags-popup' + }, + flagCommentOption: { + selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-radio-label[for="comments"]' + }, + flagUsernameOption: { + selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-radio-label[for="user"]' + }, + flagOtherOption: { + selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-radio-label[for="other"]' + }, + flagHeaderMessage: { + selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-header' + }, + flagButtonText: { + selector: '.comment .coral-plugin-flags-button-text' + }, + flagDoneButton: { + selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-button' } } }; diff --git a/tests/e2e/tests/Commenter/FlagCommentTest.js b/tests/e2e/tests/Commenter/FlagCommentTest.js index f9ea9acdd..4dc044e2f 100644 --- a/tests/e2e/tests/Commenter/FlagCommentTest.js +++ b/tests/e2e/tests/Commenter/FlagCommentTest.js @@ -15,7 +15,8 @@ export default { const embedStreamPage = client.page.embedStreamPage(); embedStreamPage - .flagComment(); + .flagComment() + .expect.element('@flagButtonText').text.to.equal('Reported'); }, after: client => { client.end(); diff --git a/tests/e2e/tests/Commenter/FlagUsernameTest.js b/tests/e2e/tests/Commenter/FlagUsernameTest.js index bc1635b93..a75091ed4 100644 --- a/tests/e2e/tests/Commenter/FlagUsernameTest.js +++ b/tests/e2e/tests/Commenter/FlagUsernameTest.js @@ -1,6 +1,21 @@ export default { - '@tags': ['flag', 'comments', 'username', 'commenter'], - 'Commenter flags a username': () => { + tags: 'flag', + before: client => { + const embedStreamPage = client.page.embedStreamPage(); + const {users} = client.globals; + + embedStreamPage + .navigate() + .ready(); + + embedStreamPage + .login(users.commenter); + }, + 'Commenter flags a comment': client => { + const embedStreamPage = client.page.embedStreamPage(); + + embedStreamPage + .flagComment(); }, after: client => { client.end();