[TEST] Fixed E2E tests (#3201)

* [FIX] Test E2E i18n

* 01-createroom and 02-room fixed

* 03-roomactions and 04-discussions

* 05-threads and 07-markasunread from room

* Test 07-markasunread

* Set notifications 'YES' and delete true in 03-forgotpassword and 04-createuser

* Fixed the data that 02-team uses and changed the message in 07-markasunread

* Added group.alternate to data.docker and commented the test for the fallback language

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Reinaldo Neto 2021-06-11 15:23:43 -03:00 committed by GitHub
parent 3177bc3e58
commit c744672cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 39 additions and 33 deletions

View File

@ -40,6 +40,9 @@ const data = {
groups: {
private: {
name: `detox-private-${ value }`
},
alternate: {
name: `detox-alternate-${ value }`
}
},
teams: {

View File

@ -40,6 +40,9 @@ const data = {
groups: {
private: {
name: `detox-private-${ value }`
},
alternate: {
name: `detox-alternate-${ value }`
}
},
teams: {

View File

@ -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', () => {

View File

@ -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);

View File

@ -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();
});

View File

@ -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();
});

View File

@ -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);
});

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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();
});

View File

@ -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 });