Improve tests wip

Test Travis CI
pull/7049/head
Martin Schoeler 9 years ago
parent 8deee3b2c7
commit 1d7e216502
  1. 2
      tests/end-to-end/ui/00-login.js
  2. 20
      tests/end-to-end/ui/01-register.js
  3. 104
      tests/end-to-end/ui/04-main-elements-render.js
  4. 24
      tests/end-to-end/ui/06-messaging.js
  5. 4
      tests/end-to-end/ui/09-channel.js
  6. 2
      tests/end-to-end/ui/12-settings.js
  7. 90
      tests/pageobjects/flex-tab.page.js
  8. 7
      tests/pageobjects/global.js
  9. 75
      tests/pageobjects/main-content.page.js
  10. 62
      tests/pageobjects/side-nav.page.js

@ -5,6 +5,8 @@ import loginPage from '../../pageobjects/login.page';
describe('login', () => {
before(()=>{
loginPage.open();
// This Can Cause Timeouts erros if the server is slow so it should have a big wait
loginPage.emailOrUsernameField.waitForVisible(15000);
});
describe('render', () => {

@ -6,42 +6,44 @@ describe('register', () => {
before(() => {
loginPage.open();
loginPage.gotToRegister();
// This Can Cause Timeouts erros if the server is slow so it should have a big wait
loginPage.nameField.waitForVisible(15000);
});
describe('render', () => {
it('should show name field', () => {
it('it should show name field', () => {
loginPage.nameField.isVisible().should.be.true;
});
it('should show email field', () => {
it('it should show email field', () => {
loginPage.emailField.isVisible().should.be.true;
});
it('should show password field', () => {
it('it should show password field', () => {
loginPage.passwordField.isVisible().should.be.true;
});
it('should show confirm password field', () => {
it('it should show confirm password field', () => {
loginPage.confirmPasswordField.isVisible().should.be.true;
});
it('should not show email / username field', () => {
it('it should not show email / username field', () => {
loginPage.emailOrUsernameField.isVisible().should.be.false;
});
it('should show submit button', () => {
it('it should show submit button', () => {
loginPage.submitButton.isVisible().should.be.true;
});
it('should not show register button', () => {
it('it should not show register button', () => {
loginPage.registerButton.isVisible().should.be.false;
});
it('should not show forgot password button', () => {
it('it should not show forgot password button', () => {
loginPage.forgotPasswordButton.isVisible().should.be.false;
});
it('should show back to login button', () => {
it('it should show back to login button', () => {
loginPage.backToLoginButton.isVisible().should.be.true;
});
});

@ -18,45 +18,41 @@ describe('Main Elements Render', function() {
describe('side nav bar', () => {
describe('render', () => {
it('should show the logged username', () => {
it('it should show the logged username', () => {
sideNav.accountBoxUserName.isVisible().should.be.true;
});
it('should show the logged user avatar', () => {
it('it should show the logged user avatar', () => {
sideNav.accountBoxUserAvatar.isVisible().should.be.true;
});
it('should show the new channel button', () => {
it('it should show the new channel button', () => {
sideNav.newChannelBtn.isVisible().should.be.true;
});
it('should show the plus icon', () => {
it('it should show the plus icon', () => {
sideNav.newChannelIcon.isVisible().should.be.true;
});
it('should show the "More Channels" button', () => {
it('it should show the "More Channels" button', () => {
sideNav.moreChannels.isVisible().should.be.true;
});
it('should show the new direct message button', () => {
sideNav.newDirectMessageBtn.isVisible().should.be.true;
});
it('should show "general" channel', () => {
it('it should show "general" channel', () => {
sideNav.general.isVisible().should.be.true;
});
it('should show spotlight search bar', () => {
it('it should show spotlight search bar', () => {
sideNav.spotlightSearch.isVisible().should.be.true;
});
});
describe('spotlight search render', () => {
it('should show spotlight search bar', () => {
it('it should show spotlight search bar', () => {
sideNav.spotlightSearch.isVisible().should.be.true;
});
it('should click the spotlight and show the channel list', () => {
it('it should click the spotlight and show the channel list', () => {
sideNav.spotlightSearch.waitForVisible(5000);
sideNav.spotlightSearch.click();
sideNav.spotlightSearchPopUp.waitForVisible(5000);
@ -71,7 +67,7 @@ describe('Main Elements Render', function() {
sideNav.spotlightSearchPopUp.isVisible().should.be.false;
});
it('should add text to the spotlight and show the channel list', () => {
it('it should add text to the spotlight and show the channel list', () => {
sideNav.spotlightSearch.waitForVisible(5000);
sideNav.spotlightSearch.setValue('rocket.cat');
sideNav.spotlightSearchPopUp.waitForVisible(5000);
@ -100,31 +96,31 @@ describe('Main Elements Render', function() {
sideNav.accountBoxUserName.click();
});
it('should show user options', () => {
it('it should show user options', () => {
sideNav.userOptions.isVisible().should.be.true;
});
it('should show online button', () => {
it('it should show online button', () => {
sideNav.statusOnline.isVisible().should.be.true;
});
it('should show away button', () => {
it('it should show away button', () => {
sideNav.statusAway.isVisible().should.be.true;
});
it('should show busy button', () => {
it('it should show busy button', () => {
sideNav.statusBusy.isVisible().should.be.true;
});
it('should show offline button', () => {
it('it should show offline button', () => {
sideNav.statusOffline.isVisible().should.be.true;
});
it('should show settings button', () => {
it('it should show settings button', () => {
sideNav.account.isVisible().should.be.true;
});
it('should show logout button', () => {
it('it should show logout button', () => {
sideNav.logout.isVisible().should.be.true;
});
});
@ -138,11 +134,11 @@ describe('Main Elements Render', function() {
sideNav.openChannel('general');
});
it('should show the title of the channel', () => {
it('it should show the title of the channel', () => {
mainContent.channelTitle.isVisible().should.be.true;
});
it('should show the empty favorite star', () => {
it('it should show the empty favorite star', () => {
mainContent.emptyFavoriteStar.isVisible().should.be.true;
});
@ -150,7 +146,7 @@ describe('Main Elements Render', function() {
mainContent.emptyFavoriteStar.click();
});
it('should not show the empty favorite star', () => {
it('it should not show the empty favorite star', () => {
mainContent.favoriteStar.isVisible().should.be.true;
});
@ -158,27 +154,27 @@ describe('Main Elements Render', function() {
mainContent.favoriteStar.click();
});
it('should show the message input bar', () => {
it('it should show the message input bar', () => {
mainContent.messageInput.isVisible().should.be.true;
});
it('should show the file attachment button', () => {
it('it should show the file attachment button', () => {
mainContent.fileAttachmentBtn.isVisible().should.be.true;
});
it('should show the audio recording button', () => {
it('it should show the audio recording button', () => {
mainContent.recordBtn.isVisible().should.be.true;
});
it('should show the video call button', () => {
it('it should show the video call button', () => {
mainContent.videoCamBtn.isVisible().should.be.true;
});
it('should not show the send button', () => {
it('it should not show the send button', () => {
mainContent.sendBtn.isVisible().should.be.false;
});
it('should show the emoji button', () => {
it('it should show the emoji button', () => {
mainContent.emojiBtn.isVisible().should.be.true;
});
@ -186,23 +182,23 @@ describe('Main Elements Render', function() {
mainContent.addTextToInput('Some Text');
});
it('should show the send button', () => {
it('it should show the send button', () => {
mainContent.sendBtn.isVisible().should.be.true;
});
it('should not show the file attachment button', () => {
it('it should not show the file attachment button', () => {
mainContent.fileAttachmentBtn.isVisible().should.be.false;
});
it('should not show the audio recording button', () => {
it('it should not show the audio recording button', () => {
mainContent.recordBtn.isVisible().should.be.false;
});
it('should not show the video call button', () => {
it('it should not show the video call button', () => {
mainContent.videoCamBtn.isVisible().should.be.false;
});
it('should show the last message', () => {
it('it should show the last message', () => {
mainContent.lastMessage.isVisible().should.be.true;
});
@ -210,7 +206,7 @@ describe('Main Elements Render', function() {
mainContent.lastMessageUser.getText().should.equal(username);
});
it('should not show the Admin tag', () => {
it('it should not show the Admin tag', () => {
mainContent.lastMessageUserTag.isVisible().should.be.false;
});
});
@ -231,16 +227,16 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('info', false);
});
it('should show the room info button', () => {
it('it should show the room info button', () => {
flexTab.channelTab.isVisible().should.be.true;
});
it('should show the room info tab content', () => {
it('it should show the room info tab content', () => {
flexTab.channelSettings.waitForVisible(5000);
flexTab.channelSettings.isVisible().should.be.true;
});
it('should show the room name', ()=> {
it('it should show the room name', ()=> {
flexTab.firstSetting.waitForVisible();
flexTab.firstSetting.getText().should.equal('general');
});
@ -256,11 +252,11 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('search', false);
});
it('should show the message search button', () => {
it('it should show the message search button', () => {
flexTab.searchTab.isVisible().should.be.true;
});
it('should show the message tab content', () => {
it('it should show the message tab content', () => {
flexTab.searchTabContent.isVisible().should.be.true;
});
});
@ -274,17 +270,17 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('members', false);
});
it('should show the members tab button', () => {
it('it should show the members tab button', () => {
flexTab.membersTab.waitForVisible(5000);
flexTab.membersTab.isVisible().should.be.true;
});
it('should show the members content', () => {
it('it should show the members content', () => {
flexTab.membersTabContent.waitForVisible(5000);
flexTab.membersTabContent.isVisible().should.be.true;
});
it('should show the show all link', () => {
it('it should show the show all link', () => {
flexTab.showAll.isVisible().should.be.true;
});
});
@ -298,11 +294,11 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('notifications', false);
});
it('should show the notifications button', () => {
it('it should show the notifications button', () => {
flexTab.notificationsTab.isVisible().should.be.true;
});
it('should show the notifications Tab content', () => {
it('it should show the notifications Tab content', () => {
flexTab.notificationsSettings.isVisible().should.be.true;
});
});
@ -316,11 +312,11 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('files', false);
});
it('should show the files button', () => {
it('it should show the files button', () => {
flexTab.filesTab.isVisible().should.be.true;
});
it('should show the files Tab content', () => {
it('it should show the files Tab content', () => {
flexTab.filesTabContent.isVisible().should.be.true;
});
});
@ -334,11 +330,11 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('mentions', false);
});
it('should show the mentions button', () => {
it('it should show the mentions button', () => {
flexTab.mentionsTab.isVisible().should.be.true;
});
it('should show the mentions Tab content', () => {
it('it should show the mentions Tab content', () => {
flexTab.mentionsTabContent.isVisible().should.be.true;
});
});
@ -352,11 +348,11 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('starred', false);
});
it('should show the starred messages button', () => {
it('it should show the starred messages button', () => {
flexTab.starredTab.isVisible().should.be.true;
});
it('should show the starred messages Tab content', () => {
it('it should show the starred messages Tab content', () => {
flexTab.starredTabContent.isVisible().should.be.true;
});
});
@ -370,11 +366,11 @@ describe('Main Elements Render', function() {
flexTab.operateFlexTab('pinned', false);
});
it('should show the pinned button', () => {
it('it should show the pinned button', () => {
flexTab.pinnedTab.isVisible().should.be.true;
});
it('should show the pinned messages Tab content', () => {
it('it should show the pinned messages Tab content', () => {
flexTab.pinnedTabContent.isVisible().should.be.true;
});
});

@ -47,44 +47,44 @@ function messagingTest() {
});
it('should show the confirm button', () => {
mainContent.popupFileConfirmBtn.isVisible().should.be.true;
Global.sweetAlertConfirm.isVisible().should.be.true;
});
it('should show the cancel button', () => {
mainContent.popupFileCancelBtn.isVisible().should.be.true;
Global.sweetAlertCancel.isVisible().should.be.true;
});
it('should show the file preview', () => {
mainContent.popupFilePreview.isVisible().should.be.true;
Global.sweetAlertFilePreview.isVisible().should.be.true;
});
it('should show the confirm button', () => {
mainContent.popupFileConfirmBtn.isVisible().should.be.true;
Global.sweetAlertConfirm.isVisible().should.be.true;
});
it('should show the file title', () => {
mainContent.popupFileTitle.isVisible().should.be.true;
Global.sweetAlertFileTitle.isVisible().should.be.true;
});
it('should show the file name input', () => {
mainContent.popupFileName.isVisible().should.be.true;
Global.sweetAlertFileName.isVisible().should.be.true;
});
it('should fill the file name input', () => {
mainContent.popupFileName.setValue('File Name');
Global.sweetAlertFileName.setValue('File Name');
});
it('should show the file name input', () => {
mainContent.popupFileDescription.isVisible().should.be.true;
Global.sweetAlertFileDescription.isVisible().should.be.true;
});
it('should fill the file name input', () => {
mainContent.popupFileDescription.setValue('File Description');
Global.sweetAlertFileDescription.setValue('File Description');
});
it('click the confirm', () => {
mainContent.popupFileConfirmBtn.click();
mainContent.popupFileConfirmBtn.waitForVisible(5000, true);
Global.sweetAlertConfirm.click();
Global.sweetAlertConfirm.waitForVisible(5000, true);
});
it('should show the file in the message', () => {
@ -198,7 +198,7 @@ function messageActionsTest() {
it('delete the message', () => {
mainContent.selectAction('delete');
mainContent.popupFileConfirmBtn.click();
Global.sweetAlertConfirm.click();
Global.sweetAlertOverlay.waitForVisible(3000, true);
});

@ -398,8 +398,8 @@ describe('channel', ()=> {
});
it('should not show the channel on the list', () => {
sideNav.getChannelFromList(`NAME-EDITED-${ publicChannelName }`).waitForVisible(5000, true);
sideNav.getChannelFromList(`NAME-EDITED-${ publicChannelName }`).isVisible().should.be.false;
sideNav.getChannelFromList(`NAME-EDITED-${ publicChannelName }`, true).waitForVisible(5000, true);
sideNav.getChannelFromList(`NAME-EDITED-${ publicChannelName }`, true).isVisible().should.be.false;
});
it('should search and enter the channel with the spotlight', () => {

@ -229,7 +229,7 @@ describe('Changing settings via api', () => {
it('should send a bad word', () => {
mainContent.setTextToInput('badword');
mainContent.sendBtn.click();
mainContent.lastMessage.getText().should.equal('*******');
mainContent.waitForLastMessageEqualsText('*******');
});
it('should change the bad words filter via api', (done) => {

@ -2,6 +2,27 @@ import Page from './Page';
import Global from './global';
class FlexTab extends Page {
// Channel Info Tab
get channelTab() { return browser.element('.flex-tab-bar .tab-button:not(.hidden) .icon-info-circled'); }
get channelSettings() { return browser.element('.channel-settings'); }
get archiveBtn() { return browser.element('.clearfix:last-child .icon-pencil'); }
get archiveRadio() { return browser.element('.editing'); }
get archiveSave() { return browser.element('.save'); }
get editNameBtn() { return browser.element('[data-edit="name"]'); }
get editTopicBtn() { return browser.element('[data-edit="topic"]'); }
get editAnnouncementBtn() { return browser.element('[data-edit="announcement"]'); }
get editDescriptionBtn() { return browser.element('[data-edit="description"]'); }
get editNotificationBtn() { return browser.element('[data-edit="desktopNotifications"]'); }
get editMobilePushBtn() { return browser.element('[data-edit="mobilePushNotifications"]'); }
get editEmailNotificationBtn() { return browser.element('[data-edit="emailNotifications"]'); }
get editUnreadAlertBtn() { return browser.element('[data-edit="unreadAlert"]'); }
get editNameTextInput() { return browser.element('.channel-settings input[name="name"]'); }
get editTopicTextInput() { return browser.element('.channel-settings input[name="topic"]'); }
get editAnnouncementTextInput() { return browser.element('.channel-settings input[name="announcement"]'); }
get editDescriptionTextInput() { return browser.element('.channel-settings input[name="description"]'); }
get editNameSave() { return browser.element('.channel-settings .save'); }
// Members Tab
get membersTab() { return browser.element('.flex-tab-bar .icon-users'); }
get membersTabContent() { return browser.element('.animated'); }
get userSearchBar() { return browser.element('#user-add-search'); }
@ -15,18 +36,21 @@ class FlexTab extends Page {
get showAll() { return browser.element('.see-all'); }
get membersUserInfo() { return browser.element('.flex-tab-container .info'); }
get avatarImage() { return browser.element('.flex-tab-container .avatar-image'); }
get memberUserName() { return browser.element('.info h3'); }
get memberRealName() { return browser.element('.info p'); }
get channelTab() { return browser.element('.flex-tab-bar .tab-button:not(.hidden) .icon-info-circled'); }
get channelSettings() { return browser.element('.channel-settings'); }
// Search Tab
get searchTab() { return browser.element('.flex-tab-bar .icon-search'); }
get searchTabContent() { return browser.element('.search-messages-list'); }
get messageSearchBar() { return browser.element('#message-search'); }
get searchResult() { return browser.element('.new-day'); }
// Notifications Tab
get notificationsTab() { return browser.element('.flex-tab-bar .icon-bell-alt'); }
get notificationsSettings() { return browser.element('.push-notifications'); }
// Files Tab
get filesTab() { return browser.element('.flex-tab-bar .icon-attach'); }
get fileItem() { return browser.element('.uploaded-files-list ul:first-child'); }
get filesTabContent() { return browser.element('.uploaded-files-list'); }
@ -34,40 +58,22 @@ class FlexTab extends Page {
get fileDownload() { return browser.element('.uploaded-files-list ul:first-child .file-download'); }
get fileName() { return browser.element('.uploaded-files-list ul:first-child .room-file-item'); }
// Mentions Tab
get mentionsTab() { return browser.element('.flex-tab-bar .icon-at'); }
get mentionsTabContent() { return browser.element('.mentioned-messages-list'); }
// Starred Tab
get starredTab() { return browser.element('.flex-tab-bar .icon-star'); }
get starredTabContent() { return browser.element('.starred-messages-list'); }
// Pinned Tab
get pinnedTab() { return browser.element('.flex-tab-bar .icon-pin'); }
get pinnedTabContent() { return browser.element('.pinned-messages-list'); }
get archiveBtn() { return browser.element('.clearfix:last-child .icon-pencil'); }
get archiveRadio() { return browser.element('.editing'); }
get archiveSave() { return browser.element('.save'); }
get editNameBtn() { return browser.element('[data-edit="name"]'); }
get editTopicBtn() { return browser.element('[data-edit="topic"]'); }
get editAnnouncementBtn() { return browser.element('[data-edit="announcement"]'); }
get editDescriptionBtn() { return browser.element('[data-edit="description"]'); }
get editNotificationBtn() { return browser.element('[data-edit="desktopNotifications"]'); }
get editMobilePushBtn() { return browser.element('[data-edit="mobilePushNotifications"]'); }
get editEmailNotificationBtn() { return browser.element('[data-edit="emailNotifications"]'); }
get editUnreadAlertBtn() { return browser.element('[data-edit="unreadAlert"]'); }
get editNameTextInput() { return browser.element('.channel-settings input[name="name"]'); }
get editTopicTextInput() { return browser.element('.channel-settings input[name="topic"]'); }
get editAnnouncementTextInput() { return browser.element('.channel-settings input[name="announcement"]'); }
get editDescriptionTextInput() { return browser.element('.channel-settings input[name="description"]'); }
get firstSetting() { return browser.element('.clearfix li:nth-child(1) .current-setting'); }
get secondSetting() { return browser.element('.clearfix li:nth-child(2) .current-setting'); }
get thirdSetting() { return browser.element('.clearfix li:nth-child(3) .current-setting'); }
get fourthSetting() { return browser.element('.clearfix li:nth-child(4) .current-setting'); }
get editNameSave() { return browser.element('.channel-settings .save'); }
get memberUserName() { return browser.element('.info h3'); }
get memberRealName() { return browser.element('.info p'); }
get confirmBtn() { return browser.element('.confirm'); }
//admin view flextab items
get usersSendInvitationTab() { return browser.element('.flex-tab-bar .icon-paper-plane'); }
@ -110,6 +116,12 @@ class FlexTab extends Page {
browser.click('.-autocomplete-item');
}
removePeopleFromChannel(user) {
this.enterUserView(user);
this.removeUserBtn.waitForVisible(5000);
this.removeUserBtn.click();
}
operateFlexTab(desiredTab, desiredState) {
//desiredState true=open false=closed
switch (desiredTab) {
@ -178,19 +190,9 @@ class FlexTab extends Page {
}
}
removePeopleFromChannel(user) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
this.removeUserBtn.click();
}
setUserOwner(user) {
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
}
this.enterUserView(user);
this.setOwnerBtn.waitForVisible(5000);
this.setOwnerBtn.click();
this.viewAllBtn.click();
@ -198,11 +200,7 @@ class FlexTab extends Page {
}
setUserModerator(user) {
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
}
this.enterUserView(user);
this.setModeratorBtn.waitForVisible();
this.setModeratorBtn.click();
this.viewAllBtn.click();
@ -210,17 +208,21 @@ class FlexTab extends Page {
}
muteUser(user) {
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
}
this.enterUserView(user);
this.muteUserBtn.waitForVisible(5000);
this.muteUserBtn.click();
Global.confirmPopup();
this.viewAllBtn.click();
browser.pause(100);
}
enterUserView(user) {
if (!this.membersUserInfo.isVisible()) {
const userEl = this.getUserEl(user);
userEl.waitForVisible();
userEl.click();
}
}
}
module.exports = new FlexTab();

@ -1,8 +1,15 @@
class Global {
// Sweet Alerts
get sweetAlertOverlay() { return browser.element('.sweet-overlay'); }
get sweetAlert() { return browser.element('.sweet-alert'); }
get sweetAlertConfirm() { return browser.element('.sweet-alert .sa-confirm-button-container'); }
get sweetAlertCancel() { return browser.element('.sa-button-container .cancel'); }
get sweetAlertPasswordField() { return browser.element('.sweet-alert [type="password"]'); }
get sweetAlertFileName() { return browser.element('#file-name'); }
get sweetAlertFileDescription() { return browser.element('#file-description'); }
get sweetAlertFilePreview() { return browser.element('.upload-preview-file'); }
get sweetAlertFileTitle() { return browser.element('.upload-preview-title'); }
get toastAlert() { return browser.element('.toast'); }
confirmPopup() {

@ -3,22 +3,28 @@ import Page from './Page';
class MainContent extends Page {
get mainContent() { return browser.element('.main-content'); }
get messageInput() { return browser.element('.input-message'); }
get sendBtn() { return browser.element('.message-buttons.send-button'); }
// Main Content Header (Channel Title Area)
get emptyFavoriteStar() { return browser.element('.toggle-favorite .icon-star-empty'); }
get favoriteStar() { return browser.element('.toggle-favorite .favorite-room'); }
get channelTitle() { return browser.element('.room-title'); }
//Main Content Footer (Message Input Area)
get messageInput() { return browser.element('.input-message'); }
get sendBtn() { return browser.element('.message-buttons.send-button'); }
get fileAttachmentBtn() { return browser.element('.message-buttons .icon-attach'); }
get fileAttachment() { return browser.element('.message-buttons input[type="file"]'); }
get recordBtn() { return browser.element('.message-buttons .icon-mic'); }
get videoCamBtn() { return browser.element('.message-buttons .icon-videocam'); }
get emojiBtn() { return browser.element('.inner-left-toolbar .emoji-picker-icon'); }
get channelTitle() { return browser.element('.room-title'); }
get popupFileConfirmBtn() { return browser.element('.sa-confirm-button-container .confirm'); }
get popupFileName() { return browser.element('#file-name'); }
get popupFileDescription() { return browser.element('#file-description'); }
get popupFilePreview() { return browser.element('.upload-preview-file'); }
get popupFileTitle() { return browser.element('.upload-preview-title'); }
get popupFileCancelBtn() { return browser.element('.sa-button-container .cancel'); }
get messagePopUp() { return browser.element('.message-popup'); }
get messagePopUpTitle() { return browser.element('.message-popup-title'); }
get messagePopUpItems() { return browser.element('.message-popup-items'); }
get messagePopUpFirstItem() { return browser.element('.popup-item.selected'); }
get mentionAllPopUp() { return browser.element('.popup-item[data-id="all"]'); }
get joinChannelBtn() { return browser.element('.button.join'); }
// Messages
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 lastMessageDesc() { return browser.element('.message:last-child .body .attachment-description'); }
@ -40,6 +46,8 @@ class MainContent extends Page {
get messageReaction() { return browser.element('.message:last-child .message-dropdown .reaction-message'); }
get messagePin() { return browser.element('.message:last-child .message-dropdown .pin-message'); }
get messageClose() { return browser.element('.message:last-child .message-dropdown .message-dropdown-close'); }
// Emojis
get emojiPickerMainScreen() { return browser.element('.emoji-picker'); }
get emojiPickerPeopleIcon() { return browser.element('.emoji-picker .icon-people'); }
get emojiPickerNatureIcon() { return browser.element('.emoji-picker .icon-nature'); }
@ -57,13 +65,8 @@ class MainContent extends Page {
get emojiPickerEmojiContainer() { return browser.element('.emoji-picker .emojis'); }
get emojiGrinning() { return browser.element('.emoji-picker .emoji-grinning'); }
get emojiSmile() { return browser.element('.emoji-picker .emoji-smile'); }
get messagePopUp() { return browser.element('.message-popup'); }
get messagePopUpTitle() { return browser.element('.message-popup-title'); }
get messagePopUpItems() { return browser.element('.message-popup-items'); }
get messagePopUpFirstItem() { return browser.element('.popup-item.selected'); }
get mentionAllPopUp() { return browser.element('.popup-item[data-id="all"]'); }
get joinChannelBtn() { return browser.element('.button.join'); }
// Sends a message and wait for the message to equal the text sent
sendMessage(text) {
this.setTextToInput(text);
this.sendBtn.click();
@ -73,11 +76,13 @@ class MainContent extends Page {
}, 2000);
}
// adds text to the input
addTextToInput(text) {
this.messageInput.waitForVisible(5000);
this.messageInput.addValue(text);
}
// Clear and sets the text to the input
setTextToInput(text) {
this.messageInput.waitForVisible(5000);
this.messageInput.setValue(text);
@ -89,17 +94,11 @@ class MainContent extends Page {
this.fileAttachment.chooseFile(filePath);
}
openMessageActionMenu() {
this.lastMessage.moveToObject();
this.messageOptionsBtn.waitForVisible(5000);
this.messageOptionsBtn.click();
this.messageActionMenu.waitForVisible(5000);
}
setLanguageToEnglish() {
this.settingLanguageSelect.click();
this.settingLanguageEnglish.click();
this.settingSaveBtn.click();
waitForLastMessageEqualsText(text) {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .body', 5000);
return browser.getText('.message:last-child .body') === text;
}, 4000);
}
waitForLastMessageTextAttachmentEqualsText(text) {
@ -109,13 +108,7 @@ class MainContent extends Page {
}, 2000);
}
waitForLastMessageEqualsText(text) {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .body', 5000);
return browser.getText('.message:last-child .body') === text;
}, 4000);
}
// Wait for the last message author username to equal the provided text
waitForLastMessageUserEqualsText(text) {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .user-card-message:nth-of-type(2)', 5000);
@ -123,14 +116,26 @@ class MainContent extends Page {
}, 2000);
}
openMessageActionMenu() {
this.lastMessage.moveToObject();
this.messageOptionsBtn.waitForVisible(5000);
this.messageOptionsBtn.click();
this.messageActionMenu.waitForVisible(5000);
}
setLanguageToEnglish() {
this.settingLanguageSelect.click();
this.settingLanguageEnglish.click();
this.settingSaveBtn.click();
}
tryToMentionAll() {
this.addTextToInput('@all');
this.sendBtn.click();
this.waitForLastMessageEqualsText('Notify all in this room is not allowed');
this.lastMessage.getText().should.equal('Notify all in this room is not allowed');
}
//do one of the message actions, based on the "action" parameter inserted.
// Do one of the message actions, based on the "action" parameter inserted.
selectAction(action) {
switch (action) {
case 'edit':

@ -1,26 +1,15 @@
import Page from './Page';
class SideNav extends Page {
// New channel
get channelType() { return browser.element('label[for="channel-type"]'); }
get channelReadOnly() { return browser.element('label[for="channel-ro"]'); }
get channelName() { return browser.element('input#channel-name'); }
get saveChannelBtn() { return browser.element('.save-channel'); }
get messageInput() { return browser.element('.input-message'); }
get burgerBtn() { return browser.element('.burger'); }
// Account box
get accountBoxUserName() { return browser.element('.account-box .data h4'); }
get accountBoxUserAvatar() { return browser.element('.account-box .avatar-image'); }
get newChannelBtn() { return browser.element('.toolbar-search__create-channel'); }
get newChannelIcon() { return browser.element('.toolbar-search__create-channel.icon-plus'); }
get moreChannels() { return browser.element('.rooms-list .more-channels'); }
get newDirectMessageBtn() { return browser.element('.rooms-list .room-type:nth-of-type(2)'); }
get general() { return browser.element('.rooms-list .room-type:not(.unread-rooms-mode) + ul .open-room[title="general"]'); }
get channelHoverIcon() { return browser.element('.rooms-list > .wrapper > ul [title="general"] .icon-eye-off'); }
get userOptions() { return browser.element('.options'); }
get statusOnline() { return browser.element('.online'); }
get statusAway() { return browser.element('.away'); }
@ -31,23 +20,38 @@ class SideNav extends Page {
get logout() { return browser.element('#logout'); }
get sideNavBar() { return browser.element('.side-nav '); }
// Toolbar
get spotlightSearch() { return browser.element('.toolbar-search__input'); }
get spotlightSearchPopUp() { return browser.element('.toolbar .message-popup'); }
get newChannelBtn() { return browser.element('.toolbar-search__create-channel'); }
get newChannelIcon() { return browser.element('.toolbar-search__create-channel.icon-plus'); }
// Rooms List
get general() { return browser.element('.rooms-list .room-type:not(.unread-rooms-mode) + ul .open-room[title="general"]'); }
get channelLeave() { return browser.element('.leave-room'); }
get channelHoverIcon() { return browser.element('.rooms-list > .wrapper > ul [title="general"] .icon-eye-off'); }
get moreChannels() { return browser.element('.rooms-list .more-channels'); }
// Account
get preferences() { return browser.element('[href="/account/preferences"]'); }
get profile() { return browser.element('[href="/account/profile"]'); }
get avatar() { return browser.element('[href="/changeavatar"]'); }
get preferencesClose() { return browser.element('.side-nav .arrow.close'); }
get spotlightSearch() { return browser.element('.toolbar-search__input'); }
get spotlightSearchPopUp() { return browser.element('.toolbar .message-popup'); }
get channelLeave() { return browser.element('.leave-room'); }
get burgerBtn() { return browser.element('.burger'); }
// Opens a channel via rooms list
openChannel(channelName) {
browser.waitForVisible(`.rooms-list > .wrapper > ul [title="${ channelName }"]`, 5000);
browser.click(`.rooms-list > .wrapper > ul [title="${ channelName }"]`);
this.messageInput.waitForExist(5000);
browser.waitForVisible('.input-message', 5000);
browser.waitUntil(function() {
browser.waitForVisible('.room-title', 5000);
return browser.getText('.room-title') === channelName;
}, 5000);
}
// Opens a channel via spotlight search
searchChannel(channelName) {
this.spotlightSearch.waitForVisible(5000);
this.spotlightSearch.click();
@ -60,6 +64,7 @@ class SideNav extends Page {
}, 5000);
}
// Gets a channel from the spotlight search
getChannelFromSpotlight(channelName) {
this.spotlightSearch.waitForVisible(5000);
this.spotlightSearch.click();
@ -68,7 +73,11 @@ class SideNav extends Page {
return browser.element(`.room-title=${ channelName }`);
}
getChannelFromList(channelName) {
// Gets a channel from the rooms list
getChannelFromList(channelName, reverse) {
if (reverse == null) {
browser.waitForVisible(`.rooms-list .room-type:not(.unread-rooms-mode) + ul .open-room[title="${ channelName }"]`, 5000);
}
return browser.element(`.rooms-list .room-type:not(.unread-rooms-mode) + ul .open-room[title="${ channelName }"]`);
}
@ -76,10 +85,12 @@ class SideNav extends Page {
this.newChannelBtn.waitForVisible(10000);
this.newChannelBtn.click();
this.channelName.waitForVisible(10000);
//workaround for incomplete setvalue bug
this.channelName.setValue(channelName);
this.channelName.setValue(channelName);
browser.pause(1000);
this.channelType.waitForVisible(10000);
if (isPrivate) {
this.channelType.click();
@ -93,21 +104,6 @@ class SideNav extends Page {
browser.waitForExist(`[title="${ channelName }"]`, 10000);
this.channelType.waitForVisible(5000, true);
}
addPeopleToChannel(user) {
this.membersTab.click();
this.userSearchBar.waitForVisible();
this.userSearchBar.setValue(user);
browser.waitForVisible('.-autocomplete-item');
browser.click('.-autocomplete-item');
}
removePeopleFromChannel(user) {
this.membersTab.click();
browser.waitForVisible(`[title="${ user }"]`);
browser.click(`[title="${ user }"]`);
this.removeUserBtn.click();
}
}
module.exports = new SideNav();

Loading…
Cancel
Save