From 14a8fcd475cf840f5a047274656a805da0b18279 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 18 Oct 2017 08:51:38 -0300 Subject: [PATCH] Removing test output --- test/e2e/globals.js | 8 ++ test/e2e/page_objects/embedStream.js | 20 ++++ test/e2e/page_objects/login.js | 13 +++ test/e2e/specs/03_embedStream.js | 134 ++++++++++++++++++++++++++- 4 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 test/e2e/page_objects/login.js diff --git a/test/e2e/globals.js b/test/e2e/globals.js index 78ab7f136..a828804b4 100644 --- a/test/e2e/globals.js +++ b/test/e2e/globals.js @@ -19,6 +19,14 @@ module.exports = { username: 'admin', password: 'testtest', }, + user: { + email: 'user@test.com', + username: 'user', + password: 'testtest', + }, + comment: { + body: 'This is a test comment' + }, organizationName: 'Coral', } }; diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 2f5734ab5..8573235d4 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -27,18 +27,38 @@ module.exports = { this.expect.section('@profile').to.be.present; return this.section.profile; }, + getCommentsSection: function() { + this.click('@commentsTabButton'); + this.expect.section('@comments').to.be.present; + return this.section.comments; + }, }], selector: '#talk-embed-stream-container', elements: { + logoutButton: '.talk-stream-userbox-logout', + commentsTabButton: '.talk-embed-stream-comments-tab > button', profileTabButton: '.talk-embed-stream-profile-tab > button', + signInButton: '#coralSignInButton', + commentBoxTextarea: '#commentText', + commentBoxPostButton: '.talk-plugin-commentbox-button', + firstCommentContent: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-content', + likeButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-like-button' }, sections: { profile: { selector: '.talk-embed-stream-profile-tab-pane', elements: { notLoggedIn: '.talk-embed-stream-not-logged-in', + myCommentHistory: '.talk-my-profile-comment-history', + myCommentHistoryReactions: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions', + myCommentHistoryReactionCount: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions .comment-summary-reaction-count', + myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body' }, }, + comments: { + selector: '.talk-embed-stream-comments-tab-pane', + elements: {}, + }, }, }, }, diff --git a/test/e2e/page_objects/login.js b/test/e2e/page_objects/login.js new file mode 100644 index 000000000..1abc40aa8 --- /dev/null +++ b/test/e2e/page_objects/login.js @@ -0,0 +1,13 @@ +module.exports = { + elements: { + registerButton: '#coralRegister', + signInButton: '#coralSignInButton', + emailInput: '#email', + usernameInput: '#username', + passwordInput: '#password', + confirmPasswordInput: '#confirmPassword', + signUpButton: '#coralSignUpButton', + signIn: '.coral-sign-in', + loginButton: '#coralLogInButton' + }, +}; diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index 57c3ce8c2..0b448a5f9 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -1,7 +1,6 @@ module.exports = { - '@tags': ['embedStream'], - - 'Creates a new asset': (client) => { + '@tags': ['embedStream', 'login'], + 'creates a new asset': (client) => { const asset = 'newAssetTest'; const embedStream = client.page.embedStream(); @@ -11,6 +10,134 @@ module.exports = { .getEmbedSection(); }, + 'creates an user and user logs in': (client) => { + const {testData: {user}} = client.globals; + const embedStream = client.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@signInButton') + .click('@signInButton'); + + // Focusing on the Login PopUp + client.window_handles((result) => { + const handle = result.value[1]; + client.switchWindow(handle); + }); + + const login = client.page.login(); + + login + .waitForElementVisible('@registerButton') + .click('@registerButton') + .setValue('@emailInput', user.email) + .setValue('@usernameInput', user.username) + .setValue('@passwordInput', user.password) + .setValue('@confirmPasswordInput', user.password) + .waitForElementVisible('@signUpButton') + .click('@signUpButton') + .waitForElementVisible('@signIn') + .waitForElementVisible('@loginButton') + .click('@loginButton'); + + // Focusing on the Embed Window + client.window_handles((result) => { + const handle = result.value[0]; + client.switchWindow(handle); + }); + }, + 'user posts a comment': (client) => { + const embedStream = client.page.embedStream(); + const {testData: {comment}} = client.globals; + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@commentBoxTextarea') + .setValue('@commentBoxTextarea', comment.body) + .waitForElementVisible('@commentBoxPostButton') + .click('@commentBoxPostButton') + .waitForElementVisible('@firstCommentContent') + .getText('@firstCommentContent', (result) => { + embed.assert.equal(result.value, comment.body); + }); + }, + + 'signed in user sees comment history': (client) => { + const embedStream = client.page.embedStream(); + const {testData: {comment}} = client.globals; + + const embed = embedStream + .navigate() + .getEmbedSection(); + + const profile = embed + .getProfileSection(); + + profile + .waitForElementVisible('@myCommentHistory') + .waitForElementVisible('@myCommentHistoryComment') + .getText('@myCommentHistoryComment', (result) => { + profile.assert.equal(result.value, comment.body); + }); + }, + 'user sees replies and reactions to comments': (client) => { + const embedStream = client.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + const profile = embed + .getProfileSection(); + + profile + .waitForElementVisible('@myCommentHistory') + .waitForElementVisible('@myCommentHistoryReactions') + .waitForElementVisible('@myCommentHistoryReactionCount') + .getText('@myCommentHistoryReactionCount', (result) => { + profile.assert.equal(result.value, '0'); + }); + }, + 'user goes to the stream and replies and reacts to comment': (client) => { + const embedStream = client.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@likeButton') + .click('@likeButton'); + + const profile = embed + .getProfileSection(); + + profile + .waitForElementVisible('@myCommentHistory') + .waitForElementVisible('@myCommentHistoryReactions') + .waitForElementVisible('@myCommentHistoryReactionCount') + .getText('@myCommentHistoryReactionCount', (result) => { + profile.assert.equal(result.value, '1'); + }); + }, + 'user logs out': (client) => { + const embedStream = client.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .click('@commentsTabButton') + .waitForElementVisible('@logoutButton') + .click('@logoutButton'); + }, 'not logged in user clicks my profile tab': (client) => { const embedStream = client.page.embedStream(); @@ -24,7 +151,6 @@ module.exports = { profile .assert.visible('@notLoggedIn'); }, - after: (client) => { client.end(); }