diff --git a/e2e/data.js b/e2e/data.js index c69b72515..98257f71d 100644 --- a/e2e/data.js +++ b/e2e/data.js @@ -40,6 +40,9 @@ const data = { groups: { private: { name: `detox-private-${ value }` + }, + alternate: { + name: `detox-alternate-${ value }` } }, teams: { diff --git a/e2e/data/data.docker.js b/e2e/data/data.docker.js index 1a6bb1569..31fb5c8e2 100644 --- a/e2e/data/data.docker.js +++ b/e2e/data/data.docker.js @@ -40,6 +40,9 @@ const data = { groups: { private: { name: `detox-private-${ value }` + }, + alternate: { + name: `detox-alternate-${ value }` } }, teams: { diff --git a/e2e/tests/assorted/12-i18n.spec.js b/e2e/tests/assorted/12-i18n.spec.js index 13e7c79be..51273fd72 100644 --- a/e2e/tests/assorted/12-i18n.spec.js +++ b/e2e/tests/assorted/12-i18n.spec.js @@ -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', () => { diff --git a/e2e/tests/onboarding/03-forgotpassword.spec.js b/e2e/tests/onboarding/03-forgotpassword.spec.js index 8b7fe9b5a..03afe5925 100644 --- a/e2e/tests/onboarding/03-forgotpassword.spec.js +++ b/e2e/tests/onboarding/03-forgotpassword.spec.js @@ -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); diff --git a/e2e/tests/onboarding/04-createuser.spec.js b/e2e/tests/onboarding/04-createuser.spec.js index aa75807f2..cf706d78b 100644 --- a/e2e/tests/onboarding/04-createuser.spec.js +++ b/e2e/tests/onboarding/04-createuser.spec.js @@ -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(); }); diff --git a/e2e/tests/room/01-createroom.spec.js b/e2e/tests/room/01-createroom.spec.js index 5e7ae2ca5..874255e43 100644 --- a/e2e/tests/room/01-createroom.spec.js +++ b/e2e/tests/room/01-createroom.spec.js @@ -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(); }); diff --git a/e2e/tests/room/02-room.spec.js b/e2e/tests/room/02-room.spec.js index 02d874963..d6a374185 100644 --- a/e2e/tests/room/02-room.spec.js +++ b/e2e/tests/room/02-room.spec.js @@ -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); }); @@ -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); }); diff --git a/e2e/tests/room/03-roomactions.spec.js b/e2e/tests/room/03-roomactions.spec.js index 204235705..ecbac2233 100644 --- a/e2e/tests/room/03-roomactions.spec.js +++ b/e2e/tests/room/03-roomactions.spec.js @@ -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); @@ -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(); @@ -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(); @@ -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(); diff --git a/e2e/tests/room/04-discussion.spec.js b/e2e/tests/room/04-discussion.spec.js index fccc96185..aa39f2eaf 100644 --- a/e2e/tests/room/04-discussion.spec.js +++ b/e2e/tests/room/04-discussion.spec.js @@ -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(); @@ -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); diff --git a/e2e/tests/room/05-threads.spec.js b/e2e/tests/room/05-threads.spec.js index 40652df7d..381fa2b07 100644 --- a/e2e/tests/room/05-threads.spec.js +++ b/e2e/tests/room/05-threads.spec.js @@ -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); diff --git a/e2e/tests/room/07-markasunread.spec.js b/e2e/tests/room/07-markasunread.spec.js index dcbc50367..383f49a7b 100644 --- a/e2e/tests/room/07-markasunread.spec.js +++ b/e2e/tests/room/07-markasunread.spec.js @@ -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) { @@ -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(); }); diff --git a/e2e/tests/team/02-team.spec.js b/e2e/tests/team/02-team.spec.js index b10fc8206..f9b819595 100644 --- a/e2e/tests/team/02-team.spec.js +++ b/e2e/tests/team/02-team.spec.js @@ -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 });