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)
This commit is contained in:
47
tools/e2e/dump_idb.js
Normal file
47
tools/e2e/dump_idb.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// dump IndexedDB 结构 + Hive entry 格式
|
||||
const { chromium } = require('playwright');
|
||||
const BASE = 'http://127.0.0.1:8099';
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await (await browser.newContext()).newPage();
|
||||
await page.goto(BASE + '/', { waitUntil: 'load', timeout: 60000 });
|
||||
await page.waitForTimeout(7000);
|
||||
|
||||
const result = await page.evaluate(async () => {
|
||||
const out = {};
|
||||
const dbs = await indexedDB.databases();
|
||||
out.databases = dbs.map(d => d.name);
|
||||
for (const db of dbs) {
|
||||
out[db.name] = [];
|
||||
await new Promise((resolve) => {
|
||||
const req = indexedDB.open(db.name);
|
||||
req.onsuccess = () => {
|
||||
const d = req.result;
|
||||
const stores = [...d.objectStoreNames];
|
||||
out[db.name + '_stores'] = stores;
|
||||
if (stores.length === 0) { d.close(); resolve(); return; }
|
||||
const tx = d.transaction(stores[0], 'readonly');
|
||||
const store = tx.objectStore(stores[0]);
|
||||
const allReq = store.getAll();
|
||||
const keysReq = store.getAllKeys();
|
||||
allReq.onsuccess = () => {
|
||||
out[db.name] = allReq.result.map((v, i) => {
|
||||
let hex = '';
|
||||
if (v instanceof ArrayBuffer) {
|
||||
const u = new Uint8Array(v);
|
||||
hex = Array.from(u.slice(0, 40)).map(b => b.toString(16).padStart(2,'0')).join(' ');
|
||||
return { key: keysReq.result[i], valueBytes: v.byteLength, hexFirst40: hex };
|
||||
}
|
||||
return { key: keysReq.result[i], value: typeof v === 'string' ? v.slice(0,80) : v };
|
||||
});
|
||||
};
|
||||
tx.oncomplete = () => { d.close(); resolve(); };
|
||||
};
|
||||
req.onerror = () => resolve();
|
||||
});
|
||||
}
|
||||
return out;
|
||||
});
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
await browser.close();
|
||||
})().catch(e => { console.error('失败:', e.message); process.exit(1); });
|
||||
Reference in New Issue
Block a user