فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A07): prove installed WebView2 SPA routes under simulated offline network
Run the ten real Tauri WebView2 UI routes under Chromium/CDP offline network emulation, reject error screens, capture bounded timing evidence and restore connectivity for artifact upload. Green CI: PR Quality #38947068027; Native Windows NSIS/WebView2 #38947068034. This is not a physical network outage or printer test.
davoodmehraban89 committed
Oct 16, 2026 at 22:01 UTC
0ae907d79a45e86ad897d48d4159e83115a7031e
1 file changed
+43
tests/windows-vm-installed-tauri-cdp.cjs
+43
@@ -337,6 +337,49 @@ async function connect(url) {
337
report.screenshot = 'UNVERIFIED: ' + screenshotError.message;
338
}
339
}
340
+ if (mode === 'fresh') {
341
+ // A07: emulate a disconnected WebView2 network on the REAL installed app.
342
+ // This is stronger than jsdom/offline browser preview but not an OS
343
+ // Wi-Fi disable, physical power loss, or a disconnected customer device.
344
+ await cdp.command('Network.enable');
345
+ await cdp.command('Network.emulateNetworkConditions', {
346
+ offline: true, latency: 0, downloadThroughput: 0, uploadThroughput: 0
347
+ });
348
+ try {
349
+ const offline = await cdp.evaluate(`(async () => {
350
+ if (navigator.onLine !== false) throw Error('WebView2 offline emulation did not set navigator offline');
351
+ const routes = [
352
+ 'dashboard','invoices','products','contacts','treasury',
353
+ 'cheques','expenses','reports','accounting','settings'
354
+ ];
355
+ const timings = [];
356
+ for (const route of routes) {
357
+ const t = performance.now();
358
+ await FINORA.Router.go(route);
359
+ const body = (document.getElementById('pageContent')?.textContent || '').trim();
360
+ if (FINORA.Router.current() !== route || body.length <= 10 ||
361
+ body.includes('خطا در بارگذاری صفحه') ||
362
+ document.querySelector('.toast-error') ||
363
+ document.getElementById('finoraAuthOverlay')) {
364
+ throw Error('Installed app route failed while offline: ' + route);
365
+ }
366
+ timings.push({ route, milliseconds: Math.round(performance.now() - t) });
367
+ }
368
+ await FINORA.Router.go('dashboard');
369
+ return { simulatedOffline: !navigator.onLine, routesChecked: timings.length,
370
+ routeDurationsMs: timings };
371
+ })()`, 45000);
372
+ assert.equal(offline.simulatedOffline, true);
373
+ assert.equal(offline.routesChecked, 10);
374
+ assert.equal(offline.routeDurationsMs.length, 10);
375
+ report.nativeOffline = offline;
376
+ } finally {
377
+ // Preserve the runner's network state for post-run evidence upload.
378
+ await cdp.command('Network.emulateNetworkConditions', {
379
+ offline: false, latency: 0, downloadThroughput: -1, uploadThroughput: -1
380
+ });
381
+ }
382
+ }
383
report.status = 'PASSED';
384
console.log(JSON.stringify(report, null, 2));
385
} catch (err) {