Skip to content

Commit

Permalink
openvidu-components: Fixed basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Jul 1, 2024
1 parent 51c0b31 commit 966a2e4
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 86 deletions.
161 changes: 93 additions & 68 deletions openvidu-components-angular/test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions openvidu-components-angular/test/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "openvidu-components",
"name": "openvidu-components-angular-test",
"version": "1.0.0",
"description": "",
"main": "start-test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"license": "Apache-2.0",
"dependencies": {
"puppeteer": "^22.10.0"
"puppeteer": "22.12.1"
}
}
29 changes: 14 additions & 15 deletions openvidu-components-angular/test/test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
const puppeteer = require('puppeteer');

(async () => {

const args = process.argv.slice(2);
const project = args[0];
let selector;
const project = args[0];
let selector;

// Determine the correct selector based on the project
if (project.includes('openvidu-admin-dashboard')) {
selector = 'ov-admin-login';
} else {
selector = '#join-button';
}
// Determine the correct selector based on the project
if (project.includes('openvidu-admin-dashboard')) {
selector = 'ov-admin-login';
} else {
selector = '#join-button';
}

const browser = await puppeteer.launch({
args: [
Expand All @@ -23,16 +22,16 @@ const puppeteer = require('puppeteer');
await page.goto('http://localhost:5080');

try {
console.log(`Waiting for ${selctor} to appear in the DOM...`);
console.log(`Waiting for ${selector} to appear in the DOM...`);
await page.waitForSelector(selector, { timeout: 10000 });
console.log(`${selctor} found!`);
console.log(`${selector} found!`);
} catch (error) {
const screenshotPath = `screenshot-${Date.now()}.png`;
await page.screenshot({ path: screenshotPath });
console.error(`Error: ${selector} not found`);
console.error('ERROR!! Test failed: #join-button not found');
process.exit(1);
console.error('ERROR!! Test failed: #join-button not found', error);
process.exit(1);
} finally {
await browser.close();
}

await browser.close();
})();

0 comments on commit 966a2e4

Please sign in to comment.