فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(ui): run real WebView2 navigation/button click inventory and capture ten route screenshots

davoodmehraban89 committed Oct 30, 2026 at 23:15 UTC 98e252c6466ac4f0ff21cc9abdd05f9c5f551d10
1 file changed +44
tests/windows-vm-installed-tauri-cdp.cjs
+44
@@ -371,6 +371,50 @@ async function connect(url) {
371 report.screenshot = 'UNVERIFIED: ' + screenshotError.message;
372 }
373 }
374 + if (mode === 'fresh') {
375 + // Q01: click every safe, visible route/tab/form opener in the installed
376 + // WebView2 (not only a preview). Financial writes remain separately
377 + // guarded by the real synthetic functional matrix already run above.
378 + const auditSource = fs.readFileSync(
379 + path.join(__dirname, 'windows-vm-ui-interaction-audit-browser.js'), 'utf8');
380 + const audit = await cdp.evaluate(auditSource, 240000);
381 + assert.equal(audit.environment, 'installed-Windows-Tauri-WebView2-synthetic-VM');
382 + assert.equal(audit.routesVisited, 10);
383 + assert.ok(audit.inventoryCount >= 25, 'Too few visible controls discovered');
384 + assert.ok(audit.safeClickCount >= 15, 'Safe interaction coverage unexpectedly low');
385 + assert.equal(audit.customerDataUsed, false);
386 + assert.equal(audit.financialActionsNotBulkClicked, true);
387 + assert.equal(audit.everyActionVerified, false,
388 + 'A safe-navigation sweep cannot claim every financial action is verified');
389 + report.nativeControlAudit = {
390 + routesVisited: audit.routesVisited, inventoryCount: audit.inventoryCount,
391 + safeClickCount: audit.safeClickCount, skippedCount: audit.skippedCount,
392 + accessibilityNameGaps: audit.accessibilityNameGaps,
393 + brokenHandlerCount: audit.brokenHandlerCount,
394 + problems: audit.problems.length, byRoute: audit.byRoute,
395 + evidenceFile: 'fresh-native-ui-control-click-audit.json',
396 + claim: 'safe-clicks-and-inventory-only-not-every-button-verified'
397 + };
398 + fs.writeFileSync(path.join(path.dirname(reportPath),
399 + report.nativeControlAudit.evidenceFile),
400 + JSON.stringify(audit, null, 2), { flag: 'wx' });
401 + const routeScreenshots = [];
402 + for (const route of audit.routeNames) {
403 + await cdp.evaluate('FINORA.Router.go(' + JSON.stringify(route) + ')', 20000);
404 + const screen = await cdp.command('Page.captureScreenshot', {
405 + format: 'png', captureBeyondViewport: false, fromSurface: true
406 + }, 20000);
407 + assert.ok(screen?.data, 'Screenshot missing for route ' + route);
408 + const image = Buffer.from(screen.data, 'base64');
409 + assert.ok(image.length > 1000 && image.subarray(1,4).toString('ascii') === 'PNG',
410 + 'Bad native WebView2 PNG for route ' + route);
411 + const filename = 'q01-ui-' + route + '.png';
412 + fs.writeFileSync(path.join(path.dirname(reportPath), filename, image, { flag: 'wx' }));
413 + routeScreenshots.push(filename);
414 + }
415 + report.nativeControlAudit.routeScreenshots = routeScreenshots;
416 + await cdp.evaluate('FINORA.Router.go("dashboard")');
417 + }
418 if (mode === 'fresh') {
419 // A07: emulate a disconnected WebView2 network on the REAL installed app.
420 // This is stronger than jsdom/offline browser preview but not an OS