fix: flaky test at auto-translate e2e test (#5219)
* minor tweak at auto-translate e2e test * remove createRandomRoom --------- Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
parent
98abd97618
commit
1abafad2b8
|
@ -1,7 +1,7 @@
|
|||
import { by, device, element, expect, waitFor } from 'detox';
|
||||
|
||||
import { TTextMatcher, login, navigateToLogin, platformTypes, searchRoom, sleep, tapBack, tryTapping } from '../../helpers/app';
|
||||
import { ITestUser, createRandomRoom, createRandomUser, initApi } from '../../helpers/data_setup';
|
||||
import { ITestUser, createRandomUser, initApi } from '../../helpers/data_setup';
|
||||
import random from '../../helpers/random';
|
||||
|
||||
const roomId = '64b846e4760e618aa9f91ab7';
|
||||
|
@ -90,8 +90,8 @@ describe('Auto Translate', () => {
|
|||
};
|
||||
|
||||
const newMessage = {
|
||||
[languages.default]: 'cat',
|
||||
[languages.translated]: 'gato'
|
||||
[languages.default]: 'Cat',
|
||||
[languages.translated]: 'Gato'
|
||||
};
|
||||
|
||||
const attachmentMessage = {
|
||||
|
@ -101,7 +101,6 @@ describe('Auto Translate', () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
const user = await createRandomUser();
|
||||
await createRandomRoom(user);
|
||||
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||
({ textMatcher } = platformTypes[device.getPlatform()]);
|
||||
await navigateToLogin();
|
||||
|
@ -171,18 +170,18 @@ describe('Auto Translate', () => {
|
|||
|
||||
it('should see new message translated', async () => {
|
||||
const randomMatcher = random();
|
||||
const data = await sendMessageOnTranslationTestRoom(`${newMessage[languages.default]} - ${randomMatcher}`);
|
||||
await searchMessage(`${newMessage[languages.default]} - ${randomMatcher}`, textMatcher); // will scroll the messages list to the last one
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.translated]} - ${randomMatcher}`, textMatcher);
|
||||
const data = await sendMessageOnTranslationTestRoom(`${newMessage[languages.default]}. Rc${randomMatcher}`);
|
||||
await searchMessage(`${newMessage[languages.default]}. Rc${randomMatcher}`, textMatcher); // will scroll the messages list to the last one
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.translated]}. Rc${randomMatcher}`, textMatcher);
|
||||
await deleteMessageOnTranslationTestRoom(data);
|
||||
});
|
||||
|
||||
it('should see original message', async () => {
|
||||
const randomMatcher = random();
|
||||
const data = await sendMessageOnTranslationTestRoom(`${newMessage[languages.default]} - ${randomMatcher}`);
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.translated]} - ${randomMatcher}`, textMatcher);
|
||||
const data = await sendMessageOnTranslationTestRoom(`${newMessage[languages.default]}. Rc${randomMatcher}`);
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.translated]}. Rc${randomMatcher}`, textMatcher);
|
||||
|
||||
await tryTapping(element(by[textMatcher](`${newMessage[languages.translated]} - ${randomMatcher}`)).atIndex(0), 2000, true);
|
||||
await tryTapping(element(by[textMatcher](`${newMessage[languages.translated]}. Rc${randomMatcher}`)).atIndex(0), 2000, true);
|
||||
|
||||
await waitForVisible('action-sheet-handle');
|
||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||
|
@ -190,16 +189,16 @@ describe('Auto Translate', () => {
|
|||
await waitForVisibleTextMatcher('View original', textMatcher);
|
||||
await element(by[textMatcher]('View original')).atIndex(0).tap();
|
||||
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.default]} - ${randomMatcher}`, textMatcher);
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.default]}. Rc${randomMatcher}`, textMatcher);
|
||||
|
||||
await deleteMessageOnTranslationTestRoom(data);
|
||||
});
|
||||
|
||||
it('disable auto translate and see original message', async () => {
|
||||
const randomMatcher = random();
|
||||
const data = await sendMessageOnTranslationTestRoom(`${newMessage[languages.default]} - ${randomMatcher}`);
|
||||
const data = await sendMessageOnTranslationTestRoom(`${newMessage[languages.default]}. Rc${randomMatcher}`);
|
||||
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.translated]} - ${randomMatcher}`, textMatcher);
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.translated]}. Rc${randomMatcher}`, textMatcher);
|
||||
|
||||
await element(by.id('room-header')).tap();
|
||||
await waitForVisible('room-actions-view');
|
||||
|
@ -214,7 +213,7 @@ describe('Auto Translate', () => {
|
|||
await tapBack();
|
||||
await tapBack();
|
||||
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.default]} - ${randomMatcher}`, textMatcher);
|
||||
await waitForVisibleTextMatcher(`${newMessage[languages.default]}. Rc${randomMatcher}`, textMatcher);
|
||||
|
||||
await deleteMessageOnTranslationTestRoom(data);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue