Files
flutter_wisetronic/tools/e2e/diag.js
peima 944493a39b fix(runtime): e2e 发现的 3 个 bug 修复
- download: desktop_download_apps SingleChildScrollView 加 primary:true (Scrollbar 缺 ScrollPosition)
- contact-stores: checkDomainAvailability async 后 setState 加 mounted 保护 (dispose 后 setState)
- buy-service: _loadData 加 data 结构校验 + mounted 保护 (API 400 无效参数时 data 为错误结构 -> RangeError)
2026-08-01 23:20:25 +08:00

34 lines
1.4 KiB
JavaScript

// 诊断:对失败路由打印完整错误 + CK_STACK
const { chromium } = require('playwright');
const BASE = 'http://127.0.0.1:8099';
const ROUTES = ['/contact-stores', '/download', '/buy-service/1/pos'];
(async () => {
const browser = await chromium.launch({ headless: true });
for (const route of ROUTES) {
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } });
const page = await ctx.newPage();
const allLogs = [];
page.on('pageerror', e => allLogs.push(`PAGEERROR: ${e.message}`));
page.on('console', m => allLogs.push(m.text()));
await page.goto(BASE + route, { waitUntil: 'load', timeout: 30000 }).catch(e => allLogs.push('GOTO: ' + e.message.slice(0,80)));
await page.waitForTimeout(5000);
console.log(`\n########## ${route} ##########`);
// 只打印 CK_ERROR + CK_STACK + PAGEERROR
for (let i = 0; i < allLogs.length; i++) {
const l = allLogs[i];
if (l.startsWith('CK_ERROR:') || l.startsWith('PAGEERROR')) {
console.log(l.slice(0, 300));
// 找紧跟的 CK_STACK
if (allLogs[i+1] && allLogs[i+1].startsWith('CK_STACK:')) {
const proj = allLogs[i+1].match(/flutter_wisetronic\/[^\s]+:\d+/g);
console.log(' → 项目位置:', proj ? [...new Set(proj)].slice(0,4) : '(无项目帧)');
}
}
}
await ctx.close();
}
await browser.close();
})();