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 TDataGroups = keyof typeof data.groups;
|
||||||
export type TDataTeams = keyof typeof data.teams;
|
export type TDataTeams = keyof typeof data.teams;
|
||||||
|
|
||||||
// @ts-ignore
|
const value = process.env.TEST_SESSION;
|
||||||
const value = globalThis.random;
|
|
||||||
const data = {
|
const data = {
|
||||||
server: 'https://mobile.rocket.chat',
|
server: 'https://mobile.rocket.chat',
|
||||||
...account,
|
...account,
|
||||||
|
@ -97,100 +96,4 @@ const data = {
|
||||||
random: value
|
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;
|
export default data;
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
import { setup } from './helpers/data_setup';
|
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 () => {
|
module.exports = async () => {
|
||||||
await require('detox/runners/jest/index').globalSetup();
|
await require('detox/runners/jest/index').globalSetup();
|
||||||
// @ts-ignore
|
|
||||||
globalThis.random = random(20);
|
|
||||||
await setup();
|
await setup();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import axios from 'axios';
|
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 = {
|
const TEAM_TYPE = {
|
||||||
PUBLIC: 0,
|
PUBLIC: 0,
|
||||||
|
@ -106,8 +106,7 @@ const changeChannelJoinCode = async (roomId: string, joinCode: string) => {
|
||||||
await rocketchat.post('method.call/saveRoomSettings', {
|
await rocketchat.post('method.call/saveRoomSettings', {
|
||||||
message: JSON.stringify({
|
message: JSON.stringify({
|
||||||
msg: 'method',
|
msg: 'method',
|
||||||
// @ts-ignore
|
id: process.env.TEST_SESSION,
|
||||||
id: globalThis.random,
|
|
||||||
method: 'saveRoomSettings',
|
method: 'saveRoomSettings',
|
||||||
params: [roomId, { joinCode }]
|
params: [roomId, { joinCode }]
|
||||||
})
|
})
|
||||||
|
@ -131,9 +130,6 @@ const sendMessage = async (user: { username: string; password: string }, channel
|
||||||
};
|
};
|
||||||
|
|
||||||
const setup = async () => {
|
const setup = async () => {
|
||||||
// @ts-ignore
|
|
||||||
const data = new Data(globalThis.random);
|
|
||||||
|
|
||||||
await login(data.adminUser, data.adminPassword);
|
await login(data.adminUser, data.adminPassword);
|
||||||
|
|
||||||
for (const userKey in data.users) {
|
for (const userKey in data.users) {
|
||||||
|
@ -188,8 +184,6 @@ const get = (endpoint: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const post = async (endpoint: string, body: any) => {
|
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);
|
await login(data.users.regular.username, data.users.regular.password);
|
||||||
console.log(`POST /${endpoint} ${JSON.stringify(body)}`);
|
console.log(`POST /${endpoint} ${JSON.stringify(body)}`);
|
||||||
return rocketchat.post(endpoint, body);
|
return rocketchat.post(endpoint, body);
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
testSequencer: '<rootDir>/e2e/testSequencer.js',
|
testSequencer: '<rootDir>/e2e/testSequencer.js',
|
||||||
testMatch: ['<rootDir>/e2e/tests/**/*.spec.ts'],
|
testMatch: ['<rootDir>/e2e/tests/**/*.spec.ts'],
|
||||||
testTimeout: 120000,
|
testTimeout: 120000,
|
||||||
maxWorkers: 1,
|
maxWorkers: 2,
|
||||||
globalSetup: '<rootDir>/e2e/globalSetup.ts',
|
globalSetup: '<rootDir>/e2e/globalSetup.ts',
|
||||||
globalTeardown: 'detox/runners/jest/globalTeardown',
|
globalTeardown: 'detox/runners/jest/globalTeardown',
|
||||||
reporters: ['detox/runners/jest/reporter'],
|
reporters: ['detox/runners/jest/reporter'],
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"e2e:ios-build": "yarn detox build -c ios.sim.release",
|
"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-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-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": {
|
"lint-staged": {
|
||||||
"*.{js,ts,tsx}": [
|
"*.{js,ts,tsx}": [
|
||||||
|
|
Loading…
Reference in New Issue