Skip to content
Snippets Groups Projects
Commit 1c228760 authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #4739 from RocketChat/user-preferences-test

User preferences tests
parents 2f8c637f 98275ca8
No related branches found
No related tags found
No related merge requests found
......@@ -59,16 +59,24 @@ class FlexTab extends Page {
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 memberUserName() { return browser.element('.info h3'); }
get memberRealName() { return browser.element('.info p'); }
get confirmBtn() { return browser.element('.confirm'); }
get sweetAlertOverlay() { return browser.element('.sweet-overlay'); }
get toastAlert() { return browser.element('.toast'); }
confirmPopup() {
this.confirmBtn.click();
this.sweetAlertOverlay.waitForVisible(5000, true);
}
dismissToast() {
this.toastAlert.click();
browser.pause(4000);
}
archiveChannel() {
this.archiveBtn.waitForVisible();
this.archiveBtn.click();
......
import Page from './Page';
class PreferencesMainContent extends Page {
get formTextInput() { return browser.element('.rocket-form'); }
get realNameTextInput() { return browser.element('[name="realname"]'); }
get userNameTextInput() { return browser.element('[name="username"]'); }
get emailTextInput() { return browser.element('[name="email"]'); }
get passwordTextInput() { return browser.element('[name="password"]'); }
get resendVerificationEmailBtn() { return browser.element('#resend-verification-email'); }
get avatarFileInput() { return browser.element('.avatar-file-input'); }
get useUploadedAvatar() { return browser.element('.avatar-suggestion-item:nth-of-type(2) .select-service'); }
get submitBtn() { return browser.element('.submit .button'); }
get sweetAlert() { return browser.element('.sweet-alert'); }
get sweetAlertConfirm() { return browser.element('.sweet-alert .sa-confirm-button-container'); }
get sweetAlertPasswordField() { return browser.element('.sweet-alert [type="password"]'); }
changeUsername(userName) {
this.userNameTextInput.waitForVisible(5000);
this.userNameTextInput.setValue(userName);
}
changeRealName(realName) {
this.realNameTextInput.waitForVisible(5000);
this.realNameTextInput.setValue(realName);
}
changeEmail(email) {
this.emailTextInput.waitForVisible(5000);
this.emailTextInput.setValue(email);
}
saveChanges() {
this.submitBtn.waitForVisible(5000);
this.submitBtn.click();
}
changeAvatarUpload(url) {
this.avatarFileInput.chooseFile(url);
this.useUploadedAvatar.click();
}
}
module.exports = new PreferencesMainContent();
\ No newline at end of file
......@@ -9,7 +9,7 @@ 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';
import {targetUser, imgURL} from '../test-data/interactions.js';
//Test data
const message = 'message from '+username;
......@@ -32,21 +32,21 @@ describe('Basic usage', function() {
browser.click('.submit > button');
browser.waitForExist('.main-content', 5000);
mainContent.mainContent.waitForExist(5000);
});
it('logout', () => {
browser.waitForVisible('.account-box');
browser.click('.account-box');
sideNav.accountBoxUserName.waitForVisible(5000);
sideNav.accountBoxUserName.click();
browser.pause(200);
browser.waitForVisible('#logout');
browser.click('#logout');
sideNav.logout.waitForVisible(5000);
sideNav.logout.click();
});
it('login', () => {
loginPage.login({email, password});
browser.waitForExist('.main-content', 5000);
mainContent.mainContent.waitForExist(5000);
});
describe('side nav bar', () => {
......@@ -90,11 +90,6 @@ describe('Basic usage', function() {
it('should not show eye icon on general', () => {
sideNav.channelHoverIcon.isVisible().should.be.false;
});
it('should show eye icon on hover', () => {
sideNav.general.moveToObject();
sideNav.channelHoverIcon.isVisible().should.be.true;
});
});
describe('user options', () => {
......@@ -141,10 +136,8 @@ describe('Basic usage', function() {
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);
sideNav.getChannelFromList('general').waitForExist(5000);
sideNav.openChannel('general');
});
it('send a message', () => {
......@@ -232,7 +225,7 @@ describe('Basic usage', function() {
describe('fileUpload', ()=> {
it('send a attachment', () => {
mainContent.fileUpload('./public/images/logo/1024x1024.png');
mainContent.fileUpload(imgURL);
});
it('should show the confirm button', () => {
......@@ -440,7 +433,7 @@ describe('Basic usage', function() {
});
it('should show the room info tab content', () => {
browser.pause(3000);
browser.pause(7000);
flexTab.channelTab.click();
flexTab.channelSettings.isVisible().should.be.true;
});
......@@ -450,6 +443,7 @@ describe('Basic usage', function() {
});
it('should show the message tab content', () => {
browser.pause(5000);
flexTab.searchTab.click();
flexTab.searchTabContent.isVisible().should.be.true;
});
......@@ -463,7 +457,7 @@ describe('Basic usage', function() {
flexTab.membersTabContent.isVisible().should.be.true;
});
it('should show the members search bar', () => {
it.skip('should show the members search bar', () => {
flexTab.userSearchBar.isVisible().should.be.true;
});
......@@ -471,14 +465,6 @@ describe('Basic usage', function() {
flexTab.showAll.isVisible().should.be.true;
});
it('should show the start video call button', () => {
flexTab.startVideoCall.isVisible().should.be.true;
});
it('should show the start audio call', () => {
flexTab.startAudioCall.isVisible().should.be.true;
});
it('should show the notifications button', () => {
flexTab.notificationsTab.isVisible().should.be.true;
});
......@@ -730,7 +716,7 @@ describe('Basic usage', function() {
it('open the public channel', () => {
sideNav.openChannel(publicChannelName);
browser.pause(5000);
browser.pause(3000);
});
it('send a message in the public channel', () => {
......
......@@ -84,20 +84,25 @@ describe('channel settings', ()=> {
flexTab.thirdSetting.getText().should.equal('DESCRIPTION EDITED');
});
it('dismiss the toast', ()=> {
flexTab.dismissToast();
});
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('dismiss the toast', ()=> {
flexTab.dismissToast();
});
it('should show the owner add message', ()=> {
browser.pause(10000);
mainContent.lastMessage.getText().should.equal(targetUser+' was set owner by '+username);
});
......@@ -111,7 +116,7 @@ describe('channel settings', ()=> {
});
it('mute rocket cat', ()=> {
browser.pause(6000);
browser.pause(5000);
flexTab.muteUser(targetUser);
});
......@@ -120,7 +125,7 @@ describe('channel settings', ()=> {
});
it('close the user screen', ()=> {
browser.pause(6000);
browser.pause(5000);
flexTab.viewAllBtn.click();
});
});
......
/* 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 preferencesMainContent from '../pageobjects/preferences-main-content.page';
import {username, password} from '../test-data/user.js';
import {imgURL} from '../test-data/interactions.js';
describe('user preferences', ()=> {
it('opens the user preferences screen', () => {
sideNav.accountBoxUserName.waitForVisible();
sideNav.accountBoxUserName.click();
sideNav.account.waitForVisible();
sideNav.account.click();
browser.pause(1000);
});
describe('render', ()=> {
it('should show the preferences link', ()=> {
sideNav.preferences.isVisible().should.be.true;
});
it('should show the profile link', ()=> {
sideNav.profile.isVisible().should.be.true;
});
it('should show the avatar link', ()=> {
sideNav.avatar.isVisible().should.be.true;
});
it('click on the profile link', ()=> {
sideNav.profile.click();
browser.pause(1000);
});
it('should show the username input', ()=> {
preferencesMainContent.userNameTextInput.isVisible().should.be.true;
});
it('should show the real name input', ()=> {
preferencesMainContent.realNameTextInput.isVisible().should.be.true;
});
it('should show the email input', ()=> {
preferencesMainContent.emailTextInput.isVisible().should.be.true;
});
it('should show the password input', ()=> {
preferencesMainContent.passwordTextInput.isVisible().should.be.true;
});
it('should show the submit button', ()=> {
preferencesMainContent.submitBtn.isVisible().should.be.true;
});
});
//it gives off a "Too Many Requests Error" due the 60 seconds username change restriction
describe.skip('user info change', ()=> {
it('click on the profile link', ()=> {
sideNav.profile.click();
browser.pause(1000);
});
it('change the name field', ()=> {
preferencesMainContent.changeRealName('EditedRealName'+username);
});
it('change the Username field', ()=> {
preferencesMainContent.changeUsername('EditedUserName'+username);
});
it.skip('change the email field', ()=> {
preferencesMainContent.changeEmail('EditedUserEmail'+username+'@gmail.com');
});
it('save the settings', ()=> {
preferencesMainContent.saveChanges();
});
it.skip('put the password in the sweet alert input', ()=> {
preferencesMainContent.acceptPasswordOverlay(password);
});
it('click on the avatar link', ()=> {
sideNav.avatar.click();
});
it('upload a avatar', ()=> {
preferencesMainContent.changeAvatarUpload(imgURL);
});
it('close the preferences menu', () => {
sideNav.preferencesClose.click();
browser.pause(3000);
});
it('open GENERAL', () => {
sideNav.openChannel('general');
});
it('send a message to be tested', () => {
mainContent.sendMessage('HI');
});
it('the name on the last message should be the edited one', () => {
mainContent.lastMessageUser.getText().should.equal('EditedUserName'+username);
});
it('the name on the nav bar should be the edited one', () => {
sideNav.accountBoxUserName.getText().should.equal('EditedUserName'+username);
});
it('click on the last message ', () => {
mainContent.lastMessageUser.click();
});
it('the user name on the members flex tab should be the edited one', () => {
flexTab.memberUserName.getText().should.equal('EditedUserName'+username);
});
it('the real name on the members flex tab should be the edited one', () => {
flexTab.memberRealName.getText().should.equal('EditedRealName'+username);
});
it('close the flexTab', () => {
flexTab.membersTab.click();
});
});
});
\ No newline at end of file
export const targetUser = 'rocket.cat';
\ No newline at end of file
export const targetUser = 'rocket.cat';
export const imgURL = './public/images/logo/1024x1024.png';
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment