The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/tests/steps/3-basic-usage.js

972 lines
26 KiB

9 years ago
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */
import loginPage from '../pageobjects/login.page';
import flexTab from '../pageobjects/flex-tab.page';
import mainContent from '../pageobjects/main-content.page';
import sideNav from '../pageobjects/side-nav.page';
9 years ago
//test data imports
import {username, email, password} from '../test-data/user.js';
import {publicChannelName, privateChannelName} from '../test-data/channel.js';
import {targetUser} from '../test-data/interactions.js';
//Test data
const message = 'message from '+username;
//Basic usage test start
describe('Basic usage', function() {
9 years ago
this.retries(2);
9 years ago
it('load page', () => {
loginPage.open();
});
9 years ago
it('create user', () => {
9 years ago
loginPage.gotToRegister();
loginPage.registerNewUser({username, email, password});
browser.waitForExist('form#login-card input#username', 5000);
browser.click('.submit > button');
browser.waitForExist('.main-content', 5000);
});
9 years ago
it('logout', () => {
9 years ago
browser.waitForVisible('.account-box');
browser.click('.account-box');
browser.pause(200);
browser.waitForVisible('#logout');
browser.click('#logout');
});
9 years ago
it('login', () => {
9 years ago
loginPage.login({email, password});
browser.waitForExist('.main-content', 5000);
});
describe('side nav bar', () => {
9 years ago
describe('render', () => {
it('should show the logged username', () => {
sideNav.accountBoxUserName.isVisible().should.be.true;
});
9 years ago
it('should show the logged user avatar', () => {
sideNav.accountBoxUserAvatar.isVisible().should.be.true;
});
9 years ago
it('should show the new channel button', () => {
sideNav.newChannelBtn.isVisible().should.be.true;
});
9 years ago
it('should show the plus icon', () => {
sideNav.newChannelIcon.isVisible().should.be.true;
});
9 years ago
it('should show the "More Channels" button', () => {
sideNav.moreChannels.isVisible().should.be.true;
});
9 years ago
it('should show the new direct message button', () => {
sideNav.newDirectMessageBtn.isVisible().should.be.true;
});
9 years ago
it('should show the plus icon', () => {
sideNav.newDirectMessageIcon.isVisible().should.be.true;
});
9 years ago
9 years ago
it('should show the "More Direct Messages" button', () => {
sideNav.moreDirectMessages.isVisible().should.be.true;
});
9 years ago
it('should show "general" channel', () => {
sideNav.general.isVisible().should.be.true;
});
9 years ago
it('should not show eye icon on general', () => {
sideNav.channelHoverIcon.isVisible().should.be.false;
});
9 years ago
it('should show eye icon on hover', () => {
sideNav.general.moveToObject();
sideNav.channelHoverIcon.isVisible().should.be.true;
});
});
describe('user options', () => {
9 years ago
describe('render', () => {
before(() => {
sideNav.accountBoxUserName.click();
});
9 years ago
after(() => {
sideNav.accountBoxUserName.click();
9 years ago
});
it('should show user options', () => {
sideNav.userOptions.waitForVisible();
sideNav.userOptions.isVisible().should.be.true;
});
9 years ago
it('should show online button', () => {
sideNav.statusOnline.isVisible().should.be.true;
});
9 years ago
it('should show away button', () => {
sideNav.statusAway.isVisible().should.be.true;
});
9 years ago
it('should show busy button', () => {
sideNav.statusBusy.isVisible().should.be.true;
});
9 years ago
it('should show offline button', () => {
sideNav.statusOffline.isVisible().should.be.true;
});
9 years ago
it('should show settings button', () => {
sideNav.account.isVisible().should.be.true;
});
9 years ago
it('should show logout button', () => {
sideNav.logout.isVisible().should.be.true;
});
});
});
9 years ago
});
describe('general channel', () => {
9 years ago
it('open GENERAL', () => {
browser.waitForExist('.wrapper > ul .link-room-GENERAL', 50000);
browser.click('.wrapper > ul .link-room-GENERAL');
9 years ago
9 years ago
browser.waitForExist('.input-message', 5000);
});
9 years ago
9 years ago
it('send a message', () => {
mainContent.sendMessage(message);
});
describe('main content usage', () => {
describe('render', () => {
it('should show the title of the channel', () => {
mainContent.channelTitle.isVisible().should.be.true;
});
it('should show the empty favorite star', () => {
mainContent.emptyFavoriteStar.isVisible().should.be.true;
});
it('clicks the star', () => {
mainContent.emptyFavoriteStar.click();
});
it('should not show the empty favorite star', () => {
mainContent.favoriteStar.isVisible().should.be.true;
});
it('clicks the star', () => {
mainContent.favoriteStar.click();
});
it('should show the message input bar', () => {
mainContent.messageInput.isVisible().should.be.true;
});
it('should show the file attachment button', () => {
mainContent.fileAttachmentBtn.isVisible().should.be.true;
});
it('should show the audio recording button', () => {
mainContent.recordBtn.isVisible().should.be.true;
});
it('should show the video call button', () => {
mainContent.videoCamBtn.isVisible().should.be.true;
});
it('should not show the send button', () => {
mainContent.sendBtn.isVisible().should.be.false;
});
it('should show the emoji button', () => {
mainContent.emojiBtn.isVisible().should.be.true;
});
it('adds some text to the input', () => {
mainContent.addTextToInput('Some Text');
});
it('should show the send button', () => {
mainContent.sendBtn.isVisible().should.be.true;
});
it('should not show the file attachment button', () => {
mainContent.fileAttachmentBtn.isVisible().should.be.false;
});
it('should not show the audio recording button', () => {
mainContent.recordBtn.isVisible().should.be.false;
});
it('should not show the video call button', () => {
mainContent.videoCamBtn.isVisible().should.be.false;
});
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;
});
});
9 years ago
describe('fileUpload', ()=> {
it('send a attachment', () => {
mainContent.fileUpload('./public/images/logo/1024x1024.png');
});
it('should show the confirm button', () => {
mainContent.popupFileConfirmBtn.isVisible().should.be.true;
});
9 years ago
it('should show the cancel button', () => {
mainContent.popupFileCancelBtn.isVisible().should.be.true;
});
it('should show the file preview', () => {
mainContent.popupFilePreview.isVisible().should.be.true;
});
9 years ago
it('should show the confirm button', () => {
mainContent.popupFileConfirmBtn.isVisible().should.be.true;
});
it('should show the file title', () => {
mainContent.popupFileTitle.isVisible().should.be.true;
});
it('click the confirm', () => {
mainContent.popupFileConfirmBtn.click();
});
});
describe('messages actions in general room', ()=> {
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');
});
});
});
});
});
9 years ago
describe('flextab usage', () => {
9 years ago
describe('render', () => {
it('should show the room info button', () => {
flexTab.channelTab.isVisible().should.be.true;
});
9 years ago
it('should show the room info tab content', () => {
browser.pause(3000);
flexTab.channelTab.click();
flexTab.channelSettings.isVisible().should.be.true;
});
9 years ago
it('should show the message search button', () => {
flexTab.searchTab.isVisible().should.be.true;
});
9 years ago
it('should show the message tab content', () => {
flexTab.searchTab.click();
flexTab.searchTabContent.isVisible().should.be.true;
});
9 years ago
it('should show the members tab button', () => {
flexTab.membersTab.isVisible().should.be.true;
});
9 years ago
it('should show the members content', () => {
flexTab.membersTab.click();
flexTab.membersTabContent.isVisible().should.be.true;
});
9 years ago
it('should show the members search bar', () => {
flexTab.userSearchBar.isVisible().should.be.true;
});
9 years ago
it('should show the show all link', () => {
flexTab.showAll.isVisible().should.be.true;
});
9 years ago
it('should show the start video call button', () => {
flexTab.startVideoCall.isVisible().should.be.true;
});
9 years ago
it('should show the start audio call', () => {
flexTab.startAudioCall.isVisible().should.be.true;
});
9 years ago
it('should show the notifications button', () => {
flexTab.notificationsTab.isVisible().should.be.true;
});
9 years ago
it('should show the notifications Tab content', () => {
flexTab.notificationsTab.click();
flexTab.notificationsSettings.isVisible().should.be.true;
});
9 years ago
it('should show the files button', () => {
flexTab.filesTab.isVisible().should.be.true;
});
9 years ago
it('should show the files Tab content', () => {
flexTab.filesTab.click();
flexTab.filesTabContent.isVisible().should.be.true;
});
9 years ago
it('should show the mentions button', () => {
flexTab.mentionsTab.isVisible().should.be.true;
});
9 years ago
it('should show the mentions Tab content', () => {
flexTab.mentionsTab.click();
flexTab.mentionsTabContent.isVisible().should.be.true;
});
9 years ago
it('should show the starred button', () => {
flexTab.starredTab.isVisible().should.be.true;
});
9 years ago
it('should show the starred Tab content', () => {
flexTab.starredTab.click();
flexTab.starredTabContent.isVisible().should.be.true;
});
9 years ago
it('should show the pinned button', () => {
flexTab.pinnedTab.isVisible().should.be.true;
});
9 years ago
it('should show the pinned messages Tab content', () => {
flexTab.pinnedTab.click();
flexTab.pinnedTabContent.isVisible().should.be.true;
});
});
});
9 years ago
describe('direct channel', () => {
9 years ago
it('start a direct message with rocket.cat', () => {
sideNav.startDirectMessage(targetUser);
});
9 years ago
9 years ago
it('open the direct message', () => {
sideNav.openChannel(targetUser);
});
9 years ago
9 years ago
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');
});
});
});
9 years ago
});
describe('public channel', () => {
9 years ago
it('create a public channel', () => {
sideNav.createChannel(publicChannelName, false, false);
});
it('open the public channel', () => {
sideNav.openChannel(publicChannelName);
browser.pause(5000);
9 years ago
});
9 years ago
9 years ago
it('send a message in the public channel', () => {
mainContent.sendMessage(message);
});
9 years ago
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');
});
9 years ago
it('add people to the room', () => {
flexTab.membersTab.click();
flexTab.addPeopleToChannel(targetUser);
});
9 years ago
9 years ago
it('remove people from room', () => {
flexTab.removePeopleFromChannel(targetUser);
flexTab.confirmPopup();
});
9 years ago
it.skip('archive the room', () => {
9 years ago
flexTab.channelTab.click();
flexTab.archiveChannel();
flexTab.channelTab.click();
});
9 years ago
9 years ago
it('open GENERAL', () => {
sideNav.openChannel('general');
});
9 years ago
});
describe('private channel', () => {
9 years ago
it('create a private channel', () => {
sideNav.createChannel(privateChannelName, true, false);
});
9 years ago
9 years ago
it('send a message in the private channel', () => {
mainContent.sendMessage(message);
});
9 years ago
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');
});
});
});
9 years ago
it('add people to the room', () => {
flexTab.membersTab.click();
flexTab.addPeopleToChannel(targetUser);
});
9 years ago
9 years ago
it('remove people from room', () => {
flexTab.removePeopleFromChannel(targetUser);
flexTab.confirmPopup();
});
9 years ago
9 years ago
it('archive the room', () => {
flexTab.channelTab.click();
flexTab.archiveChannel();
flexTab.channelTab.click();
});
9 years ago
});
9 years ago
});