From b24b60b7355f4c72d0fa341bdaf7471cdce06c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Mon, 10 Nov 2025 12:55:35 -0600 Subject: [PATCH] fix(tests): Wait for transcriptions to be off via an event. (#16635) --- tests/specs/jaas/transcriptions.spec.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/specs/jaas/transcriptions.spec.ts b/tests/specs/jaas/transcriptions.spec.ts index 8d56714293..424779fdba 100644 --- a/tests/specs/jaas/transcriptions.spec.ts +++ b/tests/specs/jaas/transcriptions.spec.ts @@ -57,10 +57,16 @@ describe('Transcription', () => { await checkReceivingChunks(p1, p2, webhooksProxy); + await p1.getIframeAPI().clearEventResults('transcribingStatusChanged'); + await p1.getIframeAPI().addEventListener('transcribingStatusChanged'); + await p1.getIframeAPI().executeCommand('toggleSubtitles'); - // give it some time to process - await p1.driver.pause(5000); + await p1.driver.waitUntil(() => p1.getIframeAPI() + .getEventResult('transcribingStatusChanged'), { + timeout: 15000, + timeoutMsg: 'transcribingStatusChanged event not received by p1' + }); }); it('set subtitles on and off', async () => { @@ -72,18 +78,23 @@ describe('Transcription', () => { await checkReceivingChunks(p1, p2, webhooksProxy); + await p1.getIframeAPI().clearEventResults('transcribingStatusChanged'); + await p1.getIframeAPI().executeCommand('setSubtitles', false); - // give it some time to process - await p1.driver.pause(5000); + await p1.driver.waitUntil(() => p1.getIframeAPI() + .getEventResult('transcribingStatusChanged'), { + timeout: 15000, + timeoutMsg: 'transcribingStatusChanged event not received by p1' + }); }); it('start/stop transcriptions via recording', async () => { // we need to clear results or the last one will be used, from the previous time subtitles were on + await p1.getIframeAPI().clearEventResults('transcribingStatusChanged'); await p1.getIframeAPI().clearEventResults('transcriptionChunkReceived'); await p2.getIframeAPI().clearEventResults('transcriptionChunkReceived'); - await p1.getIframeAPI().addEventListener('transcribingStatusChanged'); await p2.getIframeAPI().addEventListener('transcribingStatusChanged'); await p1.getIframeAPI().executeCommand('startRecording', { transcription: true });