diff --git a/tests/openvidu-angular-web-tutorial.spec.js b/tests/openvidu-angular-web-tutorial.spec.js index 0cb9c872..e8c83928 100644 --- a/tests/openvidu-angular-web-tutorial.spec.js +++ b/tests/openvidu-angular-web-tutorial.spec.js @@ -30,6 +30,10 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.waitForSelector('#session', { visible: true }); await page1.waitForTimeout(5000); + var videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(2); + // Capture a screenshot of page1 and save it to a file. await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); @@ -47,7 +51,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2_screenshot.png' }); // Find HTML elements that contain video streams on page2. - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Check that there are exactly three elements found (should it be three or two?). expect(videoElements.length).toEqual(3); diff --git a/tests/openvidu-getaroom-test.spec.js b/tests/openvidu-getaroom-test.spec.js index 40e2f935..3e5657b2 100644 --- a/tests/openvidu-getaroom-test.spec.js +++ b/tests/openvidu-getaroom-test.spec.js @@ -35,6 +35,10 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a // Get the value of the 'input#copy-input' element. const inputValue = await page1.$eval('input#copy-input', (input) => input.value); + var videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(1); + // Capture a screenshot of page1 and save it to a file. await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); @@ -50,7 +54,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2_screenshot.png' }); // Find HTML elements that contain video streams on page2. - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Check that there are exactly two elements found. expect(videoElements.length).toEqual(2); diff --git a/tests/openvidu-hello-world-test.spec.js b/tests/openvidu-hello-world-test.spec.js index 59bf061e..b44a3dc8 100644 --- a/tests/openvidu-hello-world-test.spec.js +++ b/tests/openvidu-hello-world-test.spec.js @@ -26,7 +26,11 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a // Interact with page1, such as clicking a button and waiting for a specific element to become visible, then wait for a timeout.. await page1.click('#join input[type="submit"]'); await page1.waitForSelector('#session', { visible: true }); - await page2.waitForTimeout(5000); + await page1.waitForTimeout(5000); + + var videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(1); // Capture a screenshot of page1 and save it to a file. await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); @@ -43,7 +47,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2_screenshot.png' }); // Find HTML elements containing video streams on page2 and check if there are exactly two of them. - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); expect(videoElements.length).toEqual(2); // Close the pages and the browser. diff --git a/tests/openvidu-iframe-tutorial.spec.js b/tests/openvidu-iframe-tutorial.spec.js index a405edff..a12406e9 100644 --- a/tests/openvidu-iframe-tutorial.spec.js +++ b/tests/openvidu-iframe-tutorial.spec.js @@ -27,12 +27,18 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a let iframeHandle = await page1.waitForSelector('iframe.openvidu-iframe'); let frame = await iframeHandle.contentFrame(); - await page1.screenshot({ path: '../results/screenshots/page1_screensho.png' }); + // Click the "JOIN" button within the iframe and wait for the '#session' element to become visible. await frame.click('input[type="submit"]'); await frame.waitForSelector('#session', { visible: true }); + videoElements = await frame.$$('video'); + + expect(videoElements.length).toEqual(1); + + await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); + // Navigate to the specified URL on page2. await page2.goto('http://localhost:8081/'); iframeHandle = await page2.waitForSelector('iframe.openvidu-iframe'); @@ -47,7 +53,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2_screensho.png' }); // Find HTML elements within the frame that contain video streams. - const videoElements = await frame.$$('video'); + videoElements = await frame.$$('video'); // Check that there are exactly two elements found. expect(videoElements.length).toEqual(2); diff --git a/tests/openvidu-js-screen-share-tutorial.spec.js b/tests/openvidu-js-screen-share-tutorial.spec.js index e2cd568b..1e234891 100644 --- a/tests/openvidu-js-screen-share-tutorial.spec.js +++ b/tests/openvidu-js-screen-share-tutorial.spec.js @@ -28,6 +28,10 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.waitForSelector('#session', { visible: true }); await page1.waitForTimeout(5000); + videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(2); + // Capture a screenshot of page1 and save it to 'results/screenshot/page1.png'. await page1.screenshot({ path: '../results/screenshots/page1.png' }); @@ -45,7 +49,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2.png' }); // Find HTML elements within page2 that contain video streams. - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Check that there are exactly four elements found. expect(videoElements.length).toEqual(4); diff --git a/tests/openvidu-js-web-tutorial.spec.js b/tests/openvidu-js-web-tutorial.spec.js index f5d9e88d..fe3807b6 100644 --- a/tests/openvidu-js-web-tutorial.spec.js +++ b/tests/openvidu-js-web-tutorial.spec.js @@ -30,7 +30,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.waitForSelector('#session', { visible: true }); await page1.waitForTimeout(5000); - // Find HTML elements within page2 that contain video streams. + var videoElements = await page1.$$('video'); expect(videoElements.length).toEqual(2); diff --git a/tests/openvidu-react-web-tutorial.spec.js b/tests/openvidu-react-web-tutorial.spec.js index e3c35c85..4d2bbe27 100644 --- a/tests/openvidu-react-web-tutorial.spec.js +++ b/tests/openvidu-react-web-tutorial.spec.js @@ -31,6 +31,10 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.waitForSelector('#session', { visible: true }); await page1.waitForTimeout(5000); + var videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(2); + // Capture a screenshot of page1 and save it to a specific location. await page1.screenshot({ path: '../results/screenshots/page1.png' }); @@ -47,7 +51,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2.png' }); // Find HTML elements within page2 that contain video streams. - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Check that there are exactly three elements found. expect(videoElements.length).toEqual(3); diff --git a/tests/openvidu-recording-java-tutorial.spec.js b/tests/openvidu-recording-java-tutorial.spec.js index 82c7486b..2eb731fa 100644 --- a/tests/openvidu-recording-java-tutorial.spec.js +++ b/tests/openvidu-recording-java-tutorial.spec.js @@ -24,6 +24,11 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.click('#join-btn'); await page1.waitForSelector('#session', { visible: true }); + + videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(1); + await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); await page2.goto('https://localhost:5000'); @@ -40,7 +45,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2_stoprecording_screenshot.png' }); // Buscar los elementos HTML que contienen los streams de video - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Comprobar que hay exactamente dos elementos encontrados expect(videoElements.length).toEqual(2); diff --git a/tests/openvidu-recording-node-tutorial.spec.js b/tests/openvidu-recording-node-tutorial.spec.js index b8ae5b03..b60fff9c 100644 --- a/tests/openvidu-recording-node-tutorial.spec.js +++ b/tests/openvidu-recording-node-tutorial.spec.js @@ -23,6 +23,11 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.click('#join-btn'); await page1.waitForSelector('#session', { visible: true }); + + var videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(1); + await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); await page2.goto('http://localhost:5000'); @@ -39,7 +44,7 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.screenshot({ path: '../results/screenshots/page2_stoprecording_screenshot.png' }); // Buscar los elementos HTML que contienen los streams de video - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Comprobar que hay exactamente dos elementos encontrados expect(videoElements.length).toEqual(2); diff --git a/tests/openvidu-vue-tutorial.spec.js b/tests/openvidu-vue-tutorial.spec.js index 11c53c21..430e7a38 100644 --- a/tests/openvidu-vue-tutorial.spec.js +++ b/tests/openvidu-vue-tutorial.spec.js @@ -21,7 +21,12 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page1.fill('input[type="text"]', 'User1'); await page1.click('button.btn.btn-lg.btn-success'); await page1.waitForSelector('#session', { visible: true }); - + + videoElements = await page1.$$('video'); + + expect(videoElements.length).toEqual(2); + + await page1.screenshot({ path: '../results/screenshots/page1_screenshot.png' }); await page2.goto('http://localhost:8080'); await page2.fill('input[type="text"]', 'User2'); @@ -29,15 +34,15 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a await page2.waitForSelector('#session', { visible: true }); await page2.waitForTimeout(5000); - await page1.screenshot({ path: 'page1.png' }); - await page2.screenshot({ path: 'page2.png' }); - // Buscar los elementos HTML que contienen los streams de video - const videoElements = await page2.$$('video'); + videoElements = await page2.$$('video'); // Comprobar que hay exactamente dos elementos encontrados expect(videoElements.length).toEqual(3); - + + + await page2.screenshot({ path: '../results/screenshots/page2_screenshot.png' }); + // Cerrar las páginas y el navegador. await Promise.all([page1.close(), page2.close()]);