Skip to content

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

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

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

describe('Display name', () => {
    it('joining the meeting', () => ensureTwoParticipants({ skipDisplayName: true }));

    it('check change', async () => {
        const { p1, p2 } = ctx;

        // default remote display name
        const defaultDisplayName = await p1.execute(() => config.defaultRemoteDisplayName);
        const p1EndpointId = await p1.getEndpointId();
        const p2EndpointId = await p2.getEndpointId();

        // Checks whether default display names are set and shown, when both sides still miss the display name.
        expect(await p1.getFilmstrip().getRemoteDisplayName(p2EndpointId)).toBe(defaultDisplayName);
        expect(await p2.getFilmstrip().getRemoteDisplayName(p1EndpointId)).toBe(defaultDisplayName);

        const randomName = `Name${Math.trunc(Math.random() * 1_000_000)}`;

        await p2.setLocalDisplayName(randomName);
        expect(await p2.getLocalDisplayName()).toBe(randomName);
        expect(await p1.getFilmstrip().getRemoteDisplayName(p2EndpointId)).toBe(randomName);
    });

    it('check persistence', async () => {
        const { p2 } = ctx;
        const randomName = `Name${Math.trunc(Math.random() * 1_000_000)}`;

        await p2.setLocalDisplayName(randomName);

        expect(await p2.getLocalDisplayName()).toBe(randomName);

        await p2.hangup();

        await ensureTwoParticipants({
            skipDisplayName: true
        });

        expect(await p2.getLocalDisplayName()).toBe(randomName);
    });
});