diff --git a/tests/helpers/expectations.ts b/tests/helpers/expectations.ts index f907964bbd..826a01c7eb 100644 --- a/tests/helpers/expectations.ts +++ b/tests/helpers/expectations.ts @@ -13,7 +13,14 @@ const defaultExpectations = { */ enabled: null, }, + iframe: { + // Whether the iframe integration is enabled (the inverse of `disableIframeAPI` from config.js) + enabled: true + }, jaas: { + liveStreamingEnabled: true, + recordingEnabled: true, + transcriptionEnabled: true, /** * Whether the jaas account is configured with the account-level setting to allow unauthenticated users to join. */ diff --git a/tests/specs/iframe/chat.spec.ts b/tests/specs/iframe/chat.spec.ts index 2d4540925e..05f9fab316 100644 --- a/tests/specs/iframe/chat.spec.ts +++ b/tests/specs/iframe/chat.spec.ts @@ -3,6 +3,7 @@ import { expect } from '@wdio/globals'; import type { Participant } from '../../helpers/Participant'; import { setTestProperties } from '../../helpers/TestProperties'; import { config as testsConfig } from '../../helpers/TestsConfig'; +import { expectations } from '../../helpers/expectations'; import { joinMuc } from '../../helpers/joinMuc'; setTestProperties(__filename, { @@ -16,11 +17,9 @@ describe('Chat', () => { p1 = await joinMuc({ name: 'p1', iFrameApi: true, token: testsConfig.jwt.preconfiguredToken }); p2 = await joinMuc({ name: 'p2', iFrameApi: true }); - if (await p1.execute(() => config.disableIframeAPI)) { - ctx.skipSuiteTests = 'The environment has the iFrame API disabled.'; + const iframeEnabled = !await p1.execute(() => config.disableIframeAPI); - return; - } + expect(iframeEnabled).toBe(expectations.iframe.enabled); await p1.switchToMainFrame(); await p2.switchToMainFrame(); diff --git a/tests/specs/iframe/kick.spec.ts b/tests/specs/iframe/kick.spec.ts index 180bf33f76..bef53b68c6 100644 --- a/tests/specs/iframe/kick.spec.ts +++ b/tests/specs/iframe/kick.spec.ts @@ -1,6 +1,7 @@ import { isEqual } from 'lodash-es'; import { setTestProperties } from '../../helpers/TestProperties'; +import { expectations } from '../../helpers/expectations'; import { ensureTwoParticipants } from '../../helpers/participants'; setTestProperties(__filename, { @@ -12,12 +13,9 @@ describe('Kick participants', () => { await ensureTwoParticipants({}, { name: 'p1', iFrameApi: true }); const { p1, p2 } = ctx; + const iframeEnabled = !await p1.execute(() => config.disableIframeAPI); - if (await p1.execute(() => config.disableIframeAPI)) { - ctx.skipSuiteTests = 'The environment has the iFrame API disabled.'; - - return; - } + expect(iframeEnabled).toBe(expectations.iframe.enabled); await Promise.all([ p1.switchToMainFrame(), diff --git a/tests/specs/iframe/participantsPresence.spec.ts b/tests/specs/iframe/participantsPresence.spec.ts index 8d7ba1d772..3eeeca415c 100644 --- a/tests/specs/iframe/participantsPresence.spec.ts +++ b/tests/specs/iframe/participantsPresence.spec.ts @@ -1,5 +1,6 @@ import { P1, P2 } from '../../helpers/Participant'; import { setTestProperties } from '../../helpers/TestProperties'; +import { expectations } from '../../helpers/expectations'; import { ensureTwoParticipants, parseJid } from '../../helpers/participants'; setTestProperties(__filename, { @@ -11,12 +12,9 @@ describe('Participants presence', () => { await ensureTwoParticipants({}, { name: 'p1', iFrameApi: true }); const { p1, p2 } = ctx; + const iframeEnabled = !await p1.execute(() => config.disableIframeAPI); - if (await p1.execute(() => config.disableIframeAPI)) { - ctx.skipSuiteTests = 'The environment has the iFrame API disabled.'; - - return; - } + expect(iframeEnabled).toBe(expectations.iframe.enabled); await Promise.all([ p1.switchToMainFrame(), diff --git a/tests/specs/jaas/recording.spec.ts b/tests/specs/jaas/recording.spec.ts index a301e2b5f1..3150016466 100644 --- a/tests/specs/jaas/recording.spec.ts +++ b/tests/specs/jaas/recording.spec.ts @@ -2,6 +2,7 @@ import { Participant } from '../../helpers/Participant'; import { setTestProperties } from '../../helpers/TestProperties'; import { config as testsConfig } from '../../helpers/TestsConfig'; import WebhookProxy from '../../helpers/WebhookProxy'; +import { expectations } from '../../helpers/expectations'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { @@ -12,16 +13,13 @@ setTestProperties(__filename, { /** * Tests the recording and live-streaming functionality of JaaS (including relevant webhooks) exercising the iFrame API * commands and functions. - * TODO: read flags from config. - * TODO: also assert "this meeting is being recorder" notificaitons are show/played? + * TODO: also assert "this meeting is being recorded" notifications are show/played? */ describe('Recording and live-streaming', () => { const tenant = testsConfig.jaas.tenant; const customerId = tenant?.replace('vpaas-magic-cookie-', ''); - // TODO: read from config - let recordingDisabled: boolean; - // TODO: read from config - let liveStreamingDisabled: boolean; + let recordingEnabled: boolean; + let liveStreamingEnabled: boolean; let p: Participant; let webhooksProxy: WebhookProxy; @@ -29,18 +27,17 @@ describe('Recording and live-streaming', () => { webhooksProxy = ctx.webhooksProxy; p = await joinJaasMuc({ iFrameApi: true, token: t({ moderator: true }) }, { roomName: ctx.roomName }); - // TODO: what should we do in this case? Add a config for this? - if (await p.execute(() => config.disableIframeAPI)) { - ctx.skipSuiteTests = 'The environment has the iFrame API disabled.'; + recordingEnabled = Boolean(await p.execute(() => config.recordingService?.enabled)); + expect(recordingEnabled).toBe(expectations.jaas.recordingEnabled); - return; + liveStreamingEnabled = Boolean(await p.execute(() => config.liveStreaming?.enabled)); + expect(liveStreamingEnabled).toBe(expectations.jaas.liveStreamingEnabled); + + if (liveStreamingEnabled && !process.env.YTUBE_TEST_STREAM_KEY) { + liveStreamingEnabled = false; + console.log('Skipping live-streaming tests because YTUBE_TEST_STREAM_KEY is not set.'); } - // TODO: only read if config says so - recordingDisabled = Boolean(!await p.execute(() => config.recordingService?.enabled)); - liveStreamingDisabled = Boolean(!await p.execute(() => config.liveStreaming?.enabled)) - || !process.env.YTUBE_TEST_STREAM_KEY; - await p.switchToMainFrame(); }); @@ -138,7 +135,7 @@ describe('Recording and live-streaming', () => { } it('start/stop recording using the iFrame command', async () => { - if (recordingDisabled) { + if (!recordingEnabled) { return; } @@ -150,7 +147,7 @@ describe('Recording and live-streaming', () => { }); it('start/stop recording using the iFrame function', async () => { - if (recordingDisabled) { + if (!recordingEnabled) { return; } @@ -162,7 +159,7 @@ describe('Recording and live-streaming', () => { }); it('start/stop live-streaming using the iFrame command', async () => { - if (liveStreamingDisabled) { + if (!liveStreamingEnabled) { return; } diff --git a/tests/specs/jaas/transcriptions.spec.ts b/tests/specs/jaas/transcriptions.spec.ts index 424779fdba..d9c944bc67 100644 --- a/tests/specs/jaas/transcriptions.spec.ts +++ b/tests/specs/jaas/transcriptions.spec.ts @@ -3,6 +3,7 @@ import { expect } from '@wdio/globals'; import type { Participant } from '../../helpers/Participant'; import { setTestProperties } from '../../helpers/TestProperties'; import type WebhookProxy from '../../helpers/WebhookProxy'; +import { expectations } from '../../helpers/expectations'; import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas'; setTestProperties(__filename, { @@ -25,12 +26,9 @@ describe('Transcription', () => { token: t({ room, moderator: true }), iFrameApi: true }); - if (await p1.execute(() => config.disableIframeAPI || !config.transcription?.enabled)) { - // skip the test if iframeAPI or transcriptions are disabled - ctx.skipSuiteTests = 'The environment has the iFrame API or transcriptions disabled.'; + const transcriptionEnabled = await p1.execute(() => !config.transcription?.enabled); - return; - } + expect(transcriptionEnabled).toBe(expectations.jaas.transcriptionEnabled); p2 = await joinJaasMuc({ name: 'p2',