Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(tests): Use more predictable room names. (#15998)
Дамян Минковcf63dcb8f486
diff --git a/tests/env.example b/tests/env.exampleindex c42b040387..a58d8f3f56 100644--- a/tests/env.example+++ b/tests/env.example@@ -3,7 +3,10 @@#BASE_URL=# Room name suffix to use when creating new room names-# ROOM_NAME_SUFFIX=+#ROOM_NAME_SUFFIX=++# Room name prefix to use when creating new room names+#ROOM_NAME_PREFIX=# To be able to match a domain to a specific address# The format is "MAP example.com 1.2.3.4"diff --git a/tests/helpers/utils.ts b/tests/helpers/utils.tsnew file mode 100644index 0000000000..bba5882356--- /dev/null+++ b/tests/helpers/utils.ts@@ -0,0 +1,12 @@+/**+ * Generates a random number between 1 and the specified maximum value (inclusive).+ *+ * @param {number} max - The maximum value for the random number (must be a positive integer).+ * @param numberOfDigits - The number of digits to pad the random number with leading zeros.+ * @return {string} The random number formatted with leading zeros if needed.+ */+export function getRandomNumberAsStr(max: number, numberOfDigits: number): string {+ const randomNumber = Math.floor(Math.random() * max) + 1;++ return randomNumber.toString().padStart(numberOfDigits, '0');+}diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.tsindex 8e9f1d0ce9..d7b93735a8 100644--- a/tests/wdio.conf.ts+++ b/tests/wdio.conf.ts@@ -9,6 +9,7 @@ import pretty from 'pretty';import WebhookProxy from './helpers/WebhookProxy';import { getLogs, initLogger, logInfo } from './helpers/browserLogger';import { IContext } from './helpers/types';+import { getRandomNumberAsStr } from './helpers/utils';// eslint-disable-next-line @typescript-eslint/no-var-requiresconst allure = require('allure-commandline');@@ -213,11 +214,15 @@ export const config: WebdriverIO.MultiremoteConfig = {bInstance.iframePageBase = `file://${path.dirname(rpath)}`;}));- globalAny.ctx.roomName = `jitsimeettorture-${crypto.randomUUID()}`;+ globalAny.ctx.roomName = `${testName}-${getRandomNumberAsStr(40, 3)}`;+ if (process.env.ROOM_NAME_PREFIX) {+ globalAny.ctx.roomName = `${process.env.ROOM_NAME_PREFIX.trim()}_${globalAny.ctx.roomName}`;+ }if (process.env.ROOM_NAME_SUFFIX) {globalAny.ctx.roomName += `_${process.env.ROOM_NAME_SUFFIX.trim()}`;}+ globalAny.ctx.roomName = globalAny.ctx.roomName.toLowerCase();globalAny.ctx.jwtPrivateKeyPath = process.env.JWT_PRIVATE_KEY_PATH;globalAny.ctx.jwtKid = process.env.JWT_KID;globalAny.ctx.isJaasAvailable = () => globalAny.ctx.jwtKid?.startsWith('vpaas-magic-cookie-');