Skip to content
3 changes: 3 additions & 0 deletions e2e/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const data = {
groups: {
private: {
name: `detox-private-${ value }`
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should change docker as well.

alternate: {
name: `detox-alternate-${ value }`
}
},
teams: {
Expand Down
3 changes: 3 additions & 0 deletions e2e/data/data.docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const data = {
groups: {
private: {
name: `detox-private-${ value }`
},
alternate: {
name: `detox-alternate-${ value }`
}
},
teams: {
Expand Down
24 changes: 12 additions & 12 deletions e2e/tests/assorted/12-i18n.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ describe('i18n', () => {
* This test might become outdated as soon as we support the language
* Although this seems to be a bad approach, that's the intention for having fallback enabled
*/
it('OS set to available language and fallback to \'en\' on strings missing translation', async() => {
await device.launchApp({
...defaultLaunchArgs,
languageAndLocale: {
language: "nl",
locale: "nl"
}
});
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
await expect(element(by.id('join-workspace').and(by.label('Join a workspace')))).toBeVisible(); // Missing nl translation
await expect(element(by.id('create-workspace-button').and(by.label('Een nieuwe workspace maken')))).toBeVisible();
});
// it('OS set to available language and fallback to \'en\' on strings missing translation', async() => {
// await device.launchApp({
// ...defaultLaunchArgs,
// languageAndLocale: {
// language: "nl",
// locale: "nl"
// }
// });
// await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
// await expect(element(by.id('join-workspace').and(by.label('Word lid van een werkruimte')))).toBeVisible();
// await expect(element(by.id('create-workspace-button').and(by.label('Een nieuwe werkruimte aanmaken')))).toBeVisible();
// });
});

describe('Rocket.Chat language', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/onboarding/03-forgotpassword.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { navigateToLogin } = require('../../helpers/app');

describe('Forgot password screen', () => {
before(async() => {
await device.launchApp({ newInstance: true });
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToLogin();
await element(by.id('login-view-forgot-password')).tap();
await waitFor(element(by.id('forgot-password-view'))).toExist().withTimeout(2000);
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/onboarding/04-createuser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const data = require('../../data');

describe('Create user screen', () => {
before(async() => {
await device.launchApp({ newInstance: true });
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToRegister();
});

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/room/01-createroom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ describe('Create room screen', () => {
it('should get invalid room', async() => {
await element(by.id('create-channel-name')).typeText('general');
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.text(`A channel with name 'general' exists`))).toExist().withTimeout(60000);
await expect(element(by.text(`A channel with name 'general' exists`))).toExist();
await waitFor(element(by.text(`A channel with name general exists`))).toExist().withTimeout(60000);
await expect(element(by.text(`A channel with name general exists`))).toExist();
await element(by.text('OK')).tap();
});

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/room/02-room.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('Room screen', () => {
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'slow', 0.5);
await waitFor(element(by.label('Unstar')).atIndex(0)).toBeVisible().withTimeout(6000);
await waitFor(element(by.label('Unstar')).atIndex(0)).toExist().withTimeout(6000);
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
});

Expand Down Expand Up @@ -272,7 +272,7 @@ describe('Room screen', () => {
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(1000);
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await waitFor(element(by.label('Unpin'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.label('Unpin')).atIndex(0)).toExist().withTimeout(2000);
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
});

Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/room/03-roomactions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ describe('Room actions screen', () => {

it('should remove user from room', async() => {
await openActionSheet('rocket.cat');
await element(by.label('Remove from room')).tap();
await element(by.label('Remove from room')).atIndex(0).tap();
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
await element(by.label('Yes, remove user!').and(by.type('_UIAlertControllerActionView'))).tap();
await waitFor(element(by.id('room-members-view-item-rocket.cat'))).toBeNotVisible().withTimeout(60000);
Expand Down Expand Up @@ -456,13 +456,13 @@ describe('Room actions screen', () => {

it('should set/remove as mute', async() => {
await openActionSheet(user.username);
await element(by.label('Mute')).tap();
await element(by.label('Mute')).atIndex(0).tap();
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
await element(by.label('Mute').and(by.type('_UIAlertControllerActionView'))).tap();
await waitForToast();

await openActionSheet(user.username);
await element(by.label('Unmute')).tap();
await element(by.label('Unmute')).atIndex(0).tap();
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
await element(by.label('Unmute').and(by.type('_UIAlertControllerActionView'))).tap();
await waitForToast();
Expand All @@ -478,7 +478,7 @@ describe('Room actions screen', () => {
const channelName = `#${ data.groups.private.name }`;
await sendMessage(user, channelName, message);
await openActionSheet(user.username);
await element(by.label('Ignore')).tap();
await element(by.label('Ignore')).atIndex(0).tap();
await waitForToast();
await backToActions();
await tapBack();
Expand All @@ -497,7 +497,7 @@ describe('Room actions screen', () => {
await element(by.id('room-members-view-toggle-status')).tap();
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
await openActionSheet(user.username);
await element(by.label('Direct message')).tap();
await element(by.label('Direct message')).atIndex(0).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
await waitFor(element(by.id(`room-view-title-${ user.username }`))).toExist().withTimeout(60000);
await tapBack();
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/room/04-discussion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Discussion', () => {
const discussionName = `${data.random} Discussion NewMessageView`;
await element(by.id('rooms-list-view-create-channel')).tap();
await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(2000);
await element(by.label('Create Discussion')).tap();
await element(by.label('Create Discussion')).atIndex(0).tap();
await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(60000);
await expect(element(by.id('create-discussion-view'))).toExist();
await element(by.label('Select a Channel...')).tap();
Expand All @@ -44,7 +44,7 @@ describe('Discussion', () => {
await navigateToRoom();
await element(by.id('messagebox-actions')).tap();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(2000);
await element(by.label('Create Discussion')).tap();
await element(by.label('Create Discussion')).atIndex(0).tap();
await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(2000);
await element(by.id('multi-select-discussion-name')).replaceText(discussionName);
await waitFor(element(by.id(`create-discussion-submit`))).toExist().withTimeout(10000);
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/room/05-threads.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Threads', () => {
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Reply in Thread')).tap();
await element(by.label('Reply in Thread')).atIndex(0).tap();
await element(by.id('messagebox-input')).typeText('replied');
await element(by.id('messagebox-send-message')).tap();
await waitFor(element(by.id(`message-thread-button-${ thread }`))).toExist().withTimeout(5000);
Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/room/07-markasunread.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('../../data');
const { navigateToLogin, login, searchRoom } = require('../../helpers/app');
const { navigateToLogin, login, searchRoom, sleep } = require('../../helpers/app');
const { sendMessage } = require('../../helpers/data_setup')

async function navigateToRoom(user) {
Expand All @@ -25,15 +25,15 @@ describe('Mark as unread', () => {
describe('Usage', async() => {
describe('Mark message as unread', async() => {
it('should mark message as unread', async() => {
const message = `${ data.random }message`;
const message = `${ data.random }message-mark-as-unread`;
const channelName = `@${ data.users.regular.username }`;
await sendMessage(data.users.alternate, channelName, message);
await waitFor(element(by.label(message)).atIndex(0)).toExist().withTimeout(30000);
await sleep(300);
await element(by.label(message)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await waitFor(element(by.id('action-sheet-handle'))).toBeVisible().withTimeout(3000);
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Mark Unread')).tap();
await element(by.label('Mark Unread')).atIndex(0).tap();
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000);
await expect(element(by.id(`rooms-list-view-item-${data.users.alternate.username}`))).toExist();
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/team/02-team.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ async function waitForToast() {
describe('Team', () => {
const team = data.teams.private.name;
const user = data.users.alternate;
const room = `private${ data.random }`;
const existingRoom = data.groups.private.name;
const room = `private${ data.random }-channel-team`;
const existingRoom = data.groups.alternate.name;

before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
Expand Down