From e026bac42c082004df31fcaabd7bb8333ed5490c Mon Sep 17 00:00:00 2001 From: bgrozev Date: Tue, 28 Oct 2025 14:14:45 -0500 Subject: [PATCH] feat(tests): Do not require WebhooksProxy for jaas dial-in test (#16595) * Add a requireWebhooksProxy test property. * test: Make the jaas dial-in test use but not require WH proxy. --- tests/helpers/TestProperties.ts | 13 +++++++++++-- tests/specs/jaas/chat.spec.ts | 2 +- tests/specs/jaas/dial/dialin.spec.ts | 16 +++++++++++++--- tests/specs/jaas/dial/dialout.spec.ts | 4 ++-- tests/specs/jaas/dial/sipjibri.spec.ts | 2 +- tests/specs/jaas/maxOccupants.spec.ts | 2 +- tests/specs/jaas/passcode.spec.ts | 2 +- tests/specs/jaas/passcodeInvalid.spec.ts | 4 ++-- tests/specs/jaas/presence.spec.ts | 2 +- tests/specs/jaas/recording.spec.ts | 4 ++-- tests/specs/jaas/transcriptions.spec.ts | 2 +- .../jaas/visitors/videoWithSingleSender.spec.ts | 2 +- tests/specs/jaas/visitors/visitorTokens.spec.ts | 2 +- tests/specs/jaas/visitors/visitorsLive.spec.ts | 2 +- tests/wdio.conf.ts | 5 ++--- 15 files changed, 41 insertions(+), 23 deletions(-) diff --git a/tests/helpers/TestProperties.ts b/tests/helpers/TestProperties.ts index 98f95836cf..82aaff0ce6 100644 --- a/tests/helpers/TestProperties.ts +++ b/tests/helpers/TestProperties.ts @@ -6,15 +6,18 @@ export type ITestProperties = { * A more detailed description of what the test does, to be included in the Allure report. */ description?: string; + /** The test requires the webhook proxy to be available. */ + requireWebhookProxy: boolean; /** The test requires jaas, it should be skipped when the jaas configuration is not enabled. */ useJaas: boolean; - /** The test requires the webhook proxy. */ + /** The test uses the webhook proxy if available. */ useWebhookProxy: boolean; usesBrowsers: string[]; }; const defaultProperties: ITestProperties = { useWebhookProxy: false, + requireWebhookProxy: false, useJaas: false, usesBrowsers: [ 'p1' ] }; @@ -105,5 +108,11 @@ export function loadTestFiles(files: string[]): void { * @returns Promise - The test properties with defaults applied */ export async function getTestProperties(testFilePath: string): Promise { - return testProperties[testFilePath] || { ...defaultProperties }; + const properties = testProperties[testFilePath] || { ...defaultProperties }; + + if (properties.requireWebhookProxy && !properties.useWebhookProxy) { + properties.useWebhookProxy = true; + } + + return properties; } diff --git a/tests/specs/jaas/chat.spec.ts b/tests/specs/jaas/chat.spec.ts index 156b310aff..72d23befe4 100644 --- a/tests/specs/jaas/chat.spec.ts +++ b/tests/specs/jaas/chat.spec.ts @@ -8,8 +8,8 @@ import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; import { fetchJson } from '../../helpers/utils'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2' ] }); diff --git a/tests/specs/jaas/dial/dialin.spec.ts b/tests/specs/jaas/dial/dialin.spec.ts index 011a80456f..380c429091 100644 --- a/tests/specs/jaas/dial/dialin.spec.ts +++ b/tests/specs/jaas/dial/dialin.spec.ts @@ -32,6 +32,9 @@ describe('Dial-in', () => { p1 = await joinJaasMuc({ name: 'p1', token: t({ room, moderator: true }) }); webhooksProxy = ctx.webhooksProxy; + if (!webhooksProxy) { + console.error('WebhooksProxy is not available, will not verify webhooks.'); + } expect(await p1.isInMuc()).toBe(true); if (expectations.dialIn.enabled !== null) { @@ -59,13 +62,20 @@ describe('Dial-in', () => { await dialIn(dialInPin); await waitForMedia(p1); - const startedPayload - = await verifyStartedWebhooks(webhooksProxy, 'in', 'DIAL_IN_STARTED', customerId); + let startedPayload: any; + + if (webhooksProxy) { + startedPayload + = await verifyStartedWebhooks(webhooksProxy, 'in', 'DIAL_IN_STARTED', customerId); + } + const endpointId = await p1.execute(() => APP?.conference?.listMembers()[0].getId()); await p1.getFilmstrip().kickParticipant(endpointId); - await verifyEndedWebhook(webhooksProxy, 'DIAL_IN_ENDED', customerId, startedPayload); + if (webhooksProxy) { + await verifyEndedWebhook(webhooksProxy, 'DIAL_IN_ENDED', customerId, startedPayload); + } await p1.hangup(); }); diff --git a/tests/specs/jaas/dial/dialout.spec.ts b/tests/specs/jaas/dial/dialout.spec.ts index 8882469022..52d982d8cd 100644 --- a/tests/specs/jaas/dial/dialout.spec.ts +++ b/tests/specs/jaas/dial/dialout.spec.ts @@ -7,8 +7,8 @@ import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas'; import { verifyEndedWebhook, verifyStartedWebhooks, waitForMedia } from './util'; setTestProperties(__filename, { - useJaas: true, - useWebhookProxy: true + requireWebhookProxy: true, + useJaas: true }); describe('Dial-out', () => { diff --git a/tests/specs/jaas/dial/sipjibri.spec.ts b/tests/specs/jaas/dial/sipjibri.spec.ts index 149a873910..a3aeaf2321 100644 --- a/tests/specs/jaas/dial/sipjibri.spec.ts +++ b/tests/specs/jaas/dial/sipjibri.spec.ts @@ -7,8 +7,8 @@ import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas'; import { waitForMedia } from './util'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true }); diff --git a/tests/specs/jaas/maxOccupants.spec.ts b/tests/specs/jaas/maxOccupants.spec.ts index 1b0287b890..c9b6680965 100644 --- a/tests/specs/jaas/maxOccupants.spec.ts +++ b/tests/specs/jaas/maxOccupants.spec.ts @@ -2,8 +2,8 @@ import { setTestProperties } from '../../helpers/TestProperties'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2', 'p3' ] }); diff --git a/tests/specs/jaas/passcode.spec.ts b/tests/specs/jaas/passcode.spec.ts index 1f96c8eb3f..5abc9d8bfd 100644 --- a/tests/specs/jaas/passcode.spec.ts +++ b/tests/specs/jaas/passcode.spec.ts @@ -3,8 +3,8 @@ import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; import { IToken } from '../../helpers/token'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2' ] }); diff --git a/tests/specs/jaas/passcodeInvalid.spec.ts b/tests/specs/jaas/passcodeInvalid.spec.ts index 6179b82e76..1ecda4057f 100644 --- a/tests/specs/jaas/passcodeInvalid.spec.ts +++ b/tests/specs/jaas/passcodeInvalid.spec.ts @@ -2,8 +2,8 @@ import { setTestProperties } from '../../helpers/TestProperties'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { - useJaas: true, - useWebhookProxy: true + requireWebhookProxy: true, + useJaas: true }); // This test is separate from passcode.spec.ts, because it needs to use a different room name, and webhooksProxy is only diff --git a/tests/specs/jaas/presence.spec.ts b/tests/specs/jaas/presence.spec.ts index 750bbf264f..a4914b8cc3 100644 --- a/tests/specs/jaas/presence.spec.ts +++ b/tests/specs/jaas/presence.spec.ts @@ -7,8 +7,8 @@ import WebhookProxy from '../../helpers/WebhookProxy'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2' ] }); diff --git a/tests/specs/jaas/recording.spec.ts b/tests/specs/jaas/recording.spec.ts index 396729f9c3..40ad0d77a6 100644 --- a/tests/specs/jaas/recording.spec.ts +++ b/tests/specs/jaas/recording.spec.ts @@ -5,8 +5,8 @@ import WebhookProxy from '../../helpers/WebhookProxy'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { - useJaas: true, - useWebhookProxy: true + requireWebhookProxy: true, + useJaas: true }); /** diff --git a/tests/specs/jaas/transcriptions.spec.ts b/tests/specs/jaas/transcriptions.spec.ts index 6096dfc0c6..8d56714293 100644 --- a/tests/specs/jaas/transcriptions.spec.ts +++ b/tests/specs/jaas/transcriptions.spec.ts @@ -6,8 +6,8 @@ import type WebhookProxy from '../../helpers/WebhookProxy'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2' ] }); diff --git a/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts b/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts index 8542e5762d..c50ff7e369 100644 --- a/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts +++ b/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts @@ -2,8 +2,8 @@ import { setTestProperties } from '../../../helpers/TestProperties'; import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2', 'p3', 'p4' ] }); diff --git a/tests/specs/jaas/visitors/visitorTokens.spec.ts b/tests/specs/jaas/visitors/visitorTokens.spec.ts index a847f56ba5..db549d5fb5 100644 --- a/tests/specs/jaas/visitors/visitorTokens.spec.ts +++ b/tests/specs/jaas/visitors/visitorTokens.spec.ts @@ -5,8 +5,8 @@ import WebhookProxy from '../../../helpers/WebhookProxy'; import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2', 'p3' ] }); diff --git a/tests/specs/jaas/visitors/visitorsLive.spec.ts b/tests/specs/jaas/visitors/visitorsLive.spec.ts index 5d782c84cf..a867894a50 100644 --- a/tests/specs/jaas/visitors/visitorsLive.spec.ts +++ b/tests/specs/jaas/visitors/visitorsLive.spec.ts @@ -5,8 +5,8 @@ import { setTestProperties } from '../../../helpers/TestProperties'; import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas'; setTestProperties(__filename, { + requireWebhookProxy: true, useJaas: true, - useWebhookProxy: true, usesBrowsers: [ 'p1', 'p2' ] }); diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.ts index f0fbfb7e08..de2aa204be 100644 --- a/tests/wdio.conf.ts +++ b/tests/wdio.conf.ts @@ -273,9 +273,8 @@ export const config: WebdriverIO.MultiremoteConfig = { globalAny.ctx.webhooksProxy.connect(); } - if (testProperties.useWebhookProxy && !globalAny.ctx.webhooksProxy) { - console.warn(`WebhookProxy is not available, skipping ${testName}`); - globalAny.ctx.skipSuiteTests = 'WebhooksProxy is not required but not available'; + if (testProperties.requireWebhookProxy && !globalAny.ctx.webhooksProxy) { + throw new Error('The test requires WebhookProxy, but it is not available.'); } },