Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

3.0 KB
Raw Blame
import { setTestProperties } from '../../helpers/TestProperties';
import { ensureTwoParticipants } from '../../helpers/participants';

setTestProperties(__filename, {
    usesBrowsers: [ 'p1', 'p2' ]
});

describe('Low bandwidth mode', () => {
    it('joining the meeting', () => ensureTwoParticipants());

    /**
     * Enables low bandwidth mode for p1 and verifies that the other participant sees participant1 as video muted.
     */
    it('set and check', () => setLowBandwidthModeAndCheck(true));

    /**
     * Verifies that participant1 sees avatars for itself and other participants.
     */
    it('avatars check', async () => {
        const { p1 } = ctx;

        await p1.driver.$('//div[@id="dominantSpeaker"]').waitForDisplayed();

        // Makes sure that the avatar is displayed in the local thumbnail and that the video is not displayed.
        await p1.assertThumbnailShowsAvatar(p1);
    });

    /**
     * Disables low bandwidth mode and verifies that both participants see p1 as not video muted.
     */
    it('disable and check', () => setLowBandwidthModeAndCheck(false));

    /**
     * Mutes video on participant1, toggles low bandwidth mode twice and then verifies if both participants see
     * participant1 as video muted.
     */
    it('mute video, set twice and check muted', async () => {
        const { p1 } = ctx;

        // Mute video on participant1.
        await p1.getToolbar().clickVideoMuteButton();

        await verifyVideoMute(true);

        // Enable low bandwidth mode.
        await setLowBandwidthModeAndCheck(true);

        // Disable low bandwidth mode.
        await p1.getVideoQualityDialog().setVideoQuality(false);

        // p1 should stay muted since it was muted before low bandwidth mode was enabled.
        await verifyVideoMute(true);
    });

    it('unmute video and check not muted', async () => {
        // Unmute video on participant1.
        await ctx.p1.getToolbar().clickVideoUnmuteButton();

        await verifyVideoMute(false);
    });
});

/**
 * Toggles the low bandwidth mode state of a p1 participant and verifies participant sees the low bandwidth mode
 * label and that p2 participant sees a video mute state for the former.
 * @param enable
 */
async function setLowBandwidthModeAndCheck(enable: boolean) {
    const { p1 } = ctx;

    await p1.getVideoQualityDialog().setVideoQuality(enable);

    await verifyVideoMute(enable);

    await p1.driver.$('//div[@id="videoResolutionLabel"][contains(@class, "low-bandwidth-mode")]')
        .waitForDisplayed({ reverse: !enable });
}

/**
 * Verifies that p1 and p2 see p1 as video muted or not.
 * @param muted
 */
async function verifyVideoMute(muted: boolean) {
    const { p1, p2 } = ctx;

    // Verify the observer sees the testee in the desired muted state.
    await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, !muted);

    // Verify the testee sees itself in the desired muted state.
    await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, !muted);
}