From 2bc7cc0c95ecd190cbee0a5db363fbef5b4c2d19 Mon Sep 17 00:00:00 2001 From: Martin Schoeler Date: Fri, 3 Feb 2017 16:28:01 -0200 Subject: [PATCH] added more tests to the spotlight --- .../end-to-end/ui/04-main-elements-render.js | 37 +++++++++++++++ tests/end-to-end/ui/09-channel.js | 46 ++++++++++++++++--- tests/pageobjects/global.js | 7 +++ tests/pageobjects/main-content.page.js | 1 + tests/pageobjects/side-nav.page.js | 1 + 5 files changed, 86 insertions(+), 6 deletions(-) diff --git a/tests/end-to-end/ui/04-main-elements-render.js b/tests/end-to-end/ui/04-main-elements-render.js index a0c475da0b6..d6cc6339be0 100644 --- a/tests/end-to-end/ui/04-main-elements-render.js +++ b/tests/end-to-end/ui/04-main-elements-render.js @@ -54,6 +54,43 @@ describe('Main Elements Render', function() { sideNav.channelHoverIcon.isVisible().should.be.true; }); }); + + describe('spotlight search render', () => { + it('should show spotlight search bar', () => { + sideNav.spotlightSearch.isVisible().should.be.true; + }); + + it('should click the spotlight and show the channel list', () => { + sideNav.spotlightSearch.waitForVisible(5000); + sideNav.spotlightSearch.click(); + sideNav.spotlightSearchPopUp.waitForVisible(5000); + sideNav.spotlightSearchPopUp.isVisible().should.be.true; + }); + + it('when the spotlight loses focus the list should disappear', () => { + sideNav.spotlightSearchPopUp.waitForVisible(5000); + sideNav.spotlightSearchPopUp.isVisible().should.be.true; + mainContent.messageInput.click(); + sideNav.spotlightSearchPopUp.waitForVisible(5000, true); + sideNav.spotlightSearchPopUp.isVisible().should.be.false; + }); + + 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); + sideNav.spotlightSearchPopUp.isVisible().should.be.true; + }); + + it('the text on the spotlight and the list should disappear when lost focus', () => { + sideNav.spotlightSearchPopUp.waitForVisible(5000); + sideNav.spotlightSearchPopUp.isVisible().should.be.true; + mainContent.messageInput.click(); + sideNav.spotlightSearchPopUp.waitForVisible(5000, true); + sideNav.spotlightSearchPopUp.isVisible().should.be.false; + sideNav.spotlightSearch.getText().should.equal(''); + }); + }); }); describe('user options', () => { diff --git a/tests/end-to-end/ui/09-channel.js b/tests/end-to-end/ui/09-channel.js index d81cd8569ef..6bf83736b80 100644 --- a/tests/end-to-end/ui/09-channel.js +++ b/tests/end-to-end/ui/09-channel.js @@ -337,6 +337,45 @@ describe('channel', ()=> { }); }); + describe('channel quit and enter', () => { + it('leave the channel', () => { + let channel = sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName); + channel.click(); + channel.moveToObject(); + sideNav.channelLeave.waitForVisible(5000); + sideNav.channelLeave.click(); + Global.sweetAlert.waitForVisible(5000); + }); + + it('should show the sweet alert popup', () => { + Global.sweetAlert.waitForVisible(5000); + Global.sweetAlert.isVisible().should.be.true; + Global.sweetAlertConfirm.isVisible().should.be.true; + }); + + it('should close the popup', () => { + Global.confirmPopup(); + }); + + 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; + }); + + it('should search and enter the channel with the spotlight', () => { + sideNav.searchChannel('NAME-EDITED-'+publicChannelName); + mainContent.joinChannelBtn.waitForVisible(5000); + mainContent.joinChannelBtn.click(); + + }); + + it('should show the channel on the list', () => { + sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName).waitForVisible(10000); + sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName).isVisible().should.be.true; + }); + }); + + describe.skip('User muted', () => { before(()=> { flexTab.membersTab.waitForVisible(5000); @@ -356,13 +395,8 @@ describe('channel', ()=> { flexTab.confirmPopup(); }); }); - }); - it.skip('leave the channel', () => { - let channel = sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName); - channel.moveToObject(); - sideNav.channelLeave.waitForVisible(5000); - sideNav.channelLeave.click(); + }); }); }); diff --git a/tests/pageobjects/global.js b/tests/pageobjects/global.js index 778a56e8646..9eec4a50cc3 100644 --- a/tests/pageobjects/global.js +++ b/tests/pageobjects/global.js @@ -4,6 +4,13 @@ class Global { get sweetAlertConfirm() { return browser.element('.sweet-alert .sa-confirm-button-container'); } get sweetAlertPasswordField() { return browser.element('.sweet-alert [type="password"]'); } get toastAlert() { return browser.element('.toast'); } + + confirmPopup() { + this.sweetAlertConfirm.waitForVisible(5000); + browser.pause(1000); + this.sweetAlertConfirm.click(); + this.sweetAlert.waitForVisible(5000, true); + } } module.exports = new Global(); \ No newline at end of file diff --git a/tests/pageobjects/main-content.page.js b/tests/pageobjects/main-content.page.js index 2f00e413f77..5df4c5c5748 100644 --- a/tests/pageobjects/main-content.page.js +++ b/tests/pageobjects/main-content.page.js @@ -64,6 +64,7 @@ class MainContent extends Page { 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'); } sendMessage(text) { this.setTextToInput(text); diff --git a/tests/pageobjects/side-nav.page.js b/tests/pageobjects/side-nav.page.js index 2c429488d68..9a034bc915a 100644 --- a/tests/pageobjects/side-nav.page.js +++ b/tests/pageobjects/side-nav.page.js @@ -35,6 +35,7 @@ class SideNav extends Page { get avatar() { return browser.element('.account-link:nth-of-type(3)'); } 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'); } openChannel(channelName) {