diff --git a/openvidu-components-angular/e2e/stream.test.ts b/openvidu-components-angular/e2e/stream.test.ts index 4fb23bb0..10d5844c 100644 --- a/openvidu-components-angular/e2e/stream.test.ts +++ b/openvidu-components-angular/e2e/stream.test.ts @@ -681,8 +681,8 @@ describe('Stream UI controls and interaction features', () => { await browser.switchTo().window(tabs[0]); - await utils.waitForElement('.OV_stream.remote.speaking'); expect(await utils.getNumberOfElements('.OV_stream.remote.speaking')).toEqual(1); + // Wait for at least one speaking element to appear before asserting expect(await utils.getNumberOfElements('.OV_stream.speaking')).toEqual(1); }); }); diff --git a/openvidu-components-angular/e2e/utils.po.test.ts b/openvidu-components-angular/e2e/utils.po.test.ts index 9571e3f0..392d3d4a 100644 --- a/openvidu-components-angular/e2e/utils.po.test.ts +++ b/openvidu-components-angular/e2e/utils.po.test.ts @@ -15,7 +15,13 @@ export class OpenViduComponentsPO { ); } - async getNumberOfElements(selector: string): Promise { + async getNumberOfElements(selector: string, timeout: number = this.TIMEOUT): Promise { + try { + await this.waitForElement(selector); + } catch { + // If timeout, return 0 as no elements found + return 0; + } return (await this.browser.findElements(By.css(selector))).length; }