diff --git a/packages/rocketchat-channel-settings/client/views/channelSettings.html b/packages/rocketchat-channel-settings/client/views/channelSettings.html index c1d0c15fd792..8cf5bfb3a3fb 100644 --- a/packages/rocketchat-channel-settings/client/views/channelSettings.html +++ b/packages/rocketchat-channel-settings/client/views/channelSettings.html @@ -18,7 +18,7 @@

{{_ "Room_Info"}}

{{#if editing $key}} {{else}} - {{value}} + {{value}} {{/if}} {{/if}} @@ -26,7 +26,7 @@

{{_ "Room_Info"}}

{{#if editing $key}} {{else}} - {{{RocketChatMarkdown value}}} + {{{RocketChatMarkdown value}}} {{/if}} {{/if}} @@ -39,7 +39,7 @@

{{_ "Room_Info"}}

{{/each}} {{else}} - {{_ (valueOf $value.options value)}} + {{_ (valueOf $value.options value)}} {{/if}} {{/if}} @@ -55,9 +55,9 @@

{{_ "Room_Info"}}

{{else}} {{#if value}} - {{_ 'True'}} + {{_ 'True'}} {{else}} - {{_ 'False'}} + {{_ 'False'}} {{/if}} {{/if}} {{/if}} diff --git a/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.html b/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.html index ba6bf8ef28be..e22986fb7046 100644 --- a/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.html +++ b/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.html @@ -23,7 +23,7 @@

{{_ "Notifications"}}

{{else}} - {{subValue 'desktopNotifications'}} + {{subValue 'desktopNotifications'}} {{/if}} @@ -31,7 +31,7 @@

{{_ "Notifications"}}

  • - {{#if desktopNotificationDuration}}{{desktopNotificationDuration}} {{_"seconds"}}{{else}}{{_ "Use_User_Preferences_or_Global_Settings"}}{{/if}} + {{#if desktopNotificationDuration}}{{desktopNotificationDuration}} {{_"seconds"}}{{else}}{{_ "Use_User_Preferences_or_Global_Settings"}}{{/if}}
  • {{/unless}} @@ -45,7 +45,7 @@

    {{_ "Notifications"}}

    {{else}} - {{subValue 'mobilePushNotifications'}} + {{subValue 'mobilePushNotifications'}} {{/if}} @@ -62,7 +62,7 @@

    {{_ "Notifications"}}

    {{else}} - {{subValue 'emailNotifications'}} + {{subValue 'emailNotifications'}} {{/if}} @@ -83,7 +83,7 @@

    {{_ "Notifications"}}

    {{else}} - {{unreadAlertText}} + {{unreadAlertText}} {{/if}} diff --git a/tests/pageobjects/flex-tab.page.js b/tests/pageobjects/flex-tab.page.js index 90f952dabcb9..4cb9482e149f 100644 --- a/tests/pageobjects/flex-tab.page.js +++ b/tests/pageobjects/flex-tab.page.js @@ -5,6 +5,10 @@ class FlexTab extends Page { get membersTabContent() { return browser.element('.animated'); } get userSearchBar() { return browser.element('#user-add-search'); } get removeUserBtn() { return browser.element('.remove-user'); } + get setOwnerBtn() { return browser.element('.set-owner'); } + get setModeratorBtn() { return browser.element('.set-moderator'); } + get muteUserBtn() { return browser.element('.mute-user'); } + get viewAllBtn() { return browser.element('.button.secondary.back'); } get startVideoCall() { return browser.element('.start-video-call'); } get startAudioCall() { return browser.element('.start-audio-call'); } get showAll() { return browser.element('.see-all'); } @@ -39,6 +43,22 @@ class FlexTab extends Page { 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 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 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 editNameTextInput() { return browser.element('.channel-settings input[name="name"]'); } + get editNameSave() { return browser.element('.channel-settings .save'); } get confirmBtn() { return browser.element('.confirm'); } @@ -60,7 +80,7 @@ class FlexTab extends Page { addPeopleToChannel(user) { this.userSearchBar.waitForVisible(); this.userSearchBar.setValue(user); - browser.waitForVisible('.-autocomplete-item', 2000); + browser.waitForVisible('.-autocomplete-item', 5000); browser.click('.-autocomplete-item'); } @@ -71,6 +91,33 @@ class FlexTab extends Page { browser.pause(300); this.removeUserBtn.click(); } + + setUserOwner(user) { + const userEl = browser.element('.flex-tab button[title="'+user+'"]'); + userEl.waitForVisible(); + userEl.click(); + browser.pause(300); + this.setOwnerBtn.waitForVisible(5000); + this.setOwnerBtn.click(); + this.viewAllBtn.click(); + } + + setUserModerator(user) { + const userEl = browser.element('.flex-tab button[title="'+user+'"]'); + userEl.waitForVisible(); + userEl.click(); + browser.pause(300); + this.setModeratorBtn.click(); + this.viewAllBtn.click(); + } + + muteUser(user) { + const userEl = browser.element('.flex-tab button[title="'+user+'"]'); + userEl.waitForVisible(); + userEl.click(); + browser.pause(300); + this.muteUserBtn.click(); + } } module.exports = new FlexTab(); diff --git a/tests/pageobjects/main-content.page.js b/tests/pageobjects/main-content.page.js index e0f49fb3a627..eae3ff4ead15 100644 --- a/tests/pageobjects/main-content.page.js +++ b/tests/pageobjects/main-content.page.js @@ -2,6 +2,7 @@ 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'); } get emptyFavoriteStar() { return browser.element('.toggle-favorite .icon-star-empty'); } @@ -16,11 +17,49 @@ class MainContent extends Page { 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 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'); } + get messageEdit() { return browser.element('.message:last-child .message-dropdown .edit-message'); } + get messageDelete() { return browser.element('.message:last-child .message-dropdown .delete-message'); } + get messagePermalink() { return browser.element('.message:last-child .message-dropdown .permalink'); } + get messageCopy() { return browser.element('.message:last-child .message-dropdown .copy'); } + get messageQuote() { return browser.element('.message:last-child .message-dropdown .quote-message'); } + get messageStar() { return browser.element('.message:last-child .message-dropdown .star-message'); } + get messageUnread() { return browser.element('.message:last-child .message-dropdown .mark-message-as-unread'); } + 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'); } + 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'); } + get emojiPickerFoodIcon() { return browser.element('.emoji-picker .icon-food'); } + get emojiPickerActivityIcon() { return browser.element('.emoji-picker .icon-activity'); } + get emojiPickerTravelIcon() { return browser.element('.emoji-picker .icon-travel'); } + get emojiPickerObjectsIcon() { return browser.element('.emoji-picker .icon-objects'); } + get emojiPickerSymbolsIcon() { return browser.element('.emoji-picker .icon-symbols'); } + get emojiPickerFlagsIcon() { return browser.element('.emoji-picker .icon-flags'); } + get emojiPickerModifierIcon() { return browser.element('.emoji-picker .icon-symbols'); } + get emojiPickerChangeTone() { return browser.element('.emoji-picker .change-tone'); } + get emojiPickerCustomIcon() { return browser.element('.emoji-picker .icon-rocket'); } + get emojiPickerRecentIcon() { return browser.element('.emoji-picker .icon-recent'); } + get emojiPickerFilter() { return browser.element('.emoji-picker .emoji-filter'); } + 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'); } sendMessage(text) { - this.messageInput.setValue(text); + this.setTextToInput(text); this.sendBtn.click(); browser.waitUntil(function() { return browser.getText('.message:last-child .body') === text; @@ -28,15 +67,82 @@ class MainContent extends Page { } addTextToInput(text) { + this.messageInput.waitForVisible(5000); + this.messageInput.addValue(text); + } + + setTextToInput(text) { this.messageInput.waitForVisible(5000); this.messageInput.setValue(text); } + //uploads a file in the given filepath (url). fileUpload(filePath) { this.sendMessage('Prepare for the file'); this.fileAttachment.chooseFile(filePath); browser.pause(1000); } + + openMessageActionMenu() { + this.lastMessage.moveToObject(); + this.messageOptionsBtn.click(); + } + + //do one of the message actions, based on the "action" parameter inserted. + selectAction(action) { + switch (action) { + case 'edit': + this.messageEdit.waitForVisible(5000); + this.messageEdit.click(); + browser.pause(1000); + this.messageInput.addValue('this message was edited'); + break; + case 'reply': + this.messageReply.waitForVisible(5000); + this.messageReply.click(); + browser.pause(1000); + this.messageInput.addValue(' this is a reply message'); + break; + case 'delete': + this.messageDelete.waitForVisible(5000); + this.messageDelete.click(); + break; + case 'permalink': + this.messagePermalink.waitForVisible(5000); + this.messagePermalink.click(); + break; + case 'copy': + this.messageCopy.waitForVisible(5000); + this.messageCopy.click(); + break; + case 'quote': + this.messageQuote.waitForVisible(5000); + this.messageQuote.click(); + browser.pause(1000); + this.messageInput.addValue(' this is a quote message'); + break; + case 'star': + this.messageStar.waitForVisible(5000); + this.messageStar.click(); + break; + case 'unread': + this.messageUnread.waitForVisible(5000); + this.messageUnread.click(); + break; + case 'reaction': + this.messageReply.waitForVisible(5000); + this.messageReply.click(); + this.emojiPickerMainScreen.waitForVisible(5000); + this.emojiPickerPeopleIcon.click(); + this.emojiGrinning.waitForVisible(5000); + this.emojiGrinning.click(); + break; + case 'close': + this.messageClose.waitForVisible(5000); + this.messageClose.click(); + break; + } + } } module.exports = new MainContent(); \ No newline at end of file diff --git a/tests/pageobjects/side-nav.page.js b/tests/pageobjects/side-nav.page.js index 8af134256526..5a47c2321460 100644 --- a/tests/pageobjects/side-nav.page.js +++ b/tests/pageobjects/side-nav.page.js @@ -32,6 +32,13 @@ class SideNav extends Page { get statusOffline() { return browser.element('.offline'); } get account() { return browser.element('#account'); } get logout() { return browser.element('#logout'); } + get sideNavBar() { return browser.element('.side-nav '); } + get sideNavBtn() { return browser.element('.fixed-title .burger'); } + + get preferences() { return browser.element('.account-link:nth-of-type(1)'); } + get profile() { return browser.element('.account-link:nth-of-type(2)'); } + get avatar() { return browser.element('.account-link:nth-of-type(3)'); } + get preferencesClose() { return browser.element('.side-nav .arrow.close'); } openChannel(channelName) { browser.click('.rooms-list > .wrapper > ul [title="'+channelName+'"]'); diff --git a/tests/steps/3-basic-usage.js b/tests/steps/3-basic-usage.js new file mode 100644 index 000000000000..98ff9b8cdcf3 --- /dev/null +++ b/tests/steps/3-basic-usage.js @@ -0,0 +1,971 @@ +/* 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'; + +//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() { + this.retries(2); + + it('load page', () => { + loginPage.open(); + }); + + it('create user', () => { + loginPage.gotToRegister(); + + loginPage.registerNewUser({username, email, password}); + + browser.waitForExist('form#login-card input#username', 5000); + + browser.click('.submit > button'); + + browser.waitForExist('.main-content', 5000); + }); + + it('logout', () => { + browser.waitForVisible('.account-box'); + browser.click('.account-box'); + browser.pause(200); + + browser.waitForVisible('#logout'); + browser.click('#logout'); + }); + + it('login', () => { + loginPage.login({email, password}); + browser.waitForExist('.main-content', 5000); + }); + + describe('side nav bar', () => { + describe('render', () => { + it('should show the logged username', () => { + sideNav.accountBoxUserName.isVisible().should.be.true; + }); + + it('should show the logged user avatar', () => { + sideNav.accountBoxUserAvatar.isVisible().should.be.true; + }); + + it('should show the new channel button', () => { + sideNav.newChannelBtn.isVisible().should.be.true; + }); + + it('should show the plus icon', () => { + sideNav.newChannelIcon.isVisible().should.be.true; + }); + + 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 the plus icon', () => { + sideNav.newDirectMessageIcon.isVisible().should.be.true; + }); + + it('should show the "More Direct Messages" button', () => { + sideNav.moreDirectMessages.isVisible().should.be.true; + }); + + it('should show "general" channel', () => { + sideNav.general.isVisible().should.be.true; + }); + + it('should not show eye icon on general', () => { + sideNav.channelHoverIcon.isVisible().should.be.false; + }); + + it.skip('should show eye icon on hover', () => { + sideNav.general.moveToObject(); + sideNav.channelHoverIcon.isVisible().should.be.true; + }); + }); + + describe('user options', () => { + describe('render', () => { + before(() => { + sideNav.accountBoxUserName.click(); + }); + + after(() => { + sideNav.accountBoxUserName.click(); + }); + + it('should show user options', () => { + sideNav.userOptions.waitForVisible(); + sideNav.userOptions.isVisible().should.be.true; + }); + + it('should show online button', () => { + sideNav.statusOnline.isVisible().should.be.true; + }); + + it('should show away button', () => { + sideNav.statusAway.isVisible().should.be.true; + }); + + it('should show busy button', () => { + sideNav.statusBusy.isVisible().should.be.true; + }); + + it('should show offline button', () => { + sideNav.statusOffline.isVisible().should.be.true; + }); + + it('should show settings button', () => { + sideNav.account.isVisible().should.be.true; + }); + + it('should show logout button', () => { + sideNav.logout.isVisible().should.be.true; + }); + }); + }); + }); + + describe('general channel', () => { + it('open GENERAL', () => { + browser.waitForExist('.wrapper > ul .link-room-GENERAL', 50000); + browser.click('.wrapper > ul .link-room-GENERAL'); + + browser.waitForExist('.input-message', 5000); + }); + + 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; + }); + }); + + 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; + }); + + it('should show the cancel button', () => { + mainContent.popupFileCancelBtn.isVisible().should.be.true; + }); + + it('should show the file preview', () => { + mainContent.popupFilePreview.isVisible().should.be.true; + }); + + 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'); + }); + }); + }); + }); + }); + + describe('flextab usage', () => { + describe('render', () => { + it('should show the room info button', () => { + flexTab.channelTab.isVisible().should.be.true; + }); + + it('should show the room info tab content', () => { + browser.pause(3000); + flexTab.channelTab.click(); + flexTab.channelSettings.isVisible().should.be.true; + }); + + it('should show the message search button', () => { + flexTab.searchTab.isVisible().should.be.true; + }); + + it('should show the message tab content', () => { + flexTab.searchTab.click(); + flexTab.searchTabContent.isVisible().should.be.true; + }); + + it('should show the members tab button', () => { + flexTab.membersTab.isVisible().should.be.true; + }); + + it('should show the members content', () => { + flexTab.membersTab.click(); + flexTab.membersTabContent.isVisible().should.be.true; + }); + + it.skip('should show the members search bar', () => { + flexTab.userSearchBar.isVisible().should.be.true; + }); + + it('should show the show all link', () => { + flexTab.showAll.isVisible().should.be.true; + }); + + it.skip('should show the start video call button', () => { + flexTab.startVideoCall.isVisible().should.be.true; + }); + + it.skip('should show the start audio call', () => { + flexTab.startAudioCall.isVisible().should.be.true; + }); + + it('should show the notifications button', () => { + flexTab.notificationsTab.isVisible().should.be.true; + }); + + it('should show the notifications Tab content', () => { + flexTab.notificationsTab.click(); + flexTab.notificationsSettings.isVisible().should.be.true; + }); + + it('should show the files button', () => { + flexTab.filesTab.isVisible().should.be.true; + }); + + it('should show the files Tab content', () => { + flexTab.filesTab.click(); + flexTab.filesTabContent.isVisible().should.be.true; + }); + + it('should show the mentions button', () => { + flexTab.mentionsTab.isVisible().should.be.true; + }); + + it('should show the mentions Tab content', () => { + flexTab.mentionsTab.click(); + flexTab.mentionsTabContent.isVisible().should.be.true; + }); + + it('should show the starred button', () => { + flexTab.starredTab.isVisible().should.be.true; + }); + + it('should show the starred Tab content', () => { + flexTab.starredTab.click(); + flexTab.starredTabContent.isVisible().should.be.true; + }); + + it('should show the pinned button', () => { + flexTab.pinnedTab.isVisible().should.be.true; + }); + + it('should show the pinned messages Tab content', () => { + flexTab.pinnedTab.click(); + flexTab.pinnedTabContent.isVisible().should.be.true; + }); + }); + }); + + describe('direct channel', () => { + it('start a direct message with rocket.cat', () => { + sideNav.startDirectMessage(targetUser); + }); + + it('open the direct message', () => { + sideNav.openChannel(targetUser); + }); + + 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', () => { + it('create a public channel', () => { + sideNav.createChannel(publicChannelName, false, false); + }); + + 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); + }); + + it('remove people from room', () => { + flexTab.removePeopleFromChannel(targetUser); + flexTab.confirmPopup(); + }); + + it.skip('archive the room', () => { + flexTab.channelTab.click(); + flexTab.archiveChannel(); + flexTab.channelTab.click(); + }); + + it('open GENERAL', () => { + sideNav.openChannel('general'); + }); + }); + + describe('private channel', () => { + it('create a private channel', () => { + sideNav.createChannel(privateChannelName, true, false); + }); + + it('send a message in the private channel', () => { + 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); + }); + + it('remove people from room', () => { + flexTab.removePeopleFromChannel(targetUser); + flexTab.confirmPopup(); + }); + + it('archive the room', () => { + flexTab.channelTab.click(); + flexTab.archiveChannel(); + flexTab.channelTab.click(); + }); + }); +}); diff --git a/tests/steps/4-resolutions.js b/tests/steps/4-resolutions.js new file mode 100644 index 000000000000..893f4ccaf0fb --- /dev/null +++ b/tests/steps/4-resolutions.js @@ -0,0 +1,102 @@ +/* eslint-env mocha */ +/* eslint-disable func-names, prefer-arrow-callback */ + +import mainContent from '../pageobjects/main-content.page'; +import sideNav from '../pageobjects/side-nav.page'; + +describe('resolutions tests', ()=> { + describe('mobile render', ()=> { + it('change the resolution', ()=> { + browser.windowHandleSize({ + width: 650, + height: 800 + }); + }); + + it('should close de sidenav', () => { + mainContent.mainContent.getLocation().should.deep.equal({x:0, y:0}); + }); + + it('press the navbar button', () => { + sideNav.sideNavBtn.click(); + }); + + it('should open de sidenav', () => { + browser.pause(1000); + mainContent.mainContent.getLocation().should.not.deep.equal({x:0, y:0}); + }); + + it('open general channel', () => { + sideNav.openChannel('general'); + }); + + it('should close de sidenav', () => { + browser.pause(1000); + mainContent.mainContent.getLocation().should.deep.equal({x:0, y:0}); + }); + + it('press the navbar button', () => { + sideNav.sideNavBtn.click(); + }); + + it('opens the user preferences screen', () => { + sideNav.accountBoxUserName.waitForVisible(); + sideNav.accountBoxUserName.click(); + sideNav.account.waitForVisible(); + sideNav.account.click(); + }); + + it('press the preferences link', () => { + sideNav.preferences.waitForVisible(); + sideNav.preferences.click(); + }); + + it('should close de sidenav', () => { + browser.pause(1000); + mainContent.mainContent.getLocation().should.deep.equal({x:0, y:0}); + }); + + it('press the navbar button', () => { + sideNav.sideNavBtn.click(); + }); + + it('press the profile link', () => { + sideNav.profile.waitForVisible(); + sideNav.profile.click(); + }); + + it('should close de sidenav', () => { + browser.pause(1000); + mainContent.mainContent.getLocation().should.deep.equal({x:0, y:0}); + }); + + it('press the navbar button', () => { + sideNav.sideNavBtn.click(); + }); + + it('press the avatar link', () => { + sideNav.avatar.waitForVisible(); + sideNav.avatar.click(); + }); + + it('should close de sidenav', () => { + browser.pause(1000); + mainContent.mainContent.getLocation().should.deep.equal({x:0, y:0}); + }); + + it('press the navbar button', () => { + sideNav.sideNavBtn.click(); + }); + + it('change the resolution', ()=> { + browser.windowHandleSize({ + width: 1450, + height: 900 + }); + }); + + it('close the preferences menu', () => { + sideNav.preferencesClose.click(); + }); + }); +}); \ No newline at end of file diff --git a/tests/steps/5-emoji.js b/tests/steps/5-emoji.js new file mode 100644 index 000000000000..344d2d4e8c41 --- /dev/null +++ b/tests/steps/5-emoji.js @@ -0,0 +1,118 @@ +/* eslint-env mocha */ +/* eslint-disable func-names, prefer-arrow-callback */ + +import mainContent from '../pageobjects/main-content.page'; +import sideNav from '../pageobjects/side-nav.page'; + +describe('emoji', ()=> { + it('opens general', ()=> { + sideNav.openChannel('general'); + }); + + it('opens emoji menu', ()=> { + mainContent.emojiBtn.click(); + }); + + describe('render', ()=> { + it('should show the emoji picker menu', ()=> { + mainContent.emojiPickerMainScreen.isVisible().should.be.true; + }); + + it('click the emoji picker people tab', ()=> { + mainContent.emojiPickerPeopleIcon.click(); + }); + + it('should show the emoji picker people tab', ()=> { + mainContent.emojiPickerPeopleIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker nature tab', ()=> { + mainContent.emojiPickerNatureIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker food tab', ()=> { + mainContent.emojiPickerFoodIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker activity tab', ()=> { + mainContent.emojiPickerActivityIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker travel tab', ()=> { + mainContent.emojiPickerTravelIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker objects tab', ()=> { + mainContent.emojiPickerObjectsIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker symbols tab', ()=> { + mainContent.emojiPickerSymbolsIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker flags tab', ()=> { + mainContent.emojiPickerFlagsIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker custom tab', ()=> { + mainContent.emojiPickerCustomIcon.isVisible().should.be.true; + }); + + it('should show the emoji picker change tone button', ()=> { + mainContent.emojiPickerChangeTone.isVisible().should.be.true; + }); + + it('should show the emoji picker search bar', ()=> { + mainContent.emojiPickerFilter.isVisible().should.be.true; + }); + + it('send a smile emoji', ()=> { + mainContent.emojiSmile.click(); + }); + + it('the value on the message input should be the same as the emoji clicked', ()=> { + mainContent.messageInput.getValue().should.equal(':smile:'); + }); + + it('send the emoji', ()=> { + mainContent.addTextToInput(' '); + mainContent.sendBtn.click(); + }); + + it('the value on the message should be the same as the emoji clicked', ()=> { + mainContent.lastMessage.getText().should.equal('😄'); + }); + + it('adds emoji text to the message input', ()=> { + mainContent.addTextToInput(':smile'); + }); + + it('should show the emoji popup bar', ()=> { + mainContent.messagePopUp.isVisible().should.be.true; + }); + + it('the emoji popup bar title should be emoji', ()=> { + mainContent.messagePopUpTitle.getText().should.equal('Emoji'); + }); + + it('should show the emoji popup bar items', ()=> { + mainContent.messagePopUpItems.isVisible().should.be.true; + }); + + it('click the first emoji on the popup list', ()=> { + mainContent.messagePopUpFirstItem.click(); + }); + + it('the value on the message input should be the same as the emoji clicked', ()=> { + mainContent.messageInput.getValue().should.equal(':smile:'); + }); + + it('send the emoji', ()=> { + mainContent.sendBtn.click(); + }); + + it('the value on the message should be the same as the emoji clicked', ()=> { + mainContent.lastMessage.getText().should.equal('😄'); + }); + }); +}); diff --git a/tests/steps/6-channel.js b/tests/steps/6-channel.js new file mode 100644 index 000000000000..1dbd4e94c1b4 --- /dev/null +++ b/tests/steps/6-channel.js @@ -0,0 +1,126 @@ +/* eslint-env mocha */ +/* eslint-disable func-names, prefer-arrow-callback */ + +import flexTab from '../pageobjects/flex-tab.page'; +import mainContent from '../pageobjects/main-content.page'; +import sideNav from '../pageobjects/side-nav.page'; + +import {username} from '../test-data/user.js'; +import {publicChannelName} from '../test-data/channel.js'; +import {targetUser} from '../test-data/interactions.js'; + +describe('channel settings', ()=> { + + describe('channel info tab', ()=> { + it('open the channel', ()=> { + sideNav.openChannel(publicChannelName); + }); + + it('open the channel info tab', ()=> { + flexTab.channelTab.waitForVisible(); + flexTab.channelTab.click(); + }); + + it('should show the old name', ()=> { + flexTab.firstSetting.waitForVisible(); + flexTab.firstSetting.getText().should.equal(publicChannelName); + }); + + it('click the edit name', ()=> { + flexTab.editNameBtn.waitForVisible(); + flexTab.editNameBtn.click(); + }); + + it('edit the name input', ()=> { + flexTab.editNameTextInput.waitForVisible(); + flexTab.editNameTextInput.setValue('NAME-EDITED-'+publicChannelName); + }); + + it('save the name', ()=> { + flexTab.editNameSave.click(); + + }); + + it.skip('should show the new name', ()=> { + //gives timeout errors + flexTab.firstSetting.getText().should.equal('NAME-EDITED-'+publicChannelName); + }); + + it('click the edit topic', ()=> { + browser.pause(500); + flexTab.editTopicBtn.waitForVisible(5000); + flexTab.editTopicBtn.click(); + }); + + it('edit the topic input', ()=> { + flexTab.editTopicTextInput.waitForVisible(5000); + flexTab.editTopicTextInput.setValue('TOPIC EDITED'); + }); + + it('save the topic', ()=> { + flexTab.editNameSave.click(); + }); + + it('should show the new topic', ()=> { + flexTab.secondSetting.getText().should.equal('TOPIC EDITED'); + }); + + it('click the edit description', ()=> { + flexTab.editDescriptionBtn.waitForVisible(); + flexTab.editDescriptionBtn.click(); + }); + + it('edit the description input', ()=> { + flexTab.editDescriptionTextInput.waitForVisible(); + flexTab.editDescriptionTextInput.setValue('DESCRIPTION EDITED'); + }); + + it('save the description', ()=> { + flexTab.editNameSave.click(); + }); + + it('should show the new description', ()=> { + flexTab.thirdSetting.getText().should.equal('DESCRIPTION EDITED'); + }); + + it('open the users tab', ()=> { + browser.pause(7000); + flexTab.membersTab.waitForVisible(); + flexTab.membersTab.click(); + + }); + + it('sets rocket cat as owner', ()=> { + browser.pause(1000); + flexTab.setUserOwner(targetUser); + }); + + it('should show the owner add message', ()=> { + browser.pause(10000); + mainContent.lastMessage.getText().should.equal(targetUser+' was set owner by '+username); + }); + + it('sets rocket cat as moderator', ()=> { + browser.pause(1000); + flexTab.setUserModerator(targetUser); + }); + + it('should show the moderator add message', ()=> { + mainContent.lastMessage.getText().should.equal(targetUser+' was set moderator by '+username); + }); + + it('mute rocket cat', ()=> { + browser.pause(6000); + flexTab.muteUser(targetUser); + }); + + it('confirms the popup', ()=> { + flexTab.confirmPopup(); + }); + + it('close the user screen', ()=> { + browser.pause(6000); + flexTab.viewAllBtn.click(); + }); + }); +}); \ No newline at end of file diff --git a/tests/steps/basic-usage.js b/tests/steps/basic-usage.js deleted file mode 100644 index c8d0d9abafcf..000000000000 --- a/tests/steps/basic-usage.js +++ /dev/null @@ -1,426 +0,0 @@ -/* 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'; - -//Login info from the test user -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(); - -//User interactions (direct messages, add, remove...) -const targetUser = 'rocket.cat'; - -//Test data -const message = 'message from '+username; - - -//Basic usage test start -describe('Basic usage', function() { - this.retries(2); - - it('load page', () => { - loginPage.open(); - }); - - it('create user', () => { - loginPage.gotToRegister(); - - loginPage.registerNewUser({username, email, password}); - - browser.waitForExist('form#login-card input#username', 5000); - - browser.click('.submit > button'); - - browser.waitForExist('.main-content', 5000); - }); - - it('logout', () => { - browser.waitForVisible('.account-box'); - browser.click('.account-box'); - browser.pause(200); - - browser.waitForVisible('#logout'); - browser.click('#logout'); - }); - - it('login', () => { - loginPage.login({email, password}); - browser.waitForExist('.main-content', 5000); - }); - - describe('side nav bar', () => { - describe('render', () => { - it('should show the logged username', () => { - sideNav.accountBoxUserName.isVisible().should.be.true; - }); - - it('should show the logged user avatar', () => { - sideNav.accountBoxUserAvatar.isVisible().should.be.true; - }); - - it('should show the new channel button', () => { - sideNav.newChannelBtn.isVisible().should.be.true; - }); - - it('should show the plus icon', () => { - sideNav.newChannelIcon.isVisible().should.be.true; - }); - - 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 the plus icon', () => { - sideNav.newDirectMessageIcon.isVisible().should.be.true; - }); - - it('should show the "More Direct Messages" button', () => { - sideNav.moreDirectMessages.isVisible().should.be.true; - }); - - it('should show "general" channel', () => { - sideNav.general.isVisible().should.be.true; - }); - - it('should not show eye icon on general', () => { - sideNav.channelHoverIcon.isVisible().should.be.false; - }); - - it.skip('should show eye icon on hover', () => { - sideNav.general.moveToObject(); - sideNav.channelHoverIcon.isVisible().should.be.true; - }); - }); - - describe('user options', () => { - describe('render', () => { - before(() => { - sideNav.accountBoxUserName.click(); - }); - - after(() => { - sideNav.accountBoxUserName.click(); - }); - - it('should show user options', () => { - sideNav.userOptions.waitForVisible(); - sideNav.userOptions.isVisible().should.be.true; - }); - - it('should show online button', () => { - sideNav.statusOnline.isVisible().should.be.true; - }); - - it('should show away button', () => { - sideNav.statusAway.isVisible().should.be.true; - }); - - it('should show busy button', () => { - sideNav.statusBusy.isVisible().should.be.true; - }); - - it('should show offline button', () => { - sideNav.statusOffline.isVisible().should.be.true; - }); - - it('should show settings button', () => { - sideNav.account.isVisible().should.be.true; - }); - - it('should show logout button', () => { - sideNav.logout.isVisible().should.be.true; - }); - }); - }); - }); - - describe('general channel', () => { - it('open GENERAL', () => { - browser.waitForExist('.wrapper > ul .link-room-GENERAL', 50000); - browser.click('.wrapper > ul .link-room-GENERAL'); - - browser.waitForExist('.input-message', 5000); - }); - - 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; - }); - }); - - describe('fileUpload', ()=> { - it('send a attachment', () => { - mainContent.fileUpload('/home/martin/Downloads/cat.jpg'); //really ? - }); - - it('should show the confirm button', () => { - mainContent.popupFileConfirmBtn.isVisible().should.be.true; - }); - - it('should show the cancel button', () => { - mainContent.popupFileCancelBtn.isVisible().should.be.true; - }); - - it('should show the file preview', () => { - mainContent.popupFilePreview.isVisible().should.be.true; - }); - - 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(); - }); - - it('should show the image message', () => { - mainContent.lastMessageImg.isVisible(); - }); - }); - }); - }); - - describe('flextab usage', () => { - describe('render', () => { - it('should show the room info button', () => { - flexTab.channelTab.isVisible().should.be.true; - }); - - it('should show the room info tab content', () => { - flexTab.channelTab.click(); - flexTab.channelSettings.isVisible().should.be.true; - }); - - it('should show the message search button', () => { - flexTab.searchTab.isVisible().should.be.true; - }); - - it('should show the message tab content', () => { - flexTab.searchTab.click(); - flexTab.searchTabContent.isVisible().should.be.true; - }); - - it('should show the members tab button', () => { - flexTab.membersTab.isVisible().should.be.true; - }); - - it('should show the members content', () => { - flexTab.membersTab.click(); - flexTab.membersTabContent.isVisible().should.be.true; - }); - - it.skip('should show the members search bar', () => { - flexTab.userSearchBar.isVisible().should.be.true; - }); - - it('should show the show all link', () => { - flexTab.showAll.isVisible().should.be.true; - }); - - it.skip('should show the start video call button', () => { - flexTab.startVideoCall.isVisible().should.be.true; - }); - - it.skip('should show the start audio call', () => { - flexTab.startAudioCall.isVisible().should.be.true; - }); - - it('should show the notifications button', () => { - flexTab.notificationsTab.isVisible().should.be.true; - }); - - it('should show the notifications Tab content', () => { - flexTab.notificationsTab.click(); - flexTab.notificationsSettings.isVisible().should.be.true; - }); - - it('should show the files button', () => { - flexTab.filesTab.isVisible().should.be.true; - }); - - it('should show the files Tab content', () => { - flexTab.filesTab.click(); - flexTab.filesTabContent.isVisible().should.be.true; - }); - - it('should show the mentions button', () => { - flexTab.mentionsTab.isVisible().should.be.true; - }); - - it('should show the mentions Tab content', () => { - flexTab.mentionsTab.click(); - flexTab.mentionsTabContent.isVisible().should.be.true; - }); - - it('should show the starred button', () => { - flexTab.starredTab.isVisible().should.be.true; - }); - - it('should show the starred Tab content', () => { - flexTab.starredTab.click(); - flexTab.starredTabContent.isVisible().should.be.true; - }); - - it('should show the pinned button', () => { - flexTab.pinnedTab.isVisible().should.be.true; - }); - - it('should show the pinned messages Tab content', () => { - flexTab.pinnedTab.click(); - flexTab.pinnedTabContent.isVisible().should.be.true; - }); - }); - }); - - describe('direct channel', () => { - it('start a direct message with rocket.cat', () => { - sideNav.startDirectMessage(targetUser); - }); - - it('open the direct message', () => { - sideNav.openChannel(targetUser); - }); - - it('send a direct message', () => { - mainContent.sendMessage(message); - }); - }); - - describe('public channel', () => { - it('create a public channel', () => { - sideNav.createChannel(PublicChannelName, false, false); - sideNav.openChannel(PublicChannelName); - }); - - it('send a message in the public channel', () => { - mainContent.sendMessage(message); - }); - - it('add people to the room', () => { - flexTab.membersTab.click(); - flexTab.addPeopleToChannel(targetUser); - }); - - it('remove people from room', () => { - flexTab.removePeopleFromChannel(targetUser); - flexTab.confirmPopup(); - }); - - it('archive the room', () => { - flexTab.channelTab.click(); - flexTab.archiveChannel(); - flexTab.channelTab.click(); - }); - - it('open GENERAL', () => { - sideNav.openChannel('general'); - }); - }); - - describe('private channel', () => { - it('create a private channel', () => { - sideNav.createChannel(privateChannelName, true, false); - }); - - it('send a message in the private channel', () => { - mainContent.sendMessage(message); - }); - - it('add people to the room', () => { - flexTab.membersTab.click(); - flexTab.addPeopleToChannel(targetUser); - }); - - it('remove people from room', () => { - flexTab.removePeopleFromChannel(targetUser); - flexTab.confirmPopup(); - }); - - it('archive the room', () => { - flexTab.channelTab.click(); - flexTab.archiveChannel(); - flexTab.channelTab.click(); - }); - }); -}); diff --git a/tests/test-data/channel.js b/tests/test-data/channel.js new file mode 100644 index 000000000000..27fc4eb9c2c2 --- /dev/null +++ b/tests/test-data/channel.js @@ -0,0 +1,2 @@ +export const publicChannelName = 'channel-test-'+Date.now(); +export const privateChannelName = 'private-channel-test-'+Date.now(); \ No newline at end of file diff --git a/tests/test-data/interactions.js b/tests/test-data/interactions.js new file mode 100644 index 000000000000..d1953b3009de --- /dev/null +++ b/tests/test-data/interactions.js @@ -0,0 +1 @@ +export const targetUser = 'rocket.cat'; \ No newline at end of file diff --git a/tests/test-data/user.js b/tests/test-data/user.js new file mode 100644 index 000000000000..0b8032fff183 --- /dev/null +++ b/tests/test-data/user.js @@ -0,0 +1,3 @@ +export const username = 'user.test.'+Date.now(); +export const email = username+'@rocket.chat'; +export const password = 'rocket.chat'; \ No newline at end of file