Kaynağa Gözat

fix(tests): Adds mute test.

factor2
damencho 4 ay önce
ebeveyn
işleme
5fd966f042

+ 15
- 0
tests/helpers/Participant.ts Dosyayı Görüntüle

@@ -342,6 +342,21 @@ export class Participant {
342 342
         });
343 343
     }
344 344
 
345
+    /**
346
+     * Waits for ICE to get connected on the p2p connection.
347
+     *
348
+     * @returns {Promise<void>}
349
+     */
350
+    async waitForP2PIceConnected(): Promise<void> {
351
+        const driver = this.driver;
352
+
353
+        return driver.waitUntil(() =>
354
+            driver.execute(() => APP?.conference?.getP2PConnectionState() === 'connected'), {
355
+            timeout: 15_000,
356
+            timeoutMsg: `expected P2P ICE to be connected for 15s for ${this.name}`
357
+        });
358
+    }
359
+
345 360
     /**
346 361
      * Waits for send and receive data.
347 362
      *

+ 11
- 0
tests/helpers/participants.ts Dosyayı Görüntüle

@@ -334,3 +334,14 @@ export async function checkSubject(participant: Participant, subject: string) {
334 334
 
335 335
     expect(txt.startsWith(subject)).toBe(true);
336 336
 }
337
+
338
+/**
339
+ * Check if a screensharing tile is displayed on the observer.
340
+ * Expects there was already a video by this participant and screen sharing will be the second video `-v1`.
341
+ */
342
+export async function checkForScreensharingTile(sharer: Participant, observer: Participant, reverse = false) {
343
+    await observer.driver.$(`//span[@id='participant_${await sharer.getEndpointId()}-v1']`).waitForDisplayed({
344
+        timeout: 3_000,
345
+        reverse
346
+    });
347
+}

+ 1
- 5
tests/pageobjects/Filmstrip.ts Dosyayı Görüntüle

@@ -136,11 +136,7 @@ export default class Filmstrip extends BasePageObject {
136 136
      * @param participant
137 137
      */
138 138
     async muteAudio(participant: Participant) {
139
-        const participantId = await participant.getEndpointId();
140
-
141
-        await this.participant.driver.$(`#participant-item-${participantId}`).moveTo();
142
-
143
-        await this.participant.driver.$(`button[data-testid="mute-audio-${participantId}"]`).click();
139
+        await this.clickOnRemoteMenuLink(await participant.getEndpointId(), 'mutelink', false);
144 140
     }
145 141
 
146 142
     /**

+ 142
- 0
tests/specs/2way/mute.spect.ts Dosyayı Görüntüle

@@ -0,0 +1,142 @@
1
+import type { Participant } from '../../helpers/Participant';
2
+import {
3
+    checkForScreensharingTile,
4
+    ensureOneParticipant,
5
+    ensureTwoParticipants,
6
+    joinSecondParticipant
7
+} from '../../helpers/participants';
8
+
9
+describe('Mute', () => {
10
+    it('joining the meeting', () => ensureTwoParticipants(ctx));
11
+
12
+    it('mute p1 and check', () => toggleMuteAndCheck(ctx.p1, ctx.p2, true));
13
+
14
+    it('unmute p1 and check', () => toggleMuteAndCheck(ctx.p1, ctx.p2, false));
15
+
16
+    it('mute p2 and check', () => toggleMuteAndCheck(ctx.p2, ctx.p1, true));
17
+
18
+    it('unmute p2 and check', () => toggleMuteAndCheck(ctx.p2, ctx.p1, false));
19
+
20
+    it('p1 mutes p2 and check', async () => {
21
+        const { p1, p2 } = ctx;
22
+
23
+        if (!await p1.isModerator()) {
24
+            return;
25
+        }
26
+
27
+        await p1.getFilmstrip().muteAudio(p2);
28
+
29
+        // and now check whether second participant is muted
30
+        await p2.getFilmstrip().assertAudioMuteIconIsDisplayed(p2);
31
+    });
32
+
33
+    it('p2 unmute after p1 mute and check', async () => {
34
+        const { p1, p2 } = ctx;
35
+
36
+        await p2.getToolbar().clickAudioUnmuteButton();
37
+
38
+        // and now check whether second participant is muted
39
+        await p1.getFilmstrip().assertAudioMuteIconIsDisplayed(p2, true);
40
+    });
41
+
42
+    it('p1 mutes before p2 joins', async () => {
43
+        await ctx.p2.hangup();
44
+
45
+        const { p1 } = ctx;
46
+
47
+        await p1.getToolbar().clickAudioMuteButton();
48
+
49
+        await ensureTwoParticipants(ctx);
50
+
51
+        const { p2 } = ctx;
52
+
53
+        await p2.getFilmstrip().assertAudioMuteIconIsDisplayed(p1);
54
+
55
+        await toggleMuteAndCheck(p1, p2, false);
56
+    });
57
+
58
+    it('mute before join and screen share after in p2p', () => muteP1BeforeP2JoinsAndScreenshare(true));
59
+
60
+    it('mute before join and screen share after with jvb', () => muteP1BeforeP2JoinsAndScreenshare(false));
61
+});
62
+
63
+/**
64
+ * Toggles the mute state of a specific Meet conference participant and
65
+ * verifies that a specific other Meet conference participants sees a
66
+ * specific mute state for the former.
67
+ * @param testee The participant whose mute state is to be toggled.
68
+ * @param observer The participant to verify the mute state of {@code testee}.
69
+ * @param muted the mute state of {@code testee} expected to be observed by {@code observer}.
70
+ */
71
+async function toggleMuteAndCheck(
72
+        testee: Participant,
73
+        observer: Participant,
74
+        muted: boolean) {
75
+    if (muted) {
76
+        await testee.getToolbar().clickAudioMuteButton();
77
+    } else {
78
+        await testee.getToolbar().clickAudioUnmuteButton();
79
+    }
80
+
81
+    await observer.getFilmstrip().assertAudioMuteIconIsDisplayed(testee, !muted);
82
+    await testee.getFilmstrip().assertAudioMuteIconIsDisplayed(testee, !muted);
83
+}
84
+
85
+/**
86
+ * Video mutes participant1 before participant2 joins and checks if participant1 can share or unmute video
87
+ * and that media is being received on participant2 in both the cases.
88
+ *
89
+ * @param p2p whether to enable p2p or not.
90
+ */
91
+async function muteP1BeforeP2JoinsAndScreenshare(p2p: boolean) {
92
+    await Promise.all([ ctx.p1?.hangup(), ctx.p2?.hangup() ]);
93
+
94
+    await ensureOneParticipant(ctx, {
95
+        configOverwrite: {
96
+            p2p: {
97
+                enabled: p2p
98
+            }
99
+        }
100
+    });
101
+
102
+    const { p1 } = ctx;
103
+
104
+    await p1.getToolbar().clickVideoMuteButton();
105
+
106
+    await joinSecondParticipant(ctx, {
107
+        configOverwrite: {
108
+            p2p: {
109
+                enabled: p2p
110
+            }
111
+        }
112
+    });
113
+
114
+    const { p2 } = ctx;
115
+
116
+    if (p2p) {
117
+        await p2.waitForP2PIceConnected();
118
+    } else {
119
+        await p2.waitForIceConnected();
120
+    }
121
+
122
+    await p2.waitForSendReceiveData({ checkReceive: false });
123
+
124
+    // Check if p1 appears video muted on p2.
125
+    await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
126
+
127
+    // Start desktop share.
128
+    await p1.getToolbar().clickDesktopSharingButton();
129
+
130
+    await checkForScreensharingTile(p1, p2);
131
+
132
+    // we need to pass the id of the fake participant we use for the screensharing
133
+    await p2.waitForRemoteVideo(`${await p1.getEndpointId()}-v1`);
134
+
135
+    // Stop desktop share and unmute video and check for video again.
136
+    await p1.getToolbar().clickStopDesktopSharingButton();
137
+
138
+    await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
139
+    await p1.getToolbar().clickVideoUnmuteButton();
140
+    await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, true);
141
+    await p2.waitForRemoteVideo(await p1.getEndpointId());
142
+}

+ 1
- 10
tests/specs/4way/desktopSharing.spec.ts Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 import { SET_AUDIO_ONLY } from '../../../react/features/base/audio-only/actionTypes';
2
-import type { Participant } from '../../helpers/Participant';
3 2
 import {
3
+    checkForScreensharingTile,
4 4
     ensureFourParticipants,
5 5
     ensureOneParticipant,
6 6
     ensureThreeParticipants,
@@ -311,12 +311,3 @@ describe('Desktop sharing', () => {
311 311
     });
312 312
 });
313 313
 
314
-/**
315
- * Check if a screensharing tile is displayed on the observer.
316
- */
317
-async function checkForScreensharingTile(sharer: Participant, observer: Participant, reverse = false) {
318
-    await observer.driver.$(`//span[@id='participant_${await sharer.getEndpointId()}-v1']`).waitForDisplayed({
319
-        timeout: 3_000,
320
-        reverse
321
-    });
322
-}

Loading…
İptal
Kaydet