TEST_SESSION env and retries
This commit is contained in:
parent
f01b62e70e
commit
607cf4a6e3
99
e2e/data.ts
99
e2e/data.ts
|
@ -15,8 +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 value = process.env.TEST_SESSION;
|
||||
const data = {
|
||||
server: 'https://mobile.rocket.chat',
|
||||
...account,
|
||||
|
@ -97,100 +96,4 @@ const data = {
|
|||
random: value
|
||||
};
|
||||
|
||||
// FIXME: awkward TEMP workaround :(
|
||||
class Data {
|
||||
adminUser!: string;
|
||||
adminPassword!: string;
|
||||
server: string;
|
||||
alternateServer: string;
|
||||
users: any;
|
||||
channels: any;
|
||||
userRegularChannels: any;
|
||||
groups: any;
|
||||
teams: any;
|
||||
registeringUser: any;
|
||||
random: string;
|
||||
constructor(random: string) {
|
||||
const value = random;
|
||||
Object.assign(this, account);
|
||||
this.server = 'https://mobile.rocket.chat';
|
||||
this.alternateServer = 'https://stable.rocket.chat';
|
||||
this.users = {
|
||||
regular: {
|
||||
username: `userone${value}`,
|
||||
password: '123',
|
||||
email: `mobile+regular${value}@rocket.chat`
|
||||
},
|
||||
alternate: {
|
||||
username: `usertwo${value}`,
|
||||
password: '123',
|
||||
email: `mobile+alternate${value}@rocket.chat`,
|
||||
totpSecret: 'NA4GOMZGHBQSK6KEFRVT62DMGJJGSYZJFZIHO3ZOGVXWCYZ6MMZQ'
|
||||
},
|
||||
profileChanges: {
|
||||
username: `userthree${value}`,
|
||||
password: '123',
|
||||
email: `mobile+profileChanges${value}@rocket.chat`
|
||||
},
|
||||
existing: {
|
||||
username: `existinguser${value}`,
|
||||
password: '123',
|
||||
email: `mobile+existing${value}@rocket.chat`
|
||||
}
|
||||
};
|
||||
this.channels = {
|
||||
detoxpublic: {
|
||||
name: 'detox-public'
|
||||
},
|
||||
detoxpublicprotected: {
|
||||
name: 'detox-public-protected',
|
||||
joinCode: '123'
|
||||
}
|
||||
};
|
||||
this.userRegularChannels = {
|
||||
detoxpublic: {
|
||||
name: `detox-public-${value}`
|
||||
}
|
||||
};
|
||||
this.groups = {
|
||||
private: {
|
||||
name: `detox-private-${value}`
|
||||
},
|
||||
alternate: {
|
||||
name: `detox-alternate-${value}`
|
||||
},
|
||||
alternate2: {
|
||||
name: `detox-alternate2-${value}`
|
||||
}
|
||||
};
|
||||
this.teams = {
|
||||
private: {
|
||||
name: `detox-team-${value}`
|
||||
}
|
||||
};
|
||||
this.registeringUser = {
|
||||
username: `newuser${value}`,
|
||||
password: `password${value}`,
|
||||
email: `mobile+registering${value}@rocket.chat`
|
||||
};
|
||||
this.registeringUser = {
|
||||
username: `newusertwo${value}`,
|
||||
password: `passwordtwo${value}`,
|
||||
email: `mobile+registeringtwo${value}@rocket.chat`
|
||||
};
|
||||
this.registeringUser = {
|
||||
username: `newuserthree${value}`,
|
||||
password: `passwordthree${value}`,
|
||||
email: `mobile+registeringthree${value}@rocket.chat`
|
||||
};
|
||||
this.registeringUser = {
|
||||
username: `newuserfour${value}`,
|
||||
password: `passwordfour${value}`,
|
||||
email: `mobile+registeringfour${value}@rocket.chat`
|
||||
};
|
||||
this.random = value;
|
||||
}
|
||||
}
|
||||
|
||||
export { Data };
|
||||
export default data;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
import { setup } from './helpers/data_setup';
|
||||
import random from './helpers/random';
|
||||
|
||||
// declare global {
|
||||
// // eslint-disable-next-line no-var
|
||||
// var random: string;
|
||||
// }
|
||||
|
||||
module.exports = async () => {
|
||||
await require('detox/runners/jest/index').globalSetup();
|
||||
// @ts-ignore
|
||||
globalThis.random = random(20);
|
||||
await setup();
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import axios from 'axios';
|
||||
|
||||
import data, { Data, TDataChannels, TDataGroups, TDataTeams, TDataUsers, TUserRegularChannels } from '../data';
|
||||
import data, { TDataChannels, TDataGroups, TDataTeams, TDataUsers, TUserRegularChannels } from '../data';
|
||||
|
||||
const TEAM_TYPE = {
|
||||
PUBLIC: 0,
|
||||
|
@ -106,8 +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,
|
||||
id: process.env.TEST_SESSION,
|
||||
method: 'saveRoomSettings',
|
||||
params: [roomId, { joinCode }]
|
||||
})
|
||||
|
@ -131,9 +130,6 @@ 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);
|
||||
|
||||
for (const userKey in data.users) {
|
||||
|
@ -188,8 +184,6 @@ 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)}`);
|
||||
return rocketchat.post(endpoint, body);
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
testSequencer: '<rootDir>/e2e/testSequencer.js',
|
||||
testMatch: ['<rootDir>/e2e/tests/**/*.spec.ts'],
|
||||
testTimeout: 120000,
|
||||
maxWorkers: 1,
|
||||
maxWorkers: 2,
|
||||
globalSetup: '<rootDir>/e2e/globalSetup.ts',
|
||||
globalTeardown: 'detox/runners/jest/globalTeardown',
|
||||
reporters: ['detox/runners/jest/reporter'],
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"e2e:ios-build": "yarn detox build -c ios.sim.release",
|
||||
"e2e:ios-test": "yarn detox test -c ios.sim.release --cleanup --headless --take-screenshots failing",
|
||||
"e2e:ios-build-debug": "yarn detox build -c ios.sim.debug",
|
||||
"e2e:ios-test-debug": "yarn detox test -c ios.sim.debug --take-screenshots failing"
|
||||
"e2e:ios-test-debug": "TEST_SESSION=`openssl rand -hex 10` yarn detox test -c ios.sim.debug --take-screenshots failing -R"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx}": [
|
||||
|
|
Loading…
Reference in New Issue