e2e-tests: update virtual background tests to ensure element visibility

This commit is contained in:
Carlos Santos 2025-09-24 13:09:44 +02:00
parent b97da07bea
commit ea178b3c87
2 changed files with 8 additions and 6 deletions

View File

@ -239,7 +239,7 @@ test.describe('Room Functionality Tests', () => {
// ========================================== // ==========================================
test.describe('Advanced Features', () => { test.describe('Advanced Features', () => {
test('should apply virtual background and detect visual changes', async ({ page }) => { test.only('should apply virtual background and detect visual changes', async ({ page }) => {
await joinRoomAs('speaker', participantName, page); await joinRoomAs('speaker', participantName, page);
// Wait for video element to be ready // Wait for video element to be ready
@ -250,7 +250,6 @@ test.describe('Room Functionality Tests', () => {
// Apply virtual background // Apply virtual background
await applyVirtualBackground(page, '2'); await applyVirtualBackground(page, '2');
await page.waitForTimeout(1000); // Allow background processing time
// Capture post-change screenshot // Capture post-change screenshot
await saveScreenshot(page, 'after.png', '.OV_video-element'); await saveScreenshot(page, 'after.png', '.OV_video-element');

View File

@ -78,9 +78,11 @@ export async function interactWithElementInIframe(
// Perform the specified action // Perform the specified action
switch (action) { switch (action) {
case 'click': case 'click':
await expect(element).toBeVisible({ timeout });
await element.click(); await element.click();
break; break;
case 'fill': case 'fill':
await expect(element).toBeVisible({ timeout });
await element.fill(value); await element.fill(value);
break; break;
default: default:
@ -256,13 +258,11 @@ export const viewRecordingsAs = async (role: 'moderator' | 'speaker', page: Page
}; };
export const leaveRoom = async (page: Page, role: 'moderator' | 'speaker' = 'speaker') => { export const leaveRoom = async (page: Page, role: 'moderator' | 'speaker' = 'speaker') => {
const button = await waitForElementInIframe(page, '#leave-btn'); await interactWithElementInIframe(page, '#leave-btn', { action: 'click' });
await button.click();
if (role === 'moderator') { if (role === 'moderator') {
await page.waitForTimeout(500); // Wait for leave animation await page.waitForTimeout(500); // Wait for leave animation
const option = await waitForElementInIframe(page, '#leave-option'); await interactWithElementInIframe(page, '#leave-option', { action: 'click' });
await option.click();
} }
await page.waitForSelector('.event-left'); await page.waitForSelector('.event-left');
@ -286,7 +286,10 @@ export const applyVirtualBackground = async (page: Page, backgroundId: string) =
await interactWithElementInIframe(page, '#virtual-bg-btn', { action: 'click' }); await interactWithElementInIframe(page, '#virtual-bg-btn', { action: 'click' });
await waitForElementInIframe(page, 'ov-background-effects-panel', { state: 'visible' }); await waitForElementInIframe(page, 'ov-background-effects-panel', { state: 'visible' });
await interactWithElementInIframe(page, `#effect-${backgroundId}`, { action: 'click' }); await interactWithElementInIframe(page, `#effect-${backgroundId}`, { action: 'click' });
await page.waitForTimeout(2000); // Allow background processing time
await interactWithElementInIframe(page, '.panel-close-button', { action: 'click' }); await interactWithElementInIframe(page, '.panel-close-button', { action: 'click' });
await page.waitForTimeout(1000); // Wait panel to close
}; };
export const removeVirtualBackground = async (page: Page) => { export const removeVirtualBackground = async (page: Page) => {