From f493e5413d77b1ae589b66a4554da3df156e45fa Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 19 Dec 2016 09:30:28 -0300 Subject: [PATCH] Passing tests --- tests/e2e/globals.js | 16 +++++++++++++++- tests/e2e/pages/adminPage.js | 3 +-- tests/e2e/pages/embedStreamPage.js | 18 ++++++++---------- tests/e2e/tests/Commenter/FlagCommentTest.js | 5 ++--- tests/e2e/tests/Commenter/FlagUsernameTest.js | 17 ++++++++--------- tests/e2e/tests/Commenter/LikeCommentTest.js | 3 ++- tests/e2e/tests/Commenter/PermalinkTest.js | 19 ++++++++----------- tests/e2e/tests/Visitor/LikeCommentTest.js | 3 ++- 8 files changed, 46 insertions(+), 38 deletions(-) diff --git a/tests/e2e/globals.js b/tests/e2e/globals.js index 7975a2c50..14d0dda20 100644 --- a/tests/e2e/globals.js +++ b/tests/e2e/globals.js @@ -1,4 +1,18 @@ 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: { @@ -14,5 +28,5 @@ export default { email: 'commenter@test.com', pass: 'test' } - } + }, }; diff --git a/tests/e2e/pages/adminPage.js b/tests/e2e/pages/adminPage.js index 8aad77b55..883e0e621 100644 --- a/tests/e2e/pages/adminPage.js +++ b/tests/e2e/pages/adminPage.js @@ -1,7 +1,6 @@ const embedStreamCommands = { url: function () { - return this - .api.launchUrl + '/admin'; + return `${this.api.launchUrl}/admin`; }, ready() { return this diff --git a/tests/e2e/pages/embedStreamPage.js b/tests/e2e/pages/embedStreamPage.js index 85899360d..c3a181f98 100644 --- a/tests/e2e/pages/embedStreamPage.js +++ b/tests/e2e/pages/embedStreamPage.js @@ -38,20 +38,12 @@ const embedStreamCommands = { return this .waitForElementVisible('@likeButton') .waitForElementVisible('@likesCount') - .click('@likeButton') - .expect.element('@likeText').text.to.equal('Liked'); - }, - visitorLikeComment() { - return this - .waitForElementVisible('@likeButton') - .waitForElementVisible('@likesCount') - .click('@likeButton') - .waitForElementVisible('@signInDialog', 2000); + .click('@likeButton'); }, flagComment() { return this .waitForElementVisible('@flagButton') - .click('@likeButton'); + .click('@flagButton'); } }; @@ -88,8 +80,14 @@ 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-button .coral-plugin-likes-like-count' + }, flagButton: { selector: '.comment .coral-plugin-flags-container .coral-plugin-flags-button' + }, + flagPopUp: { + selector: '.comment .coral-plugin-flags-popup' } } }; diff --git a/tests/e2e/tests/Commenter/FlagCommentTest.js b/tests/e2e/tests/Commenter/FlagCommentTest.js index f7ab69bb4..f9ea9acdd 100644 --- a/tests/e2e/tests/Commenter/FlagCommentTest.js +++ b/tests/e2e/tests/Commenter/FlagCommentTest.js @@ -11,12 +11,11 @@ export default { embedStreamPage .login(users.commenter); }, - 'Commenter likes a comment': client => { + 'Commenter flags a comment': client => { const embedStreamPage = client.page.embedStreamPage(); embedStreamPage - .likeComment(); - + .flagComment(); }, after: client => { client.end(); diff --git a/tests/e2e/tests/Commenter/FlagUsernameTest.js b/tests/e2e/tests/Commenter/FlagUsernameTest.js index eb606e24c..bc1635b93 100644 --- a/tests/e2e/tests/Commenter/FlagUsernameTest.js +++ b/tests/e2e/tests/Commenter/FlagUsernameTest.js @@ -1,9 +1,8 @@ -// 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 username -// 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 username should show in the Flagged moderation queue +export default { + '@tags': ['flag', 'comments', 'username', 'commenter'], + 'Commenter flags a username': () => { + }, + after: client => { + client.end(); + } +}; diff --git a/tests/e2e/tests/Commenter/LikeCommentTest.js b/tests/e2e/tests/Commenter/LikeCommentTest.js index c00fca62b..bdc429e8f 100644 --- a/tests/e2e/tests/Commenter/LikeCommentTest.js +++ b/tests/e2e/tests/Commenter/LikeCommentTest.js @@ -15,7 +15,8 @@ module.exports = { const embedStreamPage = client.page.embedStreamPage(); embedStreamPage - .likeComment(); + .likeComment() + .expect.element('@likeText').text.to.equal('Liked'); }, after: client => { diff --git a/tests/e2e/tests/Commenter/PermalinkTest.js b/tests/e2e/tests/Commenter/PermalinkTest.js index ed8c7a270..354f1ad76 100644 --- a/tests/e2e/tests/Commenter/PermalinkTest.js +++ b/tests/e2e/tests/Commenter/PermalinkTest.js @@ -1,11 +1,8 @@ -// -// Given I am signed into my commenter account -// And I visit the comment stream page -// And I should see the option to link to a comment -// When I click to link to a comment -// Then the link should be there for me to copy -// -// Given I have clicked the link to a comment -// When I copy and paste that comment -// Then I should be directed to that comment stream -// And the page should scroll to where that comment is in the stream +export default { + '@tags': ['permalink', 'commenter'], + 'Permalink': () => { + }, + after: client => { + client.end(); + } +}; diff --git a/tests/e2e/tests/Visitor/LikeCommentTest.js b/tests/e2e/tests/Visitor/LikeCommentTest.js index a4ced2ce8..6aaca5b49 100644 --- a/tests/e2e/tests/Visitor/LikeCommentTest.js +++ b/tests/e2e/tests/Visitor/LikeCommentTest.js @@ -11,7 +11,8 @@ module.exports = { const embedStreamPage = client.page.embedStreamPage(); embedStreamPage - .visitorLikeComment(); + .likeComment() + .waitForElementVisible('@signInDialog', 2000); }, after: client => { client.end();