diff --git a/openvidu-components-angular/e2e/api-directives.test.ts b/openvidu-components-angular/e2e/api-directives.test.ts index c6286c78..c00ae53d 100644 --- a/openvidu-components-angular/e2e/api-directives.test.ts +++ b/openvidu-components-angular/e2e/api-directives.test.ts @@ -24,8 +24,9 @@ describe('Testing API Directives', () => { afterEach(async () => { // console.log('data:image/png;base64,' + await browser.takeScreenshot()); try { - // leaving room if connected - await utils.leaveRoom(); + if (await utils.isPresent('#session-container')) { + await utils.leaveRoom(); + } } catch (error) {} await browser.sleep(500); await browser.quit(); @@ -201,7 +202,7 @@ describe('Testing API Directives', () => { expect(await utils.isPresent('#token-error')).toBeTrue(); }); - it('should show the token error WITHOUT prejoin page', async () => { + fit('should show the token error WITHOUT prejoin page', async () => { const fixedUrl = `${url}&roomName=TOKEN_ERROR&prejoin=false&participantName=PNAME`; await browser.get(`${fixedUrl}`); @@ -221,7 +222,7 @@ describe('Testing API Directives', () => { expect(await utils.isPresent('#openvidu-dialog')).toBeTrue(); }); - it('should run the app with VIDEO DISABLED in prejoin page', async () => { + fit('should run the app with VIDEO DISABLED in prejoin page', async () => { await browser.get(`${url}&prejoin=true&videoEnabled=false`); await utils.checkPrejoinIsPresent(); @@ -239,13 +240,13 @@ describe('Testing API Directives', () => { await utils.waitForElement('#videocam_off'); expect(await utils.isPresent('#videocam_off')).toBeTrue(); - console.log('data:image/png;base64,' + await browser.takeScreenshot()); + console.log('data:image/png;base64,' + (await browser.takeScreenshot())); await utils.waitForElement('#video-poster'); expect(await utils.getNumberOfElements('video')).toEqual(0); }); - it('should run the app with VIDEO DISABLED and WITHOUT PREJOIN page', async () => { + fit('should run the app with VIDEO DISABLED and WITHOUT PREJOIN page', async () => { await browser.get(`${url}&prejoin=false&videoEnabled=false`); await utils.checkSessionIsPresent(); @@ -261,7 +262,7 @@ describe('Testing API Directives', () => { expect(await utils.isPresent('#videocam_off')).toBeTrue(); }); - it('should run the app with AUDIO DISABLED in prejoin page', async () => { + fit('should run the app with AUDIO DISABLED in prejoin page', async () => { await browser.get(`${url}&audioEnabled=false`); await utils.checkPrejoinIsPresent(); @@ -277,7 +278,7 @@ describe('Testing API Directives', () => { await utils.clickOn('#join-button'); await utils.checkSessionIsPresent(); - console.log('data:image/png;base64,' + await browser.takeScreenshot()); + console.log('data:image/png;base64,' + (await browser.takeScreenshot())); expect(await utils.getNumberOfElements('video')).toEqual(1); expect(await utils.getNumberOfElements('audio')).toEqual(0); @@ -285,7 +286,7 @@ describe('Testing API Directives', () => { expect(await utils.isPresent('#mic_off')).toBeTrue(); }); - it('should run the app with AUDIO DISABLED and WITHOUT PREJOIN page', async () => { + fit('should run the app with AUDIO DISABLED and WITHOUT PREJOIN page', async () => { await browser.get(`${url}&prejoin=false&audioEnabled=false`); await browser.sleep(1000); diff --git a/openvidu-components-angular/e2e/utils.po.test.ts b/openvidu-components-angular/e2e/utils.po.test.ts index 2fa74a58..fa5718e1 100644 --- a/openvidu-components-angular/e2e/utils.po.test.ts +++ b/openvidu-components-angular/e2e/utils.po.test.ts @@ -137,8 +137,47 @@ export class OpenViduComponentsPO { } async leaveRoom() { - await this.clickOn('body'); - await this.clickOn('#leave-btn'); + try { + // Close any open panels or menus clicking on the body + await this.clickOn('body'); + await this.browser.sleep(300); + + // Verify that the leave button is present + await this.waitForElement('#leave-btn'); + + // Click on the leave button + await this.clickOn('#leave-btn'); + + // Verify that the session container is no longer present + await this.browser.wait( + async () => { + return !(await this.isPresent('#session-container')); + }, + this.TIMEOUT, + 'Session container should disappear after leaving room' + ); + + // Wait for the prejoin container to be present again + await this.browser.sleep(500); + + // Verify that there are no video elements left in the DOM + const videoCount = await this.getNumberOfElements('video'); + if (videoCount > 0) { + console.warn(`Warning: ${videoCount} video elements still present after leaving room`); + } + } catch (error) { + console.error('Error during leaveRoom:', error); + + // Try to reload the page as a fallback + try { + await this.browser.executeScript('window.location.reload()'); + await this.browser.sleep(2000); + } catch (reloadError) { + console.error('Failed to reload page as fallback:', reloadError); + } + + throw error; + } } async togglePanel(panelName: string) {