-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
120 changed files
with
3,633 additions
and
3,368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/node_modules/ | ||
#/tests/e2e/ | ||
/tests/data/ | ||
/packages/ | ||
/app/emoji-emojione/generateEmojiIndex.js | ||
/public/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
'use strict'; | ||
|
||
/** | ||
/* | ||
* Mocha configuration for REST API integration tests. | ||
*/ | ||
|
||
module.exports = { | ||
module.exports = /** @satisfies {import('mocha').MochaOptions} */ ({ | ||
...require('./.mocharc.base.json'), // see https://github.com/mochajs/mocha/issues/3916 | ||
timeout: 10000, | ||
bail: true, | ||
file: 'tests/end-to-end/teardown.js', | ||
retries: 0, | ||
file: 'tests/end-to-end/teardown.ts', | ||
spec: ['tests/end-to-end/api/**/*', 'tests/end-to-end/apps/*'], | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import type { Credentials } from '@rocket.chat/api-client'; | ||
import type { Path } from '@rocket.chat/rest-typings'; | ||
import type { CallbackHandler, Response } from 'supertest'; | ||
import supertest from 'supertest'; | ||
|
||
import { adminUsername, adminPassword } from './user'; | ||
|
||
const apiUrl = process.env.TEST_API_URL || 'http://localhost:3000'; | ||
|
||
export const request = supertest(apiUrl); | ||
const prefix = '/api/v1/'; | ||
|
||
export function wait(cb: () => void, time: number) { | ||
return () => setTimeout(cb, time); | ||
} | ||
|
||
const privateChannelName = `private-channel-test-${Date.now()}` as const; | ||
|
||
const username = 'user.test'; | ||
const email = `${username}@rocket.chat`; | ||
|
||
export const apiUsername = `api${username}-${Date.now()}` as const; | ||
export const apiEmail = `api${email}-${Date.now()}` as const; | ||
export const apiPrivateChannelName = `api${privateChannelName}-${Date.now()}` as const; | ||
|
||
const roleNameUsers = `role-name-test-users-${Date.now()}` as const; | ||
const roleNameSubscriptions = `role-name-test-subscriptions-${Date.now()}` as const; | ||
const roleScopeUsers = 'Users' as const; | ||
const roleScopeSubscriptions = 'Subscriptions' as const; | ||
const roleDescription = `role-description-test-${Date.now()}` as const; | ||
|
||
export const apiRoleNameUsers = `api${roleNameUsers}` as const; | ||
export const apiRoleNameSubscriptions = `api${roleNameSubscriptions}` as const; | ||
export const apiRoleScopeUsers = `${roleScopeUsers}` as const; | ||
export const apiRoleScopeSubscriptions = `${roleScopeSubscriptions}` as const; | ||
export const apiRoleDescription = `api${roleDescription}` as const; | ||
export const reservedWords = ['admin', 'administrator', 'system', 'user'] as const; | ||
|
||
export const credentials: Credentials = { | ||
'X-Auth-Token': undefined, | ||
'X-User-Id': undefined, | ||
} as unknown as Credentials; // FIXME | ||
|
||
type PathWithoutPrefix<TPath> = TPath extends `/v1/${infer U}` ? U : never; | ||
|
||
export function api<TPath extends PathWithoutPrefix<Path>>(path: TPath) { | ||
return `${prefix}${path}` as const; | ||
} | ||
|
||
export function methodCall<TMethodName extends string>(methodName: TMethodName) { | ||
return api(`method.call/${methodName}`); | ||
} | ||
|
||
export function log(res: Response) { | ||
console.log((res as { req?: any }).req.path); // FIXME | ||
console.log({ | ||
body: res.body, | ||
headers: res.headers, | ||
}); | ||
} | ||
|
||
export function getCredentials(done?: CallbackHandler) { | ||
void request | ||
.post(api('login')) | ||
.send({ | ||
user: adminUsername, | ||
password: adminPassword, | ||
}) | ||
.expect('Content-Type', 'application/json') | ||
.expect(200) | ||
.expect((res) => { | ||
credentials['X-Auth-Token'] = res.body.data.authToken; | ||
credentials['X-User-Id'] = res.body.data.userId; | ||
}) | ||
.end(done); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { Path } from '@rocket.chat/rest-typings'; | ||
|
||
export const APP_URL = 'https://github.com/RocketChat/Apps.RocketChat.Tester/blob/master/dist/appsrocketchattester_0.0.5.zip?raw=true'; | ||
export const APP_NAME = 'Apps.RocketChat.Tester'; | ||
|
||
type PathWithoutPrefix<TPath> = TPath extends `/apps${infer U}` ? U : never; | ||
|
||
export function apps(path?: ''): `/api/apps`; | ||
export function apps<TPath extends PathWithoutPrefix<Path>>(path: TPath): `/api/apps${TPath}`; | ||
export function apps(path = '') { | ||
return `/api/apps${path}` as const; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export const CI_MAX_ROOMS_PER_GUEST = 10; | ||
export const MAX_BIO_LENGTH = 260; | ||
export const MAX_NICKNAME_LENGTH = 120; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
export const targetUser = 'rocket.cat'; | ||
export const imgURL = './public/images/logo/1024x1024.png'; | ||
export const lstURL = './tests/e2e/fixtures/files/lst-test.lst'; | ||
export const drawioURL = './tests/e2e/fixtures/files/diagram.drawio'; | ||
export const svgLogoURL = './public/images/logo/logo.svg'; | ||
export const svgLogoFileName = 'logo.svg'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.