added spotlight and channel list tests

pull/5875/head
Martin Schoeler 9 years ago
parent c745f189cd
commit 614fc7da83
  1. 4
      tests/end-to-end/ui/04-main-elements-render.js
  2. 474
      tests/end-to-end/ui/09-channel.js
  3. 9
      tests/pageobjects/side-nav.page.js

@ -46,6 +46,10 @@ describe('Main Elements Render', function() {
sideNav.general.isVisible().should.be.true;
});
it('should show spotlight search bar', () => {
sideNav.spotlightSearch.isVisible().should.be.true;
});
it.skip('should not show eye icon on general', () => {
sideNav.channelHoverIcon.isVisible().should.be.true;
});

@ -11,196 +11,116 @@ import {checkIfUserIsValid, publicChannelCreated, setPublicChannelCreated} from
import {publicChannelName} from '../../data/channel.js';
import {targetUser} from '../../data/interactions.js';
describe('channel usage', ()=> {
describe('channel', ()=> {
before(() => {
checkIfUserIsValid(username, email, password);
checkIfUserIsValid(username, email, password);checkIfUserIsValid(username, email, password);
if (!publicChannelCreated) {
sideNav.createChannel(publicChannelName, false, false);
setPublicChannelCreated(true);
console.log('public channel not found, creating one...');
}
sideNav.openChannel(publicChannelName);
});
describe('channel search', ()=> {
describe('searching with spotlightSearch', () => {
describe('rocket.cat', () => {
beforeEach(() => {
sideNav.getChannelFromSpotlight('rocket.cat').waitForVisible(5000);
});
describe('Adding a user to the room', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
afterEach(() => {
sideNav.spotlightSearch.setValue('');
});
it('add people to the room', () => {
flexTab.addPeopleToChannel(targetUser);
});
});
it('should search rocket cat', () => {
sideNav.getChannelFromSpotlight('rocket.cat').isVisible().should.be.true;
});
describe('Channel settings', ()=> {
describe('Channel name edit', ()=> {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
it('should start a direct message with rocket.cat', () => {
sideNav.searchChannel('rocket.cat');
mainContent.channelTitle.getText().should.equal('rocket.cat');
});
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible(5000);
});
describe('general', () => {
beforeEach(() => {
sideNav.getChannelFromSpotlight('general').waitForVisible(5000);
});
it('should show the old name', ()=> {
flexTab.firstSetting.waitForVisible();
flexTab.firstSetting.getText().should.equal(publicChannelName);
});
afterEach(() => {
sideNav.spotlightSearch.setValue('');
});
it('click the edit name', ()=> {
flexTab.editNameBtn.waitForVisible();
flexTab.editNameBtn.click();
});
it('should search general', () => {
sideNav.getChannelFromSpotlight('general').isVisible().should.be.true;
});
it('edit the name input', ()=> {
flexTab.editNameTextInput.waitForVisible();
flexTab.editNameTextInput.setValue('NAME-EDITED-'+publicChannelName);
it('should go to general', () => {
sideNav.searchChannel('general');
mainContent.channelTitle.getText().should.equal('general');
});
});
it('save the name', ()=> {
flexTab.editNameSave.click();
});
describe('user created channel', () => {
beforeEach(() => {
sideNav.getChannelFromSpotlight(publicChannelName).waitForVisible(5000);
});
it('should show the new name', ()=> {
var channelName = sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName);
channelName.getText().should.equal('NAME-EDITED-'+publicChannelName);
});
});
afterEach(() => {
sideNav.spotlightSearch.setValue('');
});
describe('Channel topic edit', ()=> {
before(()=> {
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
it('should search the user created channel', () => {
sideNav.getChannelFromSpotlight(publicChannelName).isVisible().should.be.true;
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
it('click the edit topic', ()=> {
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('should go to the user created channel', () => {
sideNav.searchChannel(publicChannelName);
mainContent.channelTitle.getText().should.equal(publicChannelName);
});
});
});
describe('Channel description edit', ()=> {
before(()=> {
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
describe('searching with sideNav channel list', () => {
before(() => {
mainContent.messageInput.click();
});
describe('rocket.cat', () => {
it('should show the rocket cat in the direct messages list', () => {
sideNav.getChannelFromList('rocket.cat').isVisible().should.be.true;
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
it('should go to the rocket cat direct message', () => {
sideNav.openChannel('rocket.cat');
});
});
it('click the edit description', ()=> {
flexTab.editDescriptionBtn.waitForVisible();
flexTab.editDescriptionBtn.click();
});
describe('general', () => {
it('should show the general in the channel list', () => {
sideNav.getChannelFromList('general').isVisible().should.be.true;
});
it('edit the description input', ()=> {
flexTab.editDescriptionTextInput.waitForVisible(5000);
flexTab.editDescriptionTextInput.setValue('DESCRIPTION EDITED');
it('should go to the general channel', () => {
sideNav.openChannel('general');
});
});
describe('user created channel', () => {
it('should show the user created channel in the channel list', () => {
sideNav.getChannelFromList(publicChannelName).isVisible().should.be.true;
});
it('save the description', ()=> {
flexTab.editNameSave.click();
});
it('should show the new description', ()=> {
flexTab.thirdSetting.getText().should.equal('DESCRIPTION EDITED');
it('should go to the user created channel', () => {
sideNav.openChannel(publicChannelName);
});
});
});
});
describe('Members tab usage', () => {
describe('Owner added', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
it('sets rocket cat as owner', ()=> {
flexTab.setUserOwner(targetUser);
});
it('dismiss the toast', ()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
});
it('the last message should be a subscription role added', ()=> {
mainContent.lastMessageRoleAdded.isVisible().should.be.true;
});
it('should show the target username in owner add message', ()=> {
mainContent.lastMessage.getText().should.have.string(targetUser);
});
describe('channel usage', ()=> {
before(() => {
sideNav.openChannel(publicChannelName);
});
describe('Moderator added', () => {
describe('Adding a user to the room', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
@ -219,44 +139,230 @@ describe('channel usage', ()=> {
flexTab.membersTab.click();
});
it('sets rocket cat as moderator', ()=> {
flexTab.setUserModerator(targetUser);
});
it('dismiss the toast', ()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
});
it('the last message should be a subscription role added', ()=> {
mainContent.lastMessageRoleAdded.isVisible().should.be.true;
it('add people to the room', () => {
flexTab.addPeopleToChannel(targetUser);
});
it('should show the target username in moderator add message', ()=> {
mainContent.lastMessage.getText().should.have.string(targetUser);
});
});
describe.skip('User muted', () => {
before(()=> {
flexTab.membersTab.waitForVisible(5000);
flexTab.membersTab.click();
});
after(()=> {
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
describe('Channel settings', ()=> {
describe('Channel name edit', ()=> {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible(5000);
});
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('should show the new name', ()=> {
var channelName = sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName);
channelName.getText().should.equal('NAME-EDITED-'+publicChannelName);
});
});
describe('Channel topic edit', ()=> {
before(()=> {
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
it('click the edit topic', ()=> {
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');
});
});
describe('Channel description edit', ()=> {
before(()=> {
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.channelTab.waitForVisible();
flexTab.channelTab.click();
});
it('click the edit description', ()=> {
flexTab.editDescriptionBtn.waitForVisible();
flexTab.editDescriptionBtn.click();
});
it('edit the description input', ()=> {
flexTab.editDescriptionTextInput.waitForVisible(5000);
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('mute rocket cat', ()=> {
flexTab.muteUser(targetUser);
describe('Members tab usage', () => {
describe('Owner added', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
it('sets rocket cat as owner', ()=> {
flexTab.setUserOwner(targetUser);
});
it('dismiss the toast', ()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
});
it('the last message should be a subscription role added', ()=> {
mainContent.lastMessageRoleAdded.isVisible().should.be.true;
});
it('should show the target username in owner add message', ()=> {
mainContent.lastMessage.getText().should.have.string(targetUser);
});
});
describe('Moderator added', () => {
before(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
after(()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
it('sets rocket cat as moderator', ()=> {
flexTab.setUserModerator(targetUser);
});
it('dismiss the toast', ()=> {
if (Global.toastAlert.isVisible()) {
flexTab.dismissToast();
Global.toastAlert.waitForVisible(5000, true);
}
});
it('the last message should be a subscription role added', ()=> {
mainContent.lastMessageRoleAdded.isVisible().should.be.true;
});
it('should show the target username in moderator add message', ()=> {
mainContent.lastMessage.getText().should.have.string(targetUser);
});
});
describe.skip('User muted', () => {
before(()=> {
flexTab.membersTab.waitForVisible(5000);
flexTab.membersTab.click();
});
after(()=> {
flexTab.membersTab.waitForVisible();
flexTab.membersTab.click();
});
it('mute rocket cat', ()=> {
flexTab.muteUser(targetUser);
});
it('confirms the popup', ()=> {
flexTab.confirmPopup();
});
});
});
it('confirms the popup', ()=> {
flexTab.confirmPopup();
});
it.skip('leave the channel', () => {
let channel = sideNav.getChannelFromList('NAME-EDITED-'+publicChannelName);
channel.moveToObject();
sideNav.channelLeave.waitForVisible(5000);
sideNav.channelLeave.click();
});
});
});

@ -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 channelLeave() { return browser.element('.leave-room'); }
openChannel(channelName) {
browser.click('.rooms-list > .wrapper > ul [title="'+channelName+'"]');
@ -55,6 +56,14 @@ class SideNav extends Page {
}, 5000);
}
getChannelFromSpotlight(channelName) {
this.spotlightSearch.waitForVisible(5000);
this.spotlightSearch.click();
this.spotlightSearch.setValue(channelName);
browser.waitForVisible('.room-title='+channelName, 5000);
return browser.element('.room-title='+channelName);
}
getChannelFromList(channelName) {
return browser.element('.rooms-list > .wrapper > ul [title="'+channelName+'"]');
}

Loading…
Cancel
Save