Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX]Fix the failing tests #7094

Merged
merged 13 commits into from
May 31, 2017
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-sidenav/client/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<template name="toolbarSearchList">
<i class="{{icon}} {{userStatus}}"></i>
<span class="room-title {{#if unread}}bold{{/if}}">{{displayName}}</span>
<span class="room-title {{#if unread}}bold{{/if}}" name="{{displayName}}" >{{displayName}}</span>
{{#if unread}}
<span class="unread">{{unread}}</span>
{{/if}}
Expand Down
1 change: 1 addition & 0 deletions tests/end-to-end/ui/04-main-elements-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('[Main Elements Render]', function() {
});

it('it should show the new channel button', () => {
sideNav.newChannelBtn.waitForVisible(20000);
sideNav.newChannelBtn.isVisible().should.be.true;
});

Expand Down
3 changes: 2 additions & 1 deletion tests/end-to-end/ui/11-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ describe('[Administration]', () => {
before(() => {
checkIfUserIsAdmin(adminUsername, adminEmail, adminPassword);
sideNav.spotlightSearch.waitForVisible(10000);
sideNav.searchChannel('general');
sideNav.general.waitForVisible(5000);
sideNav.general.click();
});

after(() => {
Expand Down
3 changes: 2 additions & 1 deletion tests/end-to-end/ui/12-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ describe('[Api Settings Change]', () => {
before((done) => {
checkIfUserIsValid(username, email, password);
sideNav.spotlightSearch.waitForVisible(10000);
sideNav.searchChannel('general');
sideNav.general.waitForVisible(5000);
sideNav.general.click();

request.post(api('login'))
.send(login)
Expand Down
6 changes: 4 additions & 2 deletions tests/end-to-end/ui/13-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ describe('[Permissions]', () => {
before(() => {
checkIfUserIsAdmin(adminUsername, adminEmail, adminPassword);
sideNav.spotlightSearch.waitForVisible(10000);
sideNav.searchChannel('general');
sideNav.general.waitForVisible(5000);
sideNav.general.click();
sideNav.accountBoxUserName.waitForVisible(5000);
sideNav.accountBoxUserName.click();
sideNav.admin.waitForVisible(5000);
Expand All @@ -26,7 +27,8 @@ describe('[Permissions]', () => {
after(() => {
checkIfUserIsAdmin(adminUsername, adminEmail, adminPassword);
sideNav.spotlightSearch.waitForVisible(10000);
sideNav.searchChannel('general');
sideNav.general.waitForVisible(5000);
sideNav.general.click();
sideNav.accountBoxUserName.waitForVisible(5000);
sideNav.accountBoxUserName.click();
sideNav.admin.waitForVisible(5000);
Expand Down
8 changes: 4 additions & 4 deletions tests/pageobjects/main-content.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MainContent extends Page {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .body', 5000);
return browser.getText('.message:last-child .body') === text;
}, 2000);
}, 5000);
}

// adds text to the input
Expand All @@ -98,22 +98,22 @@ class MainContent extends Page {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .body', 5000);
return browser.getText('.message:last-child .body') === text;
}, 4000);
}, 5000);
}

waitForLastMessageTextAttachmentEqualsText(text) {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .attachment-text', 5000);
return browser.getText('.message:last-child .attachment-text') === text;
}, 2000);
}, 5000);
}

// Wait for the last message author username to equal the provided text
waitForLastMessageUserEqualsText(text) {
browser.waitUntil(function() {
browser.waitForVisible('.message:last-child .user-card-message:nth-of-type(2)', 5000);
return browser.getText('.message:last-child .user-card-message:nth-of-type(2)') === text;
}, 2000);
}, 5000);
}

openMessageActionMenu() {
Expand Down
43 changes: 26 additions & 17 deletions tests/pageobjects/side-nav.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,40 @@ class SideNav extends Page {
browser.click(`.rooms-list > .wrapper > ul [title="${ channelName }"]`);
browser.waitForVisible('.input-message', 5000);
browser.waitUntil(function() {
browser.waitForVisible('.room-title', 5000);
return browser.getText('.room-title') === channelName;
}, 5000);
browser.waitForVisible('.fixed-title .room-title', 8000);
return browser.getText('.fixed-title .room-title') === channelName;
}, 10000);
}

// Opens a channel via spotlight search
searchChannel(channelName) {
this.spotlightSearch.waitForVisible(5000);
this.spotlightSearch.click();
this.spotlightSearch.setValue(channelName);
browser.waitForVisible(`.room-title=${ channelName }`, 10000);
browser.click(`.room-title=${ channelName }`);
browser.waitUntil(function() {
browser.waitForVisible('.room-title', 5000);
return browser.getText('.room-title') === channelName;
}, 5000);
browser.waitForVisible('.fixed-title .room-title', 15000);
const currentRoom = browser.element('.fixed-title .room-title').getText();
if (currentRoom !== channelName) {
this.spotlightSearch.waitForVisible(5000);
this.spotlightSearch.click();
this.spotlightSearch.setValue(channelName);
browser.waitForVisible(`[name='${ channelName }']`, 5000);
browser.click(`[name='${ channelName }']`);
browser.waitUntil(function() {
browser.waitForVisible('.fixed-title .room-title', 8000);
return browser.getText('.fixed-title .room-title') === channelName;
}, 10000);

}
}

// Gets a channel from the spotlight search
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 }`);
browser.waitForVisible('.fixed-title .room-title', 15000);
const currentRoom = browser.element('.fixed-title .room-title').getText();
if (currentRoom !== channelName) {
this.spotlightSearch.waitForVisible(5000);
this.spotlightSearch.click();
this.spotlightSearch.setValue(channelName);
browser.waitForVisible(`[name='${ channelName }']`, 5000);
return browser.element(`[name='${ channelName }']`);
}
}

// Gets a channel from the rooms list
Expand Down