ov-components: update URL handling in API directive tests and improve error logging in leaveRoom method

master
Carlos Santos 2025-05-26 18:30:55 +02:00
parent dbb45eaffd
commit 3579b9dc6a
2 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import { Builder, WebDriver } from 'selenium-webdriver';
import { TestAppConfig } from './selenium.conf'; import { TestAppConfig } from './selenium.conf';
import { OpenViduComponentsPO } from './utils.po.test'; import { OpenViduComponentsPO } from './utils.po.test';
const url = TestAppConfig.appUrl; let url = '';
describe('Testing API Directives', () => { describe('Testing API Directives', () => {
let browser: WebDriver; let browser: WebDriver;
@ -19,6 +19,7 @@ describe('Testing API Directives', () => {
beforeEach(async () => { beforeEach(async () => {
browser = await createChromeBrowser(); browser = await createChromeBrowser();
utils = new OpenViduComponentsPO(browser); utils = new OpenViduComponentsPO(browser);
url = `${TestAppConfig.appUrl}&roomName=API_DIRECTIVES_${Math.floor(Math.random() * 1000)}`;
}); });
afterEach(async () => { afterEach(async () => {
@ -173,7 +174,7 @@ describe('Testing API Directives', () => {
}); });
it('should show the token error WITH prejoin page', async () => { it('should show the token error WITH prejoin page', async () => {
const fixedUrl = `${url}&roomName=TEST_TOKEN&participantName=PNAME`; const fixedUrl = `${TestAppConfig.appUrl}&roomName=TEST_TOKEN&participantName=PNAME`;
await browser.get(`${fixedUrl}`); await browser.get(`${fixedUrl}`);
// Checking if prejoin page exist // Checking if prejoin page exist
@ -203,7 +204,7 @@ describe('Testing API Directives', () => {
}); });
it('should show the token error WITHOUT prejoin page', async () => { it('should show the token error WITHOUT prejoin page', async () => {
const fixedUrl = `${url}&roomName=TOKEN_ERROR&prejoin=false&participantName=PNAME`; const fixedUrl = `${TestAppConfig.appUrl}&roomName=TOKEN_ERROR&prejoin=false&participantName=PNAME`;
await browser.get(`${fixedUrl}`); await browser.get(`${fixedUrl}`);
// Checking if session container is present // Checking if session container is present
@ -541,7 +542,7 @@ describe('Testing API Directives', () => {
it('should HIDE the MUTE button in participants panel', async () => { it('should HIDE the MUTE button in participants panel', async () => {
const roomName = 'e2etest'; const roomName = 'e2etest';
const fixedUrl = `${url}&prejoin=false&participantMuteBtn=false&roomName=${roomName}`; const fixedUrl = `${TestAppConfig.appUrl}&prejoin=false&participantMuteBtn=false&roomName=${roomName}`;
await browser.get(fixedUrl); await browser.get(fixedUrl);
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();

View File

@ -1,5 +1,4 @@
import { By, until, WebDriver, WebElement } from 'selenium-webdriver'; import { By, until, WebDriver, WebElement } from 'selenium-webdriver';
import { TestAppConfig } from './selenium.conf';
export class OpenViduComponentsPO { export class OpenViduComponentsPO {
private TIMEOUT = 10 * 1000; private TIMEOUT = 10 * 1000;
@ -167,7 +166,9 @@ export class OpenViduComponentsPO {
console.warn(`Warning: ${videoCount} video elements still present after leaving room`); console.warn(`Warning: ${videoCount} video elements still present after leaving room`);
} }
} catch (error) { } catch (error) {
this.browser.get(TestAppConfig.appUrl); console.error('Error during leaveRoom:', error);
throw error;
} }
} }