Skip to content

Commit

Permalink
ov-components e2e: Added participantLeft listener
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Feb 13, 2025
1 parent d8452c4 commit 4c4380a
Show file tree
Hide file tree
Showing 4 changed files with 1,943 additions and 1,814 deletions.
2 changes: 2 additions & 0 deletions openvidu-components-angular/e2e/webcomponent-app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
webComponent.addEventListener('onReadyToJoin', (event) => appendElement('onReadyToJoin'));
webComponent.addEventListener('onRoomDisconnected', (event) => appendElement('onRoomDisconnected'));
webComponent.addEventListener('onParticipantLeft', (event) => appendElement('onParticipantLeft'));
webComponent.addEventListener('onVideoEnabledChanged', (event) => appendElement('onVideoEnabledChanged-' + event.detail));
webComponent.addEventListener('onVideoDeviceChanged', (event) => appendElement('onVideoDeviceChanged'));
webComponent.addEventListener('onAudioEnabledChanged', (eSESSIONvent) => appendElement('onAudioEnabledChanged-' + event.detail));
Expand Down Expand Up @@ -165,6 +166,7 @@ document.addEventListener('DOMContentLoaded', () => {
appendElement('onRoomCreated');

room.on('disconnected', (e) => {
console.log('Room disconnected', e);
appendElement('roomDisconnected');
});
});
Expand Down
55 changes: 27 additions & 28 deletions openvidu-components-angular/e2e/webcomponent-e2e/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,6 @@ describe('Testing videoconference EVENTS', () => {
expect(await utils.isPresent('#onTokenRequested')).toBeTrue();
});

it('should receive the onRoomDisconnected event', async () => {
await browser.get(`${url}&prejoin=false`);

await utils.checkSessionIsPresent();

await utils.checkToolbarIsPresent();

// Clicking to leave button
const leaveButton = await utils.waitForElement('#leave-btn');
expect(await utils.isPresent('#leave-btn')).toBeTrue();
await leaveButton.click();

// Checking if onRoomDisconnected has been received
await utils.waitForElement('#onRoomDisconnected');
expect(await utils.isPresent('#onRoomDisconnected')).toBeTrue();
});

it('should receive the onVideoEnabledChanged event when clicking on the prejoin', async () => {
await browser.get(url);
await utils.checkPrejoinIsPresent();
Expand Down Expand Up @@ -622,22 +605,38 @@ describe('Testing videoconference EVENTS', () => {
expect(await utils.isPresent(`#${participantName}-onParticipantCreated`)).toBeTrue();
});

// * ROOM EVENTS

it('should receive roomDisconnected event from LOCAL participant', async () => {
const participantName = 'TEST_USER';
let element;
await browser.get(`${url}&prejoin=false&participantName=${participantName}`);
it('should receive the onParticipantLeft event', async () => {
await browser.get(`${url}&prejoin=false`);

await utils.checkSessionIsPresent();

await utils.checkToolbarIsPresent();

// Checking if leave button is not present
element = await utils.waitForElement('#leave-btn');
await element.click();
// Clicking to leave button
const leaveButton = await utils.waitForElement('#leave-btn');
expect(await utils.isPresent('#leave-btn')).toBeTrue();
await leaveButton.click();

await utils.waitForElement(`#roomDisconnected`);
expect(await utils.isPresent(`#roomDisconnected`)).toBeTrue();
// Checking if onParticipantLeft has been received
await utils.waitForElement('#onParticipantLeft');
expect(await utils.isPresent('#onParticipantLeft')).toBeTrue();
});

// * ROOM EVENTS

//TODO: Implement a mechanism to emulate network disconnection
// it('should receive the onRoomDisconnected event', async () => {
// await browser.get(`${url}&prejoin=false`);

// await utils.checkSessionIsPresent();

// await utils.checkToolbarIsPresent();

// // Emulate network disconnection
// await utils.forceCloseWebsocket();

// // Checking if onRoomDisconnected has been received
// await utils.waitForElement('#onRoomDisconnected');
// expect(await utils.isPresent('#onRoomDisconnected')).toBeTrue();
// });
});
Loading

0 comments on commit 4c4380a

Please sign in to comment.