Skip to content

Commit

Permalink
modified: Tests/TutorialTests/openvidu-react-web-tutorial.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
IsmailJniah committed Apr 24, 2024
1 parent 8baa5d0 commit f948174
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Tests/TutorialTests/openvidu-react-web-tutorial.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Import necessary Playwright libraries for testing.
// TEST OPENVIDU-REACT tutorial
const { test, expect, chromium } = require('@playwright/test');

// Define a test case for checking the presence of two active webcams in an OpenVidu session.
test('Checking for the presence of two active webcams in an OpenVidu session', async () => {
// Launch a headless Chromium browser with specific settings.
const browser = await chromium.launch({
headless: true,
deviceScaleFactor: 1,
userAgent: 'Chrome/88.0.4324.182',
deviceScaleFactor: 1, // Specify the page's scale factor
userAgent: 'Chrome/88.0.4324.182', // Specify the user agent
args: ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream"]
});

Expand All @@ -25,13 +25,13 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a
// Navigate to a specific URL on page1.
await page1.goto('http://localhost:3000');

// Fill in the username field, click the join button, and wait for the session to become visible.
// Fill in the '#userName' field with 'Page1', click the 'JOIN' button, and wait for the '#session' element to become visible.
await page1.fill('#userName', 'User1');
await page1.click('#join input[type="submit"]');
await page1.waitForSelector('#session', { visible: true });
await page1.waitForTimeout(5000);
await page1.waitForTimeout(1000);

/* var videoElements = await page1.$$('video');
var videoElements = await page1.$$('video');

expect(videoElements.length).toEqual(2);

Expand All @@ -42,25 +42,25 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a
expect(isPaused).not.toBe(true);

}
*/

// Capture a screenshot of page1 and save it to a file.
await page1.screenshot({ path: '../../results/screenshots/page1_screenshot.png' });

// Capture a screenshot of page1 and save it to a specific location.
await page1.screenshot({ path: '../../results/screenshots/page1.png' });

// Navigate to a specific URL on page2.
await page2.goto('http://localhost:3000');

// Fill in the username field, click the join button, and wait for the session to become visible.
// Fill in the '#userName' field with 'Page2', click the 'JOIN' button, wait for the '#session' element to become visible, and wait for 5 seconds.
await page2.fill('#userName', 'User2');
await page2.click('#join input[type="submit"]');
await page2.waitForSelector('#session', { visible: true });
await page2.waitForTimeout(5000);
await page2.waitForTimeout(1000);

// Capture a screenshot of page2 and save it to a specific location.
await page2.screenshot({ path: '../../results/screenshots/page2.png' });

// Find HTML elements within page2 that contain video streams.
var videoElements = await page2.$$('video');
videoElements = await page2.$$('video');

// Check that there are exactly three elements found.
expect(videoElements.length).toEqual(3);
Expand All @@ -73,7 +73,8 @@ test('Checking for the presence of two active webcams in an OpenVidu session', a

}

await page2.screenshot({ path: '../../results/screenshots/page2_screenshot.png' });



await Promise.all([page1.close(), page2.close()]);
await browser.close();
Expand Down

0 comments on commit f948174

Please sign in to comment.