diff --git a/package-lock.json b/package-lock.json index 16889359948..158afe33817 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,6 +135,7 @@ "@types/dom-screen-wake-lock": "1.0.1", "@types/jasmine": "5.1.4", "@types/js-md5": "0.4.3", + "@types/jsonwebtoken": "9.0.7", "@types/lodash-es": "4.17.12", "@types/moment-duration-format": "2.2.6", "@types/offscreencanvas": "2019.7.2", @@ -172,6 +173,7 @@ "eslint-plugin-react-native": "4.0.0", "eslint-plugin-typescript-sort-keys": "2.3.0", "jetifier": "1.6.4", + "jsonwebtoken": "9.0.2", "metro-react-native-babel-preset": "0.77.0", "patch-package": "6.4.7", "process": "0.11.10", @@ -7122,6 +7124,15 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.7.tgz", + "integrity": "sha512-ugo316mmTYBl2g81zDFnZ7cfxlut3o+/EQdaP7J8QN2kY6lJ22hmQYCK5EHcJHbrW+dkCGSCPgbG8JtYj6qSrg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/lodash": { "version": "4.14.182", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz", @@ -9899,6 +9910,12 @@ "node": ">=8.0.0" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -11395,6 +11412,15 @@ "resolved": "https://registry.npmjs.org/ebml-block/-/ebml-block-1.1.2.tgz", "integrity": "sha512-HgNlIsRFP6D9VKU5atCeHRJY7XkJP8bOe8yEhd8NB7B3b4++VWTyauz6g650iiPmLfPLGlVpoJmGSgMfXDYusg==" }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/edge-paths": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-3.0.5.tgz", @@ -15961,6 +15987,28 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dev": true, + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, "node_modules/jsx-ast-utils": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.1.tgz", @@ -16030,6 +16078,27 @@ "node": ">=16" } }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/jwt-decode": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz", @@ -16555,12 +16624,42 @@ "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", "dev": true }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "dev": true + }, "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", "dev": true }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "dev": true + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, "node_modules/lodash.isstring": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", @@ -16572,6 +16671,12 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true + }, "node_modules/lodash.pickby": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz", @@ -29047,6 +29152,15 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "@types/jsonwebtoken": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.7.tgz", + "integrity": "sha512-ugo316mmTYBl2g81zDFnZ7cfxlut3o+/EQdaP7J8QN2kY6lJ22hmQYCK5EHcJHbrW+dkCGSCPgbG8JtYj6qSrg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/lodash": { "version": "4.14.182", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz", @@ -31141,6 +31255,12 @@ "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", "dev": true }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true + }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -32222,6 +32342,15 @@ "resolved": "https://registry.npmjs.org/ebml-block/-/ebml-block-1.1.2.tgz", "integrity": "sha512-HgNlIsRFP6D9VKU5atCeHRJY7XkJP8bOe8yEhd8NB7B3b4++VWTyauz6g650iiPmLfPLGlVpoJmGSgMfXDYusg==" }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, "edge-paths": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-3.0.5.tgz", @@ -35504,6 +35633,24 @@ "graceful-fs": "^4.1.6" } }, + "jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dev": true, + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + } + }, "jsx-ast-utils": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.1.tgz", @@ -35569,6 +35716,27 @@ "xmlbuilder": "^15.1.1" } }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "jwt-decode": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz", @@ -35987,12 +36155,42 @@ "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", "dev": true }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "dev": true + }, "lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", "dev": true }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "dev": true + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, "lodash.isstring": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", @@ -36004,6 +36202,12 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true + }, "lodash.pickby": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz", diff --git a/package.json b/package.json index 34e85498a18..5c292edb8fe 100644 --- a/package.json +++ b/package.json @@ -141,6 +141,7 @@ "@types/dom-screen-wake-lock": "1.0.1", "@types/jasmine": "5.1.4", "@types/js-md5": "0.4.3", + "@types/jsonwebtoken": "9.0.7", "@types/lodash-es": "4.17.12", "@types/moment-duration-format": "2.2.6", "@types/offscreencanvas": "2019.7.2", @@ -178,6 +179,7 @@ "eslint-plugin-react-native": "4.0.0", "eslint-plugin-typescript-sort-keys": "2.3.0", "jetifier": "1.6.4", + "jsonwebtoken": "9.0.2", "metro-react-native-babel-preset": "0.77.0", "patch-package": "6.4.7", "process": "0.11.10", diff --git a/tests/env.example b/tests/env.example index 4cc1bee4b4f..49c16618cd9 100644 --- a/tests/env.example +++ b/tests/env.example @@ -19,3 +19,8 @@ # The grid host url (https://mygrid.com/wd/hub) #GRID_HOST_URL= + +# The path to the private key used for generating JWT token (.pk) +#JWT_PRIVATE_KEY_PATH= +# The kid to use in the token +#JWT_KID= diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.ts index 25c8ba750ba..d527578d8fa 100644 --- a/tests/helpers/Participant.ts +++ b/tests/helpers/Participant.ts @@ -24,6 +24,7 @@ export class Participant { */ private _name: string; private _endpointId: string; + private _jwt?: string; /** * The default config to use when joining. @@ -61,9 +62,11 @@ export class Participant { * Creates a participant with given name. * * @param {string} name - The name of the participant. + * @param {string }jwt - The jwt if any. */ - constructor(name: string) { + constructor(name: string, jwt?: string) { this._name = name; + this._jwt = jwt; } /** @@ -141,6 +144,9 @@ export class Participant { url = `${url}&tenant="${baseUrl.pathname.substring(1)}"`; } } + if (this._jwt) { + url = `${url}&jwt="${this._jwt}"`; + } await this.driver.setTimeout({ 'pageLoad': 30000 }); diff --git a/tests/helpers/participants.ts b/tests/helpers/participants.ts index 5f3b996b972..81207343e16 100644 --- a/tests/helpers/participants.ts +++ b/tests/helpers/participants.ts @@ -1,3 +1,7 @@ +import fs from 'fs'; +import jwt from 'jsonwebtoken'; +import { v4 as uuidv4 } from 'uuid'; + import { Participant } from './Participant'; import { IContext } from './types'; @@ -66,13 +70,18 @@ export async function ensureTwoParticipants(context: IContext): Promise { context.roomName = generateRandomRoomName(); } - // TODO + const p1DisplayName = 'participant1'; + let token; + // if it is jaas create the first one to be moderator and second not moderator + if (context.jwtPrivateKeyPath) { + token = getModeratorToken(p1DisplayName); + } // make sure the first participant is moderator, if supported by deployment - await _joinParticipant('participant1', context.p1, p => { + await _joinParticipant(p1DisplayName, context.p1, p => { context.p1 = p; - }, true); + }, true, token); await Promise.all([ _joinParticipant('participant2', context.p2, p => { @@ -89,11 +98,14 @@ export async function ensureTwoParticipants(context: IContext): Promise { * @param p - The participant instance to prepare or undefined if new one is needed. * @param setter - The setter to use for setting the new participant instance into the context if needed. * @param {boolean} skipInMeetingChecks - Whether to skip in meeting checks. + * @param {string?} jwtToken - The token to use if any. */ -async function _joinParticipant( - name: string, p: Participant, +async function _joinParticipant( // eslint-disable-line max-params + name: string, + p: Participant, setter: (p: Participant) => void, - skipInMeetingChecks = false) { + skipInMeetingChecks = false, + jwtToken?: string) { if (p) { await p.switchInPage(); @@ -107,11 +119,12 @@ async function _joinParticipant( // Change the page so we can reload same url if we need to, base.html is supposed to be empty or close to empty await p.driver.url('/base.html'); - // we want the participant instance re-recreated so we clear and kept state, like endpoint ID + // we want the participant instance re-recreated so we clear any kept state, like endpoint ID } - const newParticipant = new Participant(name); + const newParticipant = new Participant(name, jwtToken); + // set the new participant instance, pass it to setter setter(newParticipant); return newParticipant.joinConference(context, skipInMeetingChecks); @@ -152,3 +165,43 @@ export function parseJid(str: string): { resource: domainParts.length > 0 ? domainParts[1] : undefined }; } + +/** + * Get a JWT token for a moderator. + */ +function getModeratorToken(displayName: string) { + const keyid = process.env.JWT_KID; + const headers = { + algorithm: 'RS256', + noTimestamp: true, + expiresIn: '24h', + keyid + }; + + if (!keyid) { + console.error('JWT_KID is not set'); + + return; + } + + const key = fs.readFileSync(context.jwtPrivateKeyPath); + + const payload = { + 'aud': 'jitsi', + 'iss': 'chat', + 'sub': keyid.substring(0, keyid.indexOf('/')), + 'context': { + 'user': { + 'name': displayName, + 'id': uuidv4(), + 'avatar': 'https://avatars0.githubusercontent.com/u/3671647', + 'email': 'john.doe@jitsi.org' + } + }, + 'room': '*' + }; + + payload.context.user.moderator = true; + + return jwt.sign(payload, key, headers); +} diff --git a/tests/helpers/types.ts b/tests/helpers/types.ts index 7e70664fd4c..68bbdb0150b 100644 --- a/tests/helpers/types.ts +++ b/tests/helpers/types.ts @@ -2,6 +2,8 @@ import type { Participant } from './Participant'; export type IContext = { iframeAPI: boolean; + jwtKid: string; + jwtPrivateKeyPath: string; p1: Participant; p2: Participant; p3: Participant; diff --git a/tests/specs/2way/participantsPresence.spec.ts b/tests/specs/2way/participantsPresence.spec.ts index 4024e304e08..2269fc57be2 100644 --- a/tests/specs/2way/participantsPresence.spec.ts +++ b/tests/specs/2way/participantsPresence.spec.ts @@ -21,8 +21,12 @@ describe('Participants presence - ', () => { await p1.switchToAPI(); await p2.switchToAPI(); - expect(await p1.getIframeAPI().getEventResult('isModerator')).toBe(true); - expect(await p2.getIframeAPI().getEventResult('isModerator')).toBe(false); + expect(await p1.getIframeAPI().getEventResult('isModerator')) + .withContext('Is p1 moderator') + .toBeTrue(); + expect(await p2.getIframeAPI().getEventResult('isModerator')) + .withContext('Is p2 non-moderator') + .toBeFalse(); // ROLE_CHANGED @@ -91,10 +95,15 @@ describe('Participants presence - ', () => { timeoutMsg: 'Moderator role not granted' }); - const event = await p1.getIframeAPI().getEventResult('participantRoleChanged'); + const event1 = await p1.getIframeAPI().getEventResult('participantRoleChanged'); - expect(event?.id).toBe(p2EpId); - expect(event?.role).toBe('moderator'); + expect(event1?.id).toBe(p2EpId); + expect(event1?.role).toBe('moderator'); + + const event2 = await p2.getIframeAPI().getEventResult('participantRoleChanged'); + + expect(event2?.id).toBe(p2EpId); + expect(event2?.role).toBe('moderator'); // ROLE_CHANGED }); diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.ts index 0f31d3c16f0..ae04a784c74 100644 --- a/tests/wdio.conf.ts +++ b/tests/wdio.conf.ts @@ -184,6 +184,9 @@ export const config: WebdriverIO.MultiremoteConfig = { const globalAny: any = global; globalAny.context = {} as IContext; + + globalAny.context.jwtPrivateKeyPath = process.env.JWT_PRIVATE_KEY_PATH; + globalAny.context.jwtKid = process.env.JWT_KID; }, /**