const { chromium } = require('playwright'); (async () => { const browser = await chromium.launch({ headless: true }); const context = await browser.newContext({ baseURL: 'http://localhost:5001', serviceWorkers: 'block' }); const page = await context.newPage(); const errors = []; page.on('pageerror', e => errors.push('PAGE: ' + e.message)); page.on('console', msg => { if (msg.type() === 'error') errors.push('CONSOLE: ' + msg.text()); }); page.on('response', res => { if (res.status() >= 400) errors.push(`HTTP ${res.status()}: ${res.url()}`); }); await page.goto('/pos/login2?tenant=31'); await page.waitForSelector('.user-avatar-btn', { timeout: 10000 }); await page.click('.user-avatar-btn[data-id="32"]'); for (const digit of '1234') await page.click(`.pin-key[data-digit="${digit}"]`); await page.click('#btn-login'); await page.waitForURL('**/pos/workshop', { timeout: 10000 }); await page.goto('/pos/catalog'); await page.waitForTimeout(1500); const info = await page.evaluate(() => ({ title: document.title, bodyClass: document.body.className, scripts: Array.from(document.querySelectorAll('script[src]')).map(s => s.src).filter(s => s.includes('sidebar') || s.includes('app-init')) })); console.log('Page info:', JSON.stringify(info, null, 2)); await page.screenshot({ path: '/home/Autopartes/data/rached_import/counter_sidebar_catalog.png', fullPage: true }); // Try dashboard await page.goto('/pos/dashboard'); await page.waitForTimeout(1500); await page.screenshot({ path: '/home/Autopartes/data/rached_import/counter_dashboard_redirect.png', fullPage: true }); console.log('URL after dashboard:', page.url()); console.log('Errors:', errors.length); errors.forEach(e => console.log(' -', e)); await browser.close(); })();