From ac827ffa07242b3f34fb58f0076f1e5479362ac4 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 22 Feb 2023 13:58:21 -0300 Subject: [PATCH] stash --- e2e/helpers/data_setup.ts | 8 ++++---- e2e/tests/assorted/04-setting.spec.ts | 8 ++++---- e2e/tests/assorted/07-changeserver.spec.ts | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/helpers/data_setup.ts b/e2e/helpers/data_setup.ts index 4d2bd2f44..82175c731 100644 --- a/e2e/helpers/data_setup.ts +++ b/e2e/helpers/data_setup.ts @@ -89,18 +89,18 @@ const createChannelIfNotExists = async (channelname: string) => { } }; -export const createRandomChannel = async (user: { username: string; password: string }) => { +export const createRandomRoom = async (user: { username: string; password: string }, type: 'p' | 'c' = 'c'): Promise => { try { await login(user.username, user.password); const room = `room${random()}`; - console.log(`Creating public channel ${room}`); - await rocketchat.post('channels.create', { + console.log(`Creating room ${room}`); + await rocketchat.post(type === 'c' ? 'channels.create' : 'groups.create', { name: room }); return room; } catch (e) { console.log(JSON.stringify(e)); - throw new Error('Failed to create public channel'); + throw new Error('Failed to create room'); } }; diff --git a/e2e/tests/assorted/04-setting.spec.ts b/e2e/tests/assorted/04-setting.spec.ts index a529b5706..5da09379f 100644 --- a/e2e/tests/assorted/04-setting.spec.ts +++ b/e2e/tests/assorted/04-setting.spec.ts @@ -1,17 +1,17 @@ import { expect } from 'detox'; import { navigateToLogin, login, platformTypes, TTextMatcher } from '../../helpers/app'; -import { createRandomChannel, createRandomUser, ICreateUser } from '../../helpers/data_setup'; +import { createRandomRoom, createRandomUser, ICreateUser } from '../../helpers/data_setup'; describe('Settings screen', () => { let alertButtonType: string; let textMatcher: TTextMatcher; let user: ICreateUser; - let channel: string; + let room: string; beforeAll(async () => { user = await createRandomUser(); - channel = await createRandomChannel(user); + room = await createRandomRoom(user); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); ({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]); await navigateToLogin(); @@ -87,7 +87,7 @@ describe('Settings screen', () => { await waitFor(element(by.id('rooms-list-view'))) .toBeVisible() .withTimeout(5000); - await waitFor(element(by.id(`rooms-list-view-item-${channel}`))) + await waitFor(element(by.id(`rooms-list-view-item-${room}`))) .toExist() .withTimeout(10000); }); diff --git a/e2e/tests/assorted/07-changeserver.spec.ts b/e2e/tests/assorted/07-changeserver.spec.ts index 771282427..614b38072 100644 --- a/e2e/tests/assorted/07-changeserver.spec.ts +++ b/e2e/tests/assorted/07-changeserver.spec.ts @@ -1,6 +1,6 @@ import data from '../../data'; import { navigateToLogin, login, checkServer, expectValidRegisterOrRetry } from '../../helpers/app'; -import { createRandomChannel, createRandomUser, ICreateUser } from '../../helpers/data_setup'; +import { createRandomRoom, createRandomUser, ICreateUser } from '../../helpers/data_setup'; const reopenAndCheckServer = async (server: string) => { await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true }); @@ -12,11 +12,11 @@ const reopenAndCheckServer = async (server: string) => { describe('Change server', () => { let user: ICreateUser; - let channel: string; + let room: string; beforeAll(async () => { user = await createRandomUser(); - channel = await createRandomChannel(user); + room = await createRandomRoom(user); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await navigateToLogin(); await login(user.username, user.password); @@ -71,7 +71,7 @@ describe('Change server', () => { await element(by.id('register-view-password')).tapReturnKey(); await expectValidRegisterOrRetry(device.getPlatform()); - await waitFor(element(by.id(`rooms-list-view-item-${channel}`))) + await waitFor(element(by.id(`rooms-list-view-item-${room}`))) .toBeNotVisible() .withTimeout(60000); await checkServer(data.alternateServer); @@ -90,7 +90,7 @@ describe('Change server', () => { await waitFor(element(by.id('rooms-list-view'))) .toBeVisible() .withTimeout(10000); - await waitFor(element(by.id(`rooms-list-view-item-${channel}`))) + await waitFor(element(by.id(`rooms-list-view-item-${room}`))) .toBeVisible() .withTimeout(60000); await checkServer(data.server);