ov-components e2e: Added participantLeft listener

master
Carlos Santos 2025-02-13 12:33:04 +01:00
parent d8452c42ad
commit 4c4380a87f
4 changed files with 1917 additions and 1788 deletions

View File

@ -105,6 +105,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
webComponent.addEventListener('onReadyToJoin', (event) => appendElement('onReadyToJoin')); webComponent.addEventListener('onReadyToJoin', (event) => appendElement('onReadyToJoin'));
webComponent.addEventListener('onRoomDisconnected', (event) => appendElement('onRoomDisconnected')); webComponent.addEventListener('onRoomDisconnected', (event) => appendElement('onRoomDisconnected'));
webComponent.addEventListener('onParticipantLeft', (event) => appendElement('onParticipantLeft'));
webComponent.addEventListener('onVideoEnabledChanged', (event) => appendElement('onVideoEnabledChanged-' + event.detail)); webComponent.addEventListener('onVideoEnabledChanged', (event) => appendElement('onVideoEnabledChanged-' + event.detail));
webComponent.addEventListener('onVideoDeviceChanged', (event) => appendElement('onVideoDeviceChanged')); webComponent.addEventListener('onVideoDeviceChanged', (event) => appendElement('onVideoDeviceChanged'));
webComponent.addEventListener('onAudioEnabledChanged', (eSESSIONvent) => appendElement('onAudioEnabledChanged-' + event.detail)); webComponent.addEventListener('onAudioEnabledChanged', (eSESSIONvent) => appendElement('onAudioEnabledChanged-' + event.detail));
@ -165,6 +166,7 @@ document.addEventListener('DOMContentLoaded', () => {
appendElement('onRoomCreated'); appendElement('onRoomCreated');
room.on('disconnected', (e) => { room.on('disconnected', (e) => {
console.log('Room disconnected', e);
appendElement('roomDisconnected'); appendElement('roomDisconnected');
}); });
}); });

View File

@ -57,23 +57,6 @@ describe('Testing videoconference EVENTS', () => {
expect(await utils.isPresent('#onTokenRequested')).toBeTrue(); 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 () => { it('should receive the onVideoEnabledChanged event when clicking on the prejoin', async () => {
await browser.get(url); await browser.get(url);
await utils.checkPrejoinIsPresent(); await utils.checkPrejoinIsPresent();
@ -622,22 +605,38 @@ describe('Testing videoconference EVENTS', () => {
expect(await utils.isPresent(`#${participantName}-onParticipantCreated`)).toBeTrue(); expect(await utils.isPresent(`#${participantName}-onParticipantCreated`)).toBeTrue();
}); });
// * ROOM EVENTS it('should receive the onParticipantLeft event', async () => {
await browser.get(`${url}&prejoin=false`);
it('should receive roomDisconnected event from LOCAL participant', async () => {
const participantName = 'TEST_USER';
let element;
await browser.get(`${url}&prejoin=false&participantName=${participantName}`);
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();
await utils.checkToolbarIsPresent(); await utils.checkToolbarIsPresent();
// Checking if leave button is not present // Clicking to leave button
element = await utils.waitForElement('#leave-btn'); const leaveButton = await utils.waitForElement('#leave-btn');
await element.click(); expect(await utils.isPresent('#leave-btn')).toBeTrue();
await leaveButton.click();
await utils.waitForElement(`#roomDisconnected`); // Checking if onParticipantLeft has been received
expect(await utils.isPresent(`#roomDisconnected`)).toBeTrue(); 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();
// });
}); });

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
"@types/node": "20.12.14", "@types/node": "20.12.14",
"@types/selenium-webdriver": "4.1.16", "@types/selenium-webdriver": "4.1.16",
"@types/ws": "^8.5.12", "@types/ws": "^8.5.12",
"chromedriver": "129.0.0", "chromedriver": "132.0.0",
"concat": "^1.0.3", "concat": "^1.0.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",