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
test(iframe): add specs for subject command and events (#17999)
ravindra-RKB19e71dfc24a7
diff --git a/tests/helpers/participants.ts b/tests/helpers/participants.tsindex 4431d82aa0..df5ded43e6 100644--- a/tests/helpers/participants.ts+++ b/tests/helpers/participants.ts@@ -290,9 +290,13 @@ export async function checkSubject(participant: Participant, subject: string) {await localTile.waitForExist();await localTile.moveTo();- const txt = await localTile.getText();-- expect(txt.startsWith(subject)).toBe(true);+ await participant.driver.waitUntil(+ async () => (await localTile.getText()).startsWith(subject),+ {+ timeout: 5000,+ timeoutMsg: `subject was not updated to "${subject}"`+ }+ );}/**diff --git a/tests/specs/iframe/subject.spec.ts b/tests/specs/iframe/subject.spec.tsnew file mode 100644index 0000000000..b749586277--- /dev/null+++ b/tests/specs/iframe/subject.spec.ts@@ -0,0 +1,79 @@+import { expect } from '@wdio/globals';++import type { Participant } from '../../helpers/Participant';+import { setTestProperties } from '../../helpers/TestProperties';+import { config as testsConfig } from '../../helpers/TestsConfig';+import { joinMuc } from '../../helpers/joinMuc';+import { checkSubject } from '../../helpers/participants';++import { checkIframeApi } from './util';++setTestProperties(__filename, {+ usesBrowsers: [ 'p1', 'p2' ]+});++describe('Subject iframe API command and events', () => {+ let p1: Participant;+ let p2: Participant;++ /**+ * Executes the subject iframe API command on p1 and verifies+ * subjectChange events and in-meeting DOM on both participants.+ *+ * @param subject The expected subject text.+ */+ async function changeSubjectAndVerify(subject: string) {+ await p1.switchToMainFrame();+ await p2.switchToMainFrame();+ await p1.getIframeAPI().clearEventResults('subjectChange');+ await p2.getIframeAPI().clearEventResults('subjectChange');++ await p1.getIframeAPI().executeCommand('subject', subject);++ const p1SubjectEvent: { subject: string; } = await p1.getIframeAPI().waitForEventResult(+ 'subjectChange',+ 'subjectChange event was not received on p1 for subject command'+ );++ expect(p1SubjectEvent).toEqual({ subject });++ const p2SubjectEvent: { subject: string; } = await p2.getIframeAPI().waitForEventResult(+ 'subjectChange',+ 'subjectChange event was not received on p2 for subject command'+ );++ expect(p2SubjectEvent).toEqual({ subject });++ await p1.switchToIFrame();+ await checkSubject(p1, subject);++ await p2.switchToIFrame();+ await checkSubject(p2, subject);+ }++ it('joining the meeting', async () => {+ p1 = await joinMuc({ name: 'p1', iFrameApi: true, token: testsConfig.jwt.preconfiguredToken });++ if (!await checkIframeApi(p1)) {+ return;+ }++ p2 = await joinMuc({ name: 'p2', iFrameApi: true });++ await p1.switchToMainFrame();+ await p2.switchToMainFrame();++ expect(await p1.getIframeAPI().getEventResult('isModerator')).toBe(true);++ await p1.getIframeAPI().addEventListener('subjectChange');+ await p2.getIframeAPI().addEventListener('subjectChange');+ });++ it('sets meeting subject via subject command and emits subjectChange event', async () => {+ await changeSubjectAndVerify('Conference Subject via Iframe API');+ });++ it('updates meeting subject to a new value via subject command', async () => {+ await changeSubjectAndVerify('Updated Conference Subject');+ });+});