From a2e805ad18933d1ff4cb0954e2501f88a717e0d5 Mon Sep 17 00:00:00 2001 From: Ismail Jniah <36990177+IsmailJniah@users.noreply.github.com> Date: Thu, 21 Sep 2023 19:26:09 +0200 Subject: [PATCH] Update openvidu-react-web-tutorial.spec.js --- tests/openvidu-react-web-tutorial.spec.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/openvidu-react-web-tutorial.spec.js b/tests/openvidu-react-web-tutorial.spec.js index 5d8f8417..ec36f494 100644 --- a/tests/openvidu-react-web-tutorial.spec.js +++ b/tests/openvidu-react-web-tutorial.spec.js @@ -5,6 +5,7 @@ const { test, expect, chromium } = require('@playwright/test'); test('Checking for the presence of two active webcams in an OpenVidu session', async () => { const browser = await chromium.launch({ headless: true , deviceScaleFactor: 1, + userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36', args : ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream"] }); @@ -17,25 +18,27 @@ const browser = await chromium.launch({ headless: true , deviceScaleFactor: 1, await page1.click('#join input[type="submit"]'); await page1.waitForSelector('#session', { visible: true }); + await page1.waitForTimeout(5000); + //const page2 = await context.newPage(); - const page2 = await context.newPage(); - - await page2.goto('http://localhost:3000'); + //await page2.goto('http://localhost:3000'); //await page2.fill('#sessionId', 'SessionS'); - await page2.click('#join input[type="submit"]'); - await page2.waitForSelector('#session', { visible: true }); - await page2.waitForTimeout(5000); + //await page2.click('#join input[type="submit"]'); + //await page2.waitForSelector('#session', { visible: true }); + //await page2.waitForTimeout(5000); + + //await page2.screenshot({ path: 'page2.png' }); - await page2.screenshot({ path: 'pr.png' }); + await page1.screenshot({ path: 'page1.png' }); // Buscar los elementos HTML que contienen los streams de video - const videoElements = await page2.$$('video'); + const videoElements = await page1.$$('video'); // Comprobar que hay exactamente dos elementos encontrados expect(videoElements.length).toEqual(3); // Cerrar las páginas y el navegador. - await Promise.all([page1.close(), page2.close()]); + await Promise.all([page1.close()]); await browser.close(); });