From e6e5b05c3b6937ad60c3bdeccc629cab3b06537e Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:41:39 -0300 Subject: [PATCH] [FIX] The TS in data_setup and add expect in room and ignoreuser spec (#4658) --- e2e/data.ts | 1 + e2e/data/data.cloud.ts | 1 + e2e/data/data.docker.ts | 1 + e2e/helpers/data_setup.ts | 14 +++----------- e2e/tests/room/02-room.spec.ts | 4 +++- e2e/tests/room/10-ignoreuser.spec.ts | 4 +++- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/e2e/data.ts b/e2e/data.ts index 1db7d862f..bc5a1ae70 100644 --- a/e2e/data.ts +++ b/e2e/data.ts @@ -13,6 +13,7 @@ export type TData = typeof data; export type TDataKeys = keyof TData; export type TDataUsers = keyof typeof data.users; export type TDataChannels = keyof typeof data.channels; +export type TUserRegularChannels = keyof typeof data.userRegularChannels; export type TDataGroups = keyof typeof data.groups; export type TDataTeams = keyof typeof data.teams; diff --git a/e2e/data/data.cloud.ts b/e2e/data/data.cloud.ts index 8b55f1082..b56997085 100644 --- a/e2e/data/data.cloud.ts +++ b/e2e/data/data.cloud.ts @@ -14,6 +14,7 @@ export type TData = typeof data; export type TDataKeys = keyof TData; export type TDataUsers = keyof typeof data.users; export type TDataChannels = keyof typeof data.channels; +export type TUserRegularChannels = keyof typeof data.userRegularChannels; export type TDataGroups = keyof typeof data.groups; export type TDataTeams = keyof typeof data.teams; diff --git a/e2e/data/data.docker.ts b/e2e/data/data.docker.ts index 164be787c..ad5150d7d 100644 --- a/e2e/data/data.docker.ts +++ b/e2e/data/data.docker.ts @@ -12,6 +12,7 @@ export type TData = typeof data; export type TDataKeys = keyof TData; export type TDataUsers = keyof typeof data.users; export type TDataChannels = keyof typeof data.channels; +export type TUserRegularChannels = keyof typeof data.userRegularChannels; export type TDataGroups = keyof typeof data.groups; export type TDataTeams = keyof typeof data.teams; diff --git a/e2e/helpers/data_setup.ts b/e2e/helpers/data_setup.ts index 9a49682ab..2549d51c5 100644 --- a/e2e/helpers/data_setup.ts +++ b/e2e/helpers/data_setup.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -import data, { TDataChannels, TDataGroups, TDataTeams, TDataUsers } from '../data'; +import data, { TDataChannels, TDataGroups, TDataTeams, TDataUsers, TUserRegularChannels } from '../data'; import random from './random'; const TEAM_TYPE = { @@ -160,16 +160,8 @@ const setup = async () => { for (const channelKey in data.userRegularChannels) { if (Object.prototype.hasOwnProperty.call(data.userRegularChannels, channelKey)) { - const channel = data.userRegularChannels[channelKey as TDataChannels]; - const { - data: { - channel: { _id } - } - } = await createChannelIfNotExists(channel.name); - - if ('joinCode' in channel) { - await changeChannelJoinCode(_id, channel.joinCode); - } + const channel = data.userRegularChannels[channelKey as TUserRegularChannels]; + await createChannelIfNotExists(channel.name); } } diff --git a/e2e/tests/room/02-room.spec.ts b/e2e/tests/room/02-room.spec.ts index 39746d522..547f4600f 100644 --- a/e2e/tests/room/02-room.spec.ts +++ b/e2e/tests/room/02-room.spec.ts @@ -92,7 +92,9 @@ describe('Room screen', () => { await waitFor(element(by.id('messagebox-keyboard-emoji'))) .toExist() .withTimeout(10000); - await expect(element(by.id('emoji-picker-tab-emoji'))).toExist(); + await waitFor(element(by.id('emoji-picker-tab-emoji'))) + .toExist() + .withTimeout(10000); await element(by.id('emoji-picker-tab-emoji')).tap(); await expect(element(by.id('emoji-blush'))).toExist(); await element(by.id('emoji-blush')).tap(); diff --git a/e2e/tests/room/10-ignoreuser.spec.ts b/e2e/tests/room/10-ignoreuser.spec.ts index 264fab84a..a6c87d3a5 100644 --- a/e2e/tests/room/10-ignoreuser.spec.ts +++ b/e2e/tests/room/10-ignoreuser.spec.ts @@ -41,7 +41,9 @@ describe('Ignore/Block User', () => { await navigateToInfoView(); }); it('should block user', async () => { - await expect(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Block user')))).toExist(); + await waitFor(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Block user')))) + .toBeVisible() + .withTimeout(2000); await element(by.id('room-info-view-ignore')).tap(); await waitFor(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Unblock user')))) .toExist()