const { chromium } = require('playwright-core'); (async () => { const CHROME = String.raw`C:\Program Files\Google\Chrome\Application\chrome.exe`; const browser = await chromium.launch({ executablePath: CHROME, headless: true }); const page = await browser.newPage({ viewport: { width: 1366, height: 850 } }); const errs = []; page.on('pageerror', e => errs.push(e.message)); page.on('console', m => { if (m.type()==='error' && !m.text().includes('401')) errs.push(m.text()); }); const base = 'http://127.0.0.1:8010'; const r = await fetch(base + '/api/auth/login', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({phone:'13943441149',password:'Test1234'}) }); const tok = (await r.json()).access_token; await page.goto('http://127.0.0.1:5175/login'); await page.evaluate(t => { localStorage.setItem('access_token', t); localStorage.setItem('refresh_token','r'); }, tok); const views = [ {p:'/', n:'Home'}, {p:'/courseware/create', n:'CoursewareCreate'}, {p:'/courseware', n:'CoursewareList'}, {p:'/materials', n:'Materials'}, {p:'/resources', n:'Resources'}, {p:'/classroom', n:'Classroom'}, {p:'/community', n:'Community'}, {p:'/admin', n:'Admin'}, {p:'/profile', n:'Profile'}, ]; const results = []; for (const v of views) { const before = errs.length; await page.goto('http://127.0.0.1:5175' + v.p); await page.waitForTimeout(1800); const after = errs.length - before; const h1 = (await page.locator('h1').first().textContent().catch(()=> '')) || ''; const empty = await page.locator('.el-empty').count().catch(()=>0); results.push({ view: v.n, path: v.p, newErrs: after, h1: (h1||'').slice(0,40), emptyState: empty }); } console.log(JSON.stringify(results, null, 1)); console.log('TOTAL_NEW_ERRORS:', errs.length); if (errs.length) console.log('ERRORS:', [...new Set(errs)].slice(0,6)); await browser.close(); })();