Cleaning up
This commit is contained in:
parent
158ac950ad
commit
7ba9150255
82
e2e/data.ts
82
e2e/data.ts
|
@ -11,50 +11,12 @@ export interface IUser {
|
|||
|
||||
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;
|
||||
|
||||
const value = process.env.TEST_SESSION;
|
||||
const data = {
|
||||
server: 'https://mobile.rocket.chat',
|
||||
...account,
|
||||
alternateServer: 'https://stable.rocket.chat',
|
||||
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`
|
||||
},
|
||||
encryption: {
|
||||
username: `userencryption${value}`,
|
||||
password: '123',
|
||||
email: `mobile+encryption${value}@rocket.chat`
|
||||
},
|
||||
existing: {
|
||||
username: `existinguser${value}`,
|
||||
password: '123',
|
||||
email: `mobile+existing${value}@rocket.chat`
|
||||
},
|
||||
inapp: {
|
||||
username: `inappuser${value}`,
|
||||
password: '123',
|
||||
email: `mobile+inapp${value}@rocket.chat`
|
||||
}
|
||||
},
|
||||
...account,
|
||||
channels: {
|
||||
detoxpublic: {
|
||||
name: 'detox-public'
|
||||
|
@ -64,48 +26,6 @@ const data = {
|
|||
joinCode: '123'
|
||||
}
|
||||
},
|
||||
userRegularChannels: {
|
||||
detoxpublic: {
|
||||
name: `detox-public-${value}`
|
||||
}
|
||||
},
|
||||
groups: {
|
||||
private: {
|
||||
name: `detox-private-${value}`
|
||||
},
|
||||
alternate: {
|
||||
name: `detox-alternate-${value}`
|
||||
},
|
||||
alternate2: {
|
||||
name: `detox-alternate2-${value}`
|
||||
}
|
||||
},
|
||||
teams: {
|
||||
private: {
|
||||
name: `detox-team-${value}`
|
||||
}
|
||||
},
|
||||
registeringUser: {
|
||||
username: `newuser${value}`,
|
||||
password: `password${value}`,
|
||||
email: `mobile+registering${value}@rocket.chat`
|
||||
},
|
||||
registeringUser2: {
|
||||
username: `newusertwo${value}`,
|
||||
password: `passwordtwo${value}`,
|
||||
email: `mobile+registeringtwo${value}@rocket.chat`
|
||||
},
|
||||
registeringUser3: {
|
||||
username: `newuserthree${value}`,
|
||||
password: `passwordthree${value}`,
|
||||
email: `mobile+registeringthree${value}@rocket.chat`
|
||||
},
|
||||
registeringUser4: {
|
||||
username: `newuserfour${value}`,
|
||||
password: `passwordfour${value}`,
|
||||
email: `mobile+registeringfour${value}@rocket.chat`
|
||||
},
|
||||
random: value,
|
||||
randomUser: (): { username: string; name: string; password: string; email: string } => {
|
||||
const randomVal = random();
|
||||
return {
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
/* eslint-disable import/extensions, import/no-unresolved */
|
||||
// @ts-ignore
|
||||
import random from './helpers/random';
|
||||
// @ts-ignore
|
||||
import account from './e2e_account';
|
||||
|
||||
export interface IUser {
|
||||
username: string;
|
||||
password: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
const value = random(20);
|
||||
const data = {
|
||||
server: 'https://mobile.rocket.chat',
|
||||
...account,
|
||||
alternateServer: 'https://stable.rocket.chat',
|
||||
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`
|
||||
}
|
||||
},
|
||||
channels: {
|
||||
detoxpublic: {
|
||||
name: 'detox-public'
|
||||
},
|
||||
detoxpublicprotected: {
|
||||
name: 'detox-public-protected',
|
||||
joinCode: '123'
|
||||
}
|
||||
},
|
||||
userRegularChannels: {
|
||||
detoxpublic: {
|
||||
name: `detox-public-${value}`
|
||||
}
|
||||
},
|
||||
groups: {
|
||||
private: {
|
||||
name: `detox-private-${value}`
|
||||
}
|
||||
},
|
||||
teams: {
|
||||
private: {
|
||||
name: `detox-team-${value}`
|
||||
}
|
||||
},
|
||||
registeringUser: {
|
||||
username: `newuser${value}`,
|
||||
password: `password${value}`,
|
||||
email: `mobile+registering${value}@rocket.chat`
|
||||
},
|
||||
registeringUser2: {
|
||||
username: `newusertwo${value}`,
|
||||
password: `passwordtwo${value}`,
|
||||
email: `mobile+registeringtwo${value}@rocket.chat`
|
||||
},
|
||||
registeringUser3: {
|
||||
username: `newuserthree${value}`,
|
||||
password: `passwordthree${value}`,
|
||||
email: `mobile+registeringthree${value}@rocket.chat`
|
||||
},
|
||||
registeringUser4: {
|
||||
username: `newuserfour${value}`,
|
||||
password: `passwordfour${value}`,
|
||||
email: `mobile+registeringfour${value}@rocket.chat`
|
||||
},
|
||||
random: value
|
||||
};
|
||||
|
||||
export default data;
|
|
@ -1,101 +0,0 @@
|
|||
/* eslint-disable import/extensions, import/no-unresolved */
|
||||
// @ts-ignore
|
||||
import random from './helpers/random';
|
||||
|
||||
export interface IUser {
|
||||
username: string;
|
||||
password: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
const value = random(20);
|
||||
const data = {
|
||||
server: 'http://localhost:3000',
|
||||
adminUser: 'admin',
|
||||
adminPassword: 'password',
|
||||
alternateServer: 'https://stable.rocket.chat',
|
||||
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`
|
||||
}
|
||||
},
|
||||
channels: {
|
||||
detoxpublic: {
|
||||
name: 'detox-public'
|
||||
},
|
||||
detoxpublicprotected: {
|
||||
name: 'detox-public-protected',
|
||||
joinCode: '123'
|
||||
}
|
||||
},
|
||||
userRegularChannels: {
|
||||
detoxpublic: {
|
||||
name: `detox-public-${value}`
|
||||
}
|
||||
},
|
||||
groups: {
|
||||
private: {
|
||||
name: `detox-private-${value}`
|
||||
},
|
||||
alternate: {
|
||||
name: `detox-alternate-${value}`
|
||||
},
|
||||
alternate2: {
|
||||
name: `detox-alternate2-${value}`
|
||||
}
|
||||
},
|
||||
teams: {
|
||||
private: {
|
||||
name: `detox-team-${value}`
|
||||
}
|
||||
},
|
||||
registeringUser: {
|
||||
username: `newuser${value}`,
|
||||
password: `password${value}`,
|
||||
email: `mobile+registering${value}@rocket.chat`
|
||||
},
|
||||
registeringUser2: {
|
||||
username: `newusertwo${value}`,
|
||||
password: `passwordtwo${value}`,
|
||||
email: `mobile+registeringtwo${value}@rocket.chat`
|
||||
},
|
||||
registeringUser3: {
|
||||
username: `newuserthree${value}`,
|
||||
password: `passwordthree${value}`,
|
||||
email: `mobile+registeringthree${value}@rocket.chat`
|
||||
},
|
||||
registeringUser4: {
|
||||
username: `newuserfour${value}`,
|
||||
password: `passwordfour${value}`,
|
||||
email: `mobile+registeringfour${value}@rocket.chat`
|
||||
},
|
||||
random: value
|
||||
};
|
||||
|
||||
export default data;
|
|
@ -94,38 +94,17 @@ async function logout() {
|
|||
await expect(element(by.id('new-server-view'))).toBeVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use mockRandomMessage
|
||||
*/
|
||||
async function mockMessage(message: string, isThread = false) {
|
||||
const deviceType = device.getPlatform();
|
||||
const { textMatcher } = platformTypes[deviceType];
|
||||
const input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
|
||||
await element(by.id(input)).replaceText(`${data.random}${message}`);
|
||||
await sleep(300);
|
||||
await element(by.id('messagebox-send-message')).tap();
|
||||
await waitFor(element(by[textMatcher](`${data.random}${message}`)))
|
||||
.toExist()
|
||||
.withTimeout(60000);
|
||||
await element(by[textMatcher](`${data.random}${message}`))
|
||||
.atIndex(0)
|
||||
.tap();
|
||||
}
|
||||
|
||||
async function mockRandomMessage(message: string, isThread = false) {
|
||||
const matchMessage = async () => {
|
||||
await waitFor(element(by[textMatcher](message)))
|
||||
.toExist()
|
||||
.withTimeout(60000);
|
||||
await element(by[textMatcher](message)).atIndex(0).tap();
|
||||
};
|
||||
const deviceType = device.getPlatform();
|
||||
const { textMatcher } = platformTypes[deviceType];
|
||||
const input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
|
||||
await element(by.id(input)).replaceText(message);
|
||||
await sleep(300);
|
||||
await element(by.id('messagebox-send-message')).tap();
|
||||
await matchMessage();
|
||||
await waitFor(element(by[textMatcher](message)))
|
||||
.toExist()
|
||||
.withTimeout(60000);
|
||||
await element(by[textMatcher](message)).atIndex(0).tap();
|
||||
return message;
|
||||
}
|
||||
|
||||
|
@ -255,7 +234,6 @@ export {
|
|||
navigateToRegister,
|
||||
login,
|
||||
logout,
|
||||
mockMessage,
|
||||
mockRandomMessage,
|
||||
tapBack,
|
||||
sleep,
|
||||
|
|
|
@ -131,7 +131,7 @@ export const get = (endpoint: string) => {
|
|||
return rocketchat.get(endpoint);
|
||||
};
|
||||
|
||||
export const post = async (endpoint: string, body: any, user = data.users.regular) => {
|
||||
export const post = async (endpoint: string, body: any, user: ITestUser) => {
|
||||
await login(user.username, user.password);
|
||||
console.log(`POST /${endpoint} ${JSON.stringify(body)}`);
|
||||
return rocketchat.post(endpoint, body);
|
||||
|
|
Loading…
Reference in New Issue