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/basic-usage.js

366 lines
10 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
//Login info from the test user
9 years ago
const username = 'user-test-'+Date.now();
const email = username+'@rocket.chat';
const password = 'rocket.chat';
//Names of the test channels
const PublicChannelName = 'channel-test-'+Date.now();
const privateChannelName = 'private-channel-test-'+Date.now();
9 years ago
//User interactions(direct messages, add, remove...)
const targetUser = 'rocket.cat';
//Test data
const message = 'message from '+username;
//Basic usage test start
9 years ago
describe('Basic usage', function() {
it('load page', () => {
loginPage.open();
// browser.windowHandleSize({width:1280, height:800});
});
it('crate user', function() {
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', function() {
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', function() {
9 years ago
loginPage.login({email, password});
browser.waitForExist('.main-content', 5000);
});
describe('side nav bar', function() {
describe('render', function() {
it('should show the logged username', () => {
sideNav.accountBoxUserName.isVisible().should.be.true;
});
it('should show the logged user avatar', function() {
sideNav.accountBoxUserAvatar.isVisible().should.be.true;
});
it('should show the new channel button', function() {
sideNav.newChannelBtn.isVisible().should.be.true;
});
it('should show the plus icon', function() {
sideNav.newChannelIcon.isVisible().should.be.true;
});
it('should show the "More Channels" button', function() {
sideNav.moreChannels.isVisible().should.be.true;
});
it('should show the new direct message button', function() {
sideNav.newDirectMessageBtn.isVisible().should.be.true;
});
it('should show the plus icon', function() {
sideNav.newDirectMessageIcon.isVisible().should.be.true;
});
it('should show the "More Direct Messages" buton', function() {
sideNav.moreDirectMessages.isVisible().should.be.true;
});
it('should show "general" channel', function() {
sideNav.general.isVisible().should.be.true;
});
it('should not show eye icon on general', function() {
sideNav.channelHoverIcon.isVisible().should.be.false;
});
it('should show eye icon on hover', function() {
sideNav.general.moveToObject();
sideNav.channelHoverIcon.isVisible().should.be.true;
});
});
describe('user options', function() {
describe('render', function() {
it('should show user options', function() {
sideNav.accountBoxUserName.click();
sideNav.userOptions.waitForVisible();
sideNav.userOptions.isVisible().should.be.true;
});
it('should show online button', function() {
sideNav.statusOnline.isVisible().should.be.true;
});
it('should show away button', function() {
sideNav.statusAway.isVisible().should.be.true;
});
it('should show busy button', function() {
sideNav.statusBusy.isVisible().should.be.true;
});
it('should show offline button', function() {
sideNav.statusOffline.isVisible().should.be.true;
});
it('should show settings button', function() {
sideNav.account.isVisible().should.be.true;
});
it('should show logout button', function() {
sideNav.logout.isVisible().should.be.true;
});
});
});
9 years ago
});
it('open GENERAL', function() {
9 years ago
browser.waitForExist('.wrapper > ul .link-room-GENERAL', 50000);
browser.click('.wrapper > ul .link-room-GENERAL');
browser.waitForExist('.input-message', 5000);
});
9 years ago
describe('flextab usage', function() {
describe('render', function() {
it('should show the room info button', function() {
flexTab.channelTab.isVisible().should.be.true;
});
it('should show the room info tab content', function() {
flexTab.channelTab.click();
flexTab.channelSettings.isVisible().should.be.true;
});
it('should show the message search button', function() {
flexTab.searchTab.isVisible().should.be.true;
});
it('should show the message tab content', function() {
flexTab.searchTab.click();
flexTab.searchTabContent.isVisible().should.be.true;
});
it('should show the members tab button', function() {
flexTab.membersTab.isVisible().should.be.true;
});
it('should show the members content', function() {
flexTab.membersTab.click();
flexTab.membersTabContent.isVisible().should.be.true;
});
it('should show the members search bar', function() {
flexTab.userSearchBar.isVisible().should.be.true;
});
it('should show the show all link', function() {
flexTab.showAll.isVisible().should.be.true;
});
it('should show the start video call button', function() {
flexTab.startVideoCall.isVisible().should.be.true;
});
it('should show the start audio call', function() {
flexTab.startAudioCall.isVisible().should.be.true;
});
it('should show the notifications button', function() {
flexTab.notificationsTab.isVisible().should.be.true;
});
it('should show the notifications Tab content', function() {
flexTab.notificationsTab.click();
flexTab.notificationsSettings.isVisible().should.be.true;
});
it('should show the files button', function() {
flexTab.filesTab.isVisible().should.be.true;
});
it('should show the files Tab content', function() {
flexTab.filesTab.click();
flexTab.filesTabContent.isVisible().should.be.true;
});
it('should show the mentions button', function() {
flexTab.mentionsTab.isVisible().should.be.true;
});
it('should show the mentions Tab content', function() {
flexTab.mentionsTab.click();
flexTab.mentionsTabContent.isVisible().should.be.true;
});
it('should show the starred button', function() {
flexTab.starredTab.isVisible().should.be.true;
});
it('should show the starred Tab content', function() {
flexTab.starredTab.click();
flexTab.starredTabContent.isVisible().should.be.true;
});
it('should show the pinned button', function() {
flexTab.pinnedTab.isVisible().should.be.true;
});
it('should show the pinned messages Tab content', function() {
flexTab.pinnedTab.click();
flexTab.pinnedTabContent.isVisible().should.be.true;
});
});
});
9 years ago
it('send a message', function() {
mainContent.sendMessage(message);
9 years ago
});
//DIRECT MESAGE
it('start a direct message with rocket.cat', function() {
sideNav.startDirectMessage(targetUser);
9 years ago
});
it('open the direct message', function() {
sideNav.openChannel(targetUser);
9 years ago
});
it('send a direct message', function() {
mainContent.sendMessage(message);
9 years ago
});
//CHANNEL
it('create a public channel', function() {
sideNav.createChannel(PublicChannelName, false, false);
sideNav.openChannel(PublicChannelName);
9 years ago
});
it('send a message in the public channel', function() {
mainContent.sendMessage(message);
9 years ago
});
9 years ago
it('add people to the room', function() {
flexTab.addPeopleToChannel(targetUser);
9 years ago
});
it('remove people from room', function() {
flexTab.closeTabs();
flexTab.removePeopleFromChannel(targetUser);
flexTab.confirmPopup();
9 years ago
});
it('archive the room', function() {
flexTab.archiveChannel();
flexTab.closeTabs();
9 years ago
});
it('open GENERAL', function() {
sideNav.openChannel('general');
9 years ago
});
9 years ago
//Private Channel
9 years ago
it('create a private channel', function() {
sideNav.createChannel(privateChannelName, true, false);
9 years ago
});
it('send a message in the private channel', function() {
mainContent.sendMessage(message);
9 years ago
});
it('add people to the room', function() {
flexTab.addPeopleToChannel(targetUser);
});
9 years ago
it('remove people from room', function() {
flexTab.closeTabs();
flexTab.removePeopleFromChannel(targetUser);
flexTab.confirmPopup();
9 years ago
});
9 years ago
it('archive the room', function() {
flexTab.archiveChannel();
flexTab.closeTabs();
9 years ago
});
});
9 years ago
/* get membersTab() { return browser.element('[title=Members]'); }
get userSearchBar() { return browser.element('.animated'); }
get userSearchBar() { return browser.element('#user-add-search'); }
get removeUserBtn() { return browser.element('.remove-user'); }
get startVideoCall() { return browser.element('start-video-call'); }
get startAudioCall() { return browser.element('start-audio-call'); }
get showAll() { return browser.element('.see-all'); }
9 years ago
get channelTab() { return browser.element('[title="Room Info"]'); }
get channelSettings() { return browser.element('.channel-settings'); }
9 years ago
get searchTab() { return browser.element('[title="Search"]'); }
get searchTabContent() { return browser.element('.search-messages-list'); }
get messageSearchBar() { return browser.element('#message-search'); }
get searchResult() { return browser.element('.new-day'); }
9 years ago
get notificationsTab() { return browser.element('[title="Notifications"]'); }
get notificationsSettings() { return browser.element('.push-notifications'); }
9 years ago
get filesTab() { return browser.element('[title="Files List"]'); }
get fileItem() { return browser.element('.uploaded-files ul:first-child'); }
get filesTabContent() { return browser.element('.uploaded-files'); }
get fileDelete() { return browser.element('.uploaded-files ul:first-child .file-delete'); }
get fileDownload() { return browser.element('.uploaded-files ul:first-child .file-download'); }
get fileName() { return browser.element('.uploaded-files ul:first-child .room-file-item'); }
9 years ago
get mentionsTab() { return browser.element('[title="Mentions"]'); }
get mentionsTabContent() { return browser.element('.mentioned-messages-list'); }
9 years ago
get starredTab() { return browser.element('[title="Starred Messages"]'); }
get starredTabContent() { return browser.element('.starred-messages-list'); }
9 years ago
get pinnedTab() { return browser.element('[title="Pinned Messages"]'); }
get pinnedTabContent() { return browser.element('pinned-messages-list'); }
9 years ago
get archiveBtn() { return browser.element('.clearfix:last-child .icon-pencil'); }
get archiveRadio() { return browser.element('.editing'); }
get archiveSave() { return browser.element('.save'); }
get confirmBtn() { return browser.element('.confirm'); }
*/