This commit is contained in:
Diego Mello 2023-02-20 17:37:19 -03:00
parent f2c3ffa6bc
commit b4e802d4bf
3 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,7 @@ export type TUserRegularChannels = keyof typeof data.userRegularChannels;
export type TDataGroups = keyof typeof data.groups;
export type TDataTeams = keyof typeof data.teams;
// @ts-ignore
const value = globalThis.random;
const data = {
server: 'https://mobile.rocket.chat',

View File

@ -8,6 +8,7 @@ import random from './helpers/random';
module.exports = async () => {
await require('detox/runners/jest/index').globalSetup();
// @ts-ignore
globalThis.random = random(20);
await setup();
};

View File

@ -106,6 +106,7 @@ const changeChannelJoinCode = async (roomId: string, joinCode: string) => {
await rocketchat.post('method.call/saveRoomSettings', {
message: JSON.stringify({
msg: 'method',
// @ts-ignore
id: globalThis.random,
method: 'saveRoomSettings',
params: [roomId, { joinCode }]
@ -130,6 +131,7 @@ const sendMessage = async (user: { username: string; password: string }, channel
};
const setup = async () => {
// @ts-ignore
const data = new Data(globalThis.random);
await login(data.adminUser, data.adminPassword);
@ -186,6 +188,7 @@ const get = (endpoint: string) => {
};
const post = async (endpoint: string, body: any) => {
// @ts-ignore
const data = new Data(globalThis.random);
await login(data.users.regular.username, data.users.regular.password);
console.log(`POST /${endpoint} ${JSON.stringify(body)}`);