- Add Next.js app structure with base configs, linting, and formatting - Implement LiveKit Meet page, types, and utility functions - Add Docker, Compose, and deployment scripts for backend and token server - Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers - Include CSS modules and global styles for UI - Add postMessage and studio integration utilities - Update package.json with dependencies and scripts for development and testing
50 lines
2.3 KiB
JavaScript
50 lines
2.3 KiB
JavaScript
const puppeteer = require('puppeteer-core');
|
|
|
|
(async () => {
|
|
try {
|
|
console.log('Conectando a Chrome remoto en http://localhost:9222 ...');
|
|
const browser = await puppeteer.connect({ browserURL: 'http://localhost:9222', defaultViewport: null });
|
|
console.log('Conectado a Chrome remoto. Abriendo nueva pestaña...');
|
|
const page = await browser.newPage();
|
|
await page.goto('http://localhost:5175', { waitUntil: 'networkidle2', timeout: 30000 });
|
|
console.log('Página cargada: http://localhost:5175');
|
|
|
|
// Intentar localizar botón por aria-label o por texto
|
|
const buttons = await page.$x("//button[contains(normalize-space(.), 'Entrar al estudio') or contains(@aria-label, 'Entrar al estudio')]");
|
|
if (!buttons || buttons.length === 0) {
|
|
console.log('No se encontró botón "Entrar al estudio" en la página. Buscando botones que contengan "Entrar"...');
|
|
const fallback = await page.$x("//button[contains(normalize-space(.), 'Entrar') or contains(@aria-label, 'Entrar')]");
|
|
if (!fallback || fallback.length === 0) {
|
|
console.log('No se encontró botón de entrada. Termino la ejecución.');
|
|
await browser.disconnect();
|
|
process.exit(0);
|
|
} else {
|
|
console.log('Se encontró botón fallback; haré click en el primero.');
|
|
await fallback[0].click();
|
|
}
|
|
} else {
|
|
console.log('Botón encontrado. Realizando click...');
|
|
await buttons[0].click();
|
|
}
|
|
|
|
// Esperar que la sessionStorage contenga la clave usada por useStudioLauncher
|
|
const storeKey = 'avanzacast_studio_session';
|
|
try {
|
|
await page.waitForFunction((k) => !!sessionStorage.getItem(k), { timeout: 10000 }, storeKey);
|
|
const val = await page.evaluate((k) => sessionStorage.getItem(k), storeKey);
|
|
console.log('sessionStorage key found:', storeKey);
|
|
console.log('Valor (truncado):', val ? (val.length > 300 ? val.slice(0,300) + '... (truncated)' : val) : val);
|
|
} catch (err) {
|
|
console.log('No se detectó la clave en sessionStorage dentro del timeout de 10s.');
|
|
}
|
|
|
|
console.log('El script se desconecta pero deja Chrome abierto para inspección manual.');
|
|
await browser.disconnect();
|
|
process.exit(0);
|
|
} catch (err) {
|
|
console.error('Error en el script de puppeteer:', err);
|
|
process.exit(1);
|
|
}
|
|
})();
|
|
|