From c8c803506b34a272da7a403131ded8a2b66a631c Mon Sep 17 00:00:00 2001 From: Martin Schoeler Date: Mon, 10 Oct 2016 11:44:19 -0300 Subject: [PATCH] added message actions tests for different rooms added role tags , reply/quote, message creator tests and some fixes. --- tests/pageobjects/main-content.page.js | 2 + tests/steps/basic-usage.js | 392 ++++++++++++++++++++++++- 2 files changed, 384 insertions(+), 10 deletions(-) diff --git a/tests/pageobjects/main-content.page.js b/tests/pageobjects/main-content.page.js index 4cb7b0fcaf1..1f1d7f2be1e 100644 --- a/tests/pageobjects/main-content.page.js +++ b/tests/pageobjects/main-content.page.js @@ -18,8 +18,10 @@ class MainContent extends Page { get popupFileCancelBtn() { return browser.element('.sa-button-container .cancel'); } get lastMessageUser() { return browser.element('.message:last-child .user-card-message:nth-of-type(2)'); } get lastMessage() { return browser.element('.message:last-child .body'); } + get beforeLastMessage() { return browser.element('.message:nth-last-child(2) .body'); } get lastMessageUserTag() { return browser.element('.message:last-child .role-tag'); } get lastMessageImg() { return browser.element('.message:last-child .attachment-image img'); } + get lastMessageTextAttachment() { return browser.element('.message:last-child .attachment-text'); } get messageOptionsBtn() { return browser.element('.message:last-child .info .message-cog-container .icon-cog'); } get messageReply() { return browser.element('.message:last-child .message-dropdown .reply-message'); } get messageActionMenu() { return browser.element('.message:last-child .message-dropdown'); } diff --git a/tests/steps/basic-usage.js b/tests/steps/basic-usage.js index 3efd899dadd..2ef4eddfe84 100644 --- a/tests/steps/basic-usage.js +++ b/tests/steps/basic-usage.js @@ -16,7 +16,7 @@ const message = 'message from '+username; //Basic usage test start -describe.only('Basic usage', function() { +describe('Basic usage', function() { this.retries(2); it('load page', () => { @@ -225,8 +225,8 @@ describe.only('Basic usage', function() { mainContent.lastMessageUser.getText().should.equal(username); }); - it('should not show the admin tag', () => { - mainContent.lastMessageUserTag.should.not.equal('admin'); + it('should not show the Admin tag', () => { + mainContent.lastMessageUserTag.isVisible().should.be.false; }); }); @@ -260,7 +260,7 @@ describe.only('Basic usage', function() { }); }); - describe('messages actions', ()=> { + describe('messages actions in general room', ()=> { describe('render', () => { it('open GENERAL', () => { sideNav.openChannel('general'); @@ -306,10 +306,6 @@ describe.only('Basic usage', function() { mainContent.messageStar.isVisible().should.be.true; }); - it('should show the star action', () => { - mainContent.messageStar.isVisible().should.be.true; - }); - it('should show the reaction action', () => { mainContent.messageReaction.isVisible().should.be.true; }); @@ -345,6 +341,10 @@ describe.only('Basic usage', function() { mainContent.sendBtn.click(); }); + it('checks if the message was replied', () => { + mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText()); + }); + it('send a message to test the edit', () => { mainContent.addTextToInput('Message for Message edit Tests '); mainContent.sendBtn.click(); @@ -389,6 +389,10 @@ describe.only('Basic usage', function() { mainContent.sendBtn.click(); }); + it('checks if the message was quoted', () => { + mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText()); + }); + it('send a message to test the star', () => { mainContent.sendMessage('Message for star Tests'); }); @@ -398,8 +402,7 @@ describe.only('Basic usage', function() { }); it('star the message', () => { - mainContent.selectAction('reply'); - mainContent.sendBtn.click(); + mainContent.selectAction('star'); }); it('send a message to test the copy', () => { @@ -535,6 +538,189 @@ describe.only('Basic usage', function() { it('send a direct message', () => { mainContent.sendMessage(message); }); + + it('should show the last message', () => { + mainContent.lastMessage.isVisible().should.be.true; + }); + + it('the last message should be from the loged user', () => { + mainContent.lastMessageUser.getText().should.equal(username); + }); + + it('should not show the Admin tag', () => { + mainContent.lastMessageUserTag.isVisible().should.be.false; + }); + + describe('messages actions in direct messages', ()=> { + describe('render', () => { + it('open GENERAL', () => { + sideNav.openChannel('general'); + }); + + it('send a message to be tested', () => { + mainContent.sendMessage('Message for Message Actions Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('should show the message action menu', () => { + mainContent.messageActionMenu.isVisible().should.be.true; + }); + + it('should show the reply action', () => { + mainContent.messageReply.isVisible().should.be.true; + }); + + it('should show the edit action', () => { + mainContent.messageEdit.isVisible().should.be.true; + }); + + it('should show the delete action', () => { + mainContent.messageDelete.isVisible().should.be.true; + }); + + it('should show the permalink action', () => { + mainContent.messagePermalink.isVisible().should.be.true; + }); + + it('should show the copy action', () => { + mainContent.messageCopy.isVisible().should.be.true; + }); + + it('should show the quote the action', () => { + mainContent.messageQuote.isVisible().should.be.true; + }); + + it('should show the star action', () => { + mainContent.messageStar.isVisible().should.be.true; + }); + + it('should show the reaction action', () => { + mainContent.messageReaction.isVisible().should.be.true; + }); + + it('should show the close action', () => { + mainContent.messageClose.isVisible().should.be.true; + }); + + it('should not show the pin action', () => { + mainContent.messagePin.isVisible().should.be.false; + }); + + it('should not show the mark as unread action', () => { + mainContent.messageUnread.isVisible().should.be.false; + }); + + it('close the action menu', () => { + mainContent.selectAction('close'); + }); + }); + + describe('usage', () => { + it('send a message to test the reply', () => { + mainContent.sendMessage('Message for reply Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('reply the message', () => { + mainContent.selectAction('reply'); + mainContent.sendBtn.click(); + }); + + it('checks if the message was replied', () => { + mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText()); + }); + + it('send a message to test the edit', () => { + mainContent.addTextToInput('Message for Message edit Tests '); + mainContent.sendBtn.click(); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('edit the message', () => { + mainContent.selectAction('edit'); + mainContent.sendBtn.click(); + }); + + it('send a message to test the delete', () => { + mainContent.sendMessage('Message for Message Delete Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('delete the message', () => { + mainContent.selectAction('delete'); + mainContent.popupFileConfirmBtn.click(); + }); + + it('should not show the deleted message', () => { + mainContent.lastMessage.should.not.equal('Message for Message Delete Tests'); + }); + + it('send a message to test the quote', () => { + mainContent.sendMessage('Message for quote Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('quote the message', () => { + mainContent.selectAction('quote'); + mainContent.sendBtn.click(); + }); + + it('checks if the message was quoted', () => { + mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText()); + }); + + it('send a message to test the star', () => { + mainContent.sendMessage('Message for star Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('star the message', () => { + mainContent.selectAction('star'); + }); + + it('send a message to test the copy', () => { + mainContent.sendMessage('Message for copy Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('copy the message', () => { + mainContent.selectAction('copy'); + }); + + it('send a message to test the permalink', () => { + mainContent.sendMessage('Message for permalink Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('permalink the message', () => { + mainContent.selectAction('permalink'); + }); + }); + }); }); describe('public channel', () => { @@ -544,12 +730,31 @@ describe.only('Basic usage', function() { it('open the public channel', () => { sideNav.openChannel(PublicChannelName); + browser.pause(5000); }); it('send a message in the public channel', () => { mainContent.sendMessage(message); }); + it('should show the last message', () => { + mainContent.lastMessage.isVisible().should.be.true; + }); + + it('the last message should be from the loged user', () => { + mainContent.lastMessageUser.getText().should.equal(username); + }); + + it('should not show the Admin tag', () => { + var messageTag = mainContent.lastMessageUserTag.getText(); + messageTag.should.not.equal('Admin'); + }); + + it('should show the Owner tag', () => { + var messageTag = mainContent.lastMessageUserTag.getText(); + messageTag.should.equal('Owner'); + }); + it('add people to the room', () => { flexTab.membersTab.click(); flexTab.addPeopleToChannel(targetUser); @@ -580,6 +785,173 @@ describe.only('Basic usage', function() { mainContent.sendMessage(message); }); + describe('messages actions in private room', ()=> { + describe('render', () => { + it('send a message to be tested', () => { + mainContent.sendMessage('Message for Message Actions Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('should show the message action menu', () => { + mainContent.messageActionMenu.isVisible().should.be.true; + }); + + it('should show the reply action', () => { + mainContent.messageReply.isVisible().should.be.true; + }); + + it('should show the edit action', () => { + mainContent.messageEdit.isVisible().should.be.true; + }); + + it('should show the delete action', () => { + mainContent.messageDelete.isVisible().should.be.true; + }); + + it('should show the permalink action', () => { + mainContent.messagePermalink.isVisible().should.be.true; + }); + + it('should show the copy action', () => { + mainContent.messageCopy.isVisible().should.be.true; + }); + + it('should show the quote the action', () => { + mainContent.messageQuote.isVisible().should.be.true; + }); + + it('should show the star action', () => { + mainContent.messageStar.isVisible().should.be.true; + }); + + it('should show the reaction action', () => { + mainContent.messageReaction.isVisible().should.be.true; + }); + + it('should show the close action', () => { + mainContent.messageClose.isVisible().should.be.true; + }); + + it('should show show the pin action', () => { + mainContent.messagePin.isVisible().should.be.true; + }); + + it('should not show the mark as unread action', () => { + mainContent.messageUnread.isVisible().should.be.false; + }); + + it('close the action menu', () => { + mainContent.selectAction('close'); + }); + }); + + describe('usage', () => { + it('send a message to test the reply', () => { + mainContent.sendMessage('Message for reply Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('reply the message', () => { + mainContent.selectAction('reply'); + mainContent.sendBtn.click(); + }); + + it('checks if the message was replied', () => { + mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText()); + }); + + it('send a message to test the edit', () => { + mainContent.addTextToInput('Message for Message edit Tests '); + mainContent.sendBtn.click(); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('edit the message', () => { + mainContent.selectAction('edit'); + mainContent.sendBtn.click(); + }); + + it('send a message to test the delete', () => { + mainContent.sendMessage('Message for Message Delete Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('delete the message', () => { + mainContent.selectAction('delete'); + mainContent.popupFileConfirmBtn.click(); + }); + + it('should not show the deleted message', () => { + mainContent.lastMessage.should.not.equal('Message for Message Delete Tests'); + }); + + it('send a message to test the quote', () => { + mainContent.sendMessage('Message for quote Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('quote the message', () => { + mainContent.selectAction('quote'); + mainContent.sendBtn.click(); + }); + + it('checks if the message was quoted', () => { + mainContent.lastMessageTextAttachment.getText().should.equal(mainContent.beforeLastMessage.getText()); + }); + + it('send a message to test the star', () => { + mainContent.sendMessage('Message for star Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('star the message', () => { + mainContent.selectAction('star'); + }); + + it('send a message to test the copy', () => { + mainContent.sendMessage('Message for copy Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('copy the message', () => { + mainContent.selectAction('copy'); + }); + + it('send a message to test the permalink', () => { + mainContent.sendMessage('Message for permalink Tests'); + }); + + it('open the message action menu', () => { + mainContent.openMessageActionMenu(); + }); + + it('permalink the message', () => { + mainContent.selectAction('permalink'); + }); + }); + }); + it('add people to the room', () => { flexTab.membersTab.click(); flexTab.addPeopleToChannel(targetUser);