diag: FlutterError.onError 加 CK_CTX (widget 上下文) 定位 RangeError 来源
This commit is contained in:
@@ -36,6 +36,7 @@ void main() {
|
||||
FlutterError.onError = (details) {
|
||||
FlutterError.presentError(details);
|
||||
print('CK_ERROR: ${details.exceptionAsString()}');
|
||||
print('CK_CTX: ${details.context.toString()}');
|
||||
print('CK_STACK: ${details.stack}');
|
||||
};
|
||||
// Enable configureApp will cause route problem.
|
||||
|
||||
14
tools/e2e/diag_buy.js
Normal file
14
tools/e2e/diag_buy.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await (await browser.newContext({viewport:{width:1280,height:900}})).newPage();
|
||||
const logs = [];
|
||||
page.on('console', m => logs.push(m.text()));
|
||||
page.on('pageerror', e => logs.push('PAGEERR: ' + e.message.slice(0,150)));
|
||||
page.on('response', async r => { if (r.url().includes('get-buy-service')) console.log('API:', r.status()); });
|
||||
await page.goto('http://127.0.0.1:8099/buy-service/1/pos', { waitUntil: 'load' }).catch(()=>{});
|
||||
await page.waitForTimeout(9000);
|
||||
console.log('--- RangeError 相关 console ---');
|
||||
logs.filter(l => l.includes('RangeError') || l.includes('CK_ERROR') || l.startsWith('PAGEERR')).slice(0,5).forEach(l => console.log(l.slice(0,180)));
|
||||
await browser.close();
|
||||
})();
|
||||
16
tools/e2e/test_buy_valid.js
Normal file
16
tools/e2e/test_buy_valid.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await (await browser.newContext({viewport:{width:1280,height:900}})).newPage();
|
||||
const errs = [];
|
||||
page.on('console', m => { if (m.text().includes('RangeError')||m.text().startsWith('CK_ERROR')) errs.push(m.text().slice(0,120)); });
|
||||
page.on('response', r => { if (r.url().includes('get-buy-service')) console.log(' API:', r.url().split('get-buy-service')[1], '→', r.status()); });
|
||||
// 试几个 service 参数
|
||||
for (const p of ['/buy-service/1/ministore', '/buy-service/1/igoshow', '/buy-service/310/ministore']) {
|
||||
errs.length = 0;
|
||||
await page.goto('http://127.0.0.1:8099'+p, { waitUntil: 'load' }).catch(()=>{});
|
||||
await page.waitForTimeout(6000);
|
||||
console.log(p, errs.length ? '✗ '+errs[0] : '✓ OK');
|
||||
}
|
||||
await browser.close();
|
||||
})();
|
||||
Reference in New Issue
Block a user