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 errors = []; page.on('pageerror', e => errors.push(e.message)); page.on('console', m => { if (m.type()==='error') errors.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); await page.goto('http://127.0.0.1:5175/animation'); await page.waitForTimeout(2500); await page.locator('.tpl-btn').first().click(); await page.waitForTimeout(1500); // Click a setInterval template (solar-system), wait, then click probability await page.locator('.tg-search input').fill('行星'); await page.waitForTimeout(800); await page.locator('.tg-card').first().click(); await page.waitForTimeout(3000); // let its interval run errors.length = 0; // reset await page.locator('.tg-search input').fill('概率'); await page.waitForTimeout(800); await page.locator('.tg-card').first().click(); await page.waitForTimeout(2500); console.log('ERRORS_AFTER_SWITCH:', errors.length); if (errors.length) console.log('ERRORS:', errors.slice(0,5)); // also test: DNA (mine, uses setInterval) then probability errors.length = 0; await page.locator('.tg-search input').fill('DNA'); await page.waitForTimeout(800); await page.locator('.tg-card').first().click(); await page.waitForTimeout(3000); await page.locator('.tg-search input').fill('概率'); await page.waitForTimeout(800); await page.locator('.tg-card').first().click(); await page.waitForTimeout(2500); console.log('ERRORS_AFTER_DNA_TO_PROB:', errors.length); if (errors.length) console.log('ERRORS:', errors.slice(0,5)); await browser.close(); })();