-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openvidu-components: Added basic test
- Loading branch information
Showing
3 changed files
with
58 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Run OpenVidu Components Angular test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Run tests | ||
run: | | ||
cd openvidu-components-angular/test | ||
./run-test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
const puppeteer = require('puppeteer'); | ||
|
||
(async () => { | ||
// Iniciar el navegador | ||
console.log('Iniciando navegador'); | ||
|
||
const args = process.argv.slice(2); | ||
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'; | ||
} | ||
|
||
const browser = await puppeteer.launch({ | ||
args: [ | ||
'--use-fake-ui-for-media-stream', | ||
'--use-fake-device-for-media-stream', | ||
], | ||
}); | ||
const page = await browser.newPage(); | ||
await page.goto('http://localhost:5080'); | ||
|
||
console.log('Navegando a la aplicación'); | ||
|
||
// Navegar a la aplicación | ||
await page.goto('https://192-168-1-47.openvidu-local.dev:5443'); | ||
|
||
// Esperar a que el elemento con el ID #join-button aparezca | ||
try { | ||
console.log('Esperando a que #join-button aparezca'); | ||
await page.waitForSelector('#join-button', { timeout: 10000 }); | ||
console.log('#join-button encontrado'); | ||
console.log(`Waiting for ${selctor} to appear in the DOM...`); | ||
await page.waitForSelector(selector, { timeout: 10000 }); | ||
console.log(`${selctor} found!`); | ||
} catch (error) { | ||
const screenshotPath = `screenshot-${Date.now()}.png`; | ||
await page.screenshot({ path: screenshotPath }); | ||
console.error('Error: #join-button no encontrado'); | ||
console.error(`Error: ${selector} not found`); | ||
console.error('ERROR!! Test failed: #join-button not found'); | ||
process.exit(1); // Salir del script con un código de error | ||
process.exit(1); | ||
} | ||
|
||
// Cerrar el navegador | ||
await browser.close(); | ||
})(); |