فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A08): measure 10k products and 50k invoices inside installed native WebView2
Verify real NSIS-installed Windows Tauri/WebView2 IndexedDB in an isolated profile: seed 10k products/50k synthetic unposted invoices, validate counts, read P50/P95, and export credential-safe snapshot. Preserve NSIS upgrade, A01/A02/A04/A05, offline and ten-route functional checks. Windows VM #38950537874 and PR Quality #38950537639 successful. Measured 1003.1ms products, 7080.5ms invoices, p95 351.7ms, snapshot 426.3ms. Not a production SLA/crash test. A08 remains unaccepted.
davoodmehraban89 committed
Oct 16, 2026 at 22:28 UTC
e3c58982cfc2a947a3c16f4669d4335a86bd4b4a
4 files changed
+109
-3
.github/workflows/windows-vm-native-lab.yml
+1
@@ -14,6 +14,7 @@ on:
14
- 'tests/windows-vm-native-origin.test.mjs'
15
- 'tests/windows-vm-native-functional-matrix.cjs'
16
- 'tests/windows-vm-encrypted-company-backup-browser.js'
17
+ - 'tests/windows-vm-native-performance-browser.js'
18
- 'scripts/windows-vm-native-lab.ps1'
19
- 'scripts/windows-vm-set-candidate.cjs'
20
- '.github/workflows/windows-vm-native-lab.yml'
scripts/windows-vm-native-lab.ps1
+8
@@ -143,6 +143,14 @@ try {
143
$freshExe = Install-NSIS $CandidateInstaller $freshDir
144
$freshResult = Run-Native $freshExe $freshData 'fresh' $CandidateVersion
145
$summary.freshInstall = $freshResult.indexedDb
146
+
147
+ # A08: after all functional checks, measure the real installed candidate
148
+ # using a separate disposable WebView2/IndexedDB profile. Never mix with
149
+ # data-preservation or first-run validation profiles.
150
+ $performanceData = Join-Path $lab 'webview2-native-performance-profile'
151
+ $nativePerformance = Run-Native $freshExe $performanceData 'benchmark' $CandidateVersion
152
+ $summary.nativePerformance = $nativePerformance.nativePerformance
153
+
154
$summary.status = 'PASSED'
155
Write-Output 'Verified fresh installation, NSIS in-place upgrade, retained v6 records, native login and Windows DPAPI'
156
Cleanup-Installed $freshDir
tests/windows-vm-installed-tauri-cdp.cjs
+22
-3
@@ -11,10 +11,10 @@ const { verifyNativeOrigin } = require('./windows-vm-native-origin.cjs');
11
12
const [exe, profile, mode, expectedVersion, reportPath] = process.argv.slice(2);
13
assert.equal(process.platform, 'win32');
14
-assert.ok(['seed','upgrade','reopen','fresh'].includes(mode), 'unknown lab mode');
14
+assert.ok(['seed','upgrade','reopen','fresh','benchmark'].includes(mode), 'unknown lab mode');
15
assert.ok(fs.existsSync(exe), 'installed Windows executable missing');
16
fs.mkdirSync(profile, { recursive: true });
17
-const port = mode === 'seed' ? 9371 : mode === 'upgrade' ? 9372 : mode === 'reopen' ? 9374 : 9373;
17
+const port = mode === 'seed' ? 9371 : mode === 'upgrade' ? 9372 : mode === 'reopen' ? 9374 : mode === 'benchmark' ? 9375 : 9373;
18
const PASSWORD = 'VmOnly-Factor-83471!'; // Synthetic password, never printed.
19
20
const REG_POLICY = [
@@ -143,7 +143,7 @@ async function connect(url) {
143
assert.equal(ready.version, expectedVersion, 'candidate build runtime version mismatch');
144
}
145
const setup = ready.initialMode.includes('تعیین رمز');
146
- if (mode === 'seed' || mode === 'fresh') {
146
+ if (mode === 'seed' || mode === 'fresh' || mode === 'benchmark') {
147
assert.equal(setup, true, 'a new native profile must prompt to set the administrator password');
148
} else {
149
assert.equal(setup, false, 'upgrade/reopen should preserve existing administrator credentials');
@@ -380,6 +380,25 @@ async function connect(url) {
380
});
381
}
382
}
383
+ if (mode === 'benchmark') {
384
+ // A08 performance sample from the actually installed NSIS/Tauri/WebView2
385
+ // binary with a brand-new disposable profile, not Node fake-indexeddb.
386
+ // The separate profile prevents benchmark fixtures from affecting
387
+ // upgrade, accounting or restoration tests.
388
+ const code = fs.readFileSync(
389
+ path.join(__dirname, 'windows-vm-native-performance-browser.js'), 'utf8'
390
+ );
391
+ const measured = await cdp.evaluate(code, 240000);
392
+ assert.equal(measured.products, 10000);
393
+ assert.equal(measured.invoices, 50000);
394
+ assert.equal(measured.companyInvoices, 50000);
395
+ assert.equal(measured.environment, 'installed-Tauri-WebView2-IndexedDB');
396
+ assert.ok(measured.timingsMs.seedProducts >= 0 &&
397
+ measured.timingsMs.seedInvoices >= 0 &&
398
+ measured.timingsMs.companyInvoiceReadP95 >= 0 &&
399
+ measured.timingsMs.snapshotExport >= 0);
400
+ report.nativePerformance = measured;
401
+ }
402
report.status = 'PASSED';
403
console.log(JSON.stringify(report, null, 2));
404
} catch (err) {
tests/windows-vm-native-performance-browser.js
new
+78
@@ -0,0 +1,78 @@
1
+(async () => {
2
+ // A08 measured in the real installed Tauri/WebView2 IndexedDB with a fresh
3
+ // disposable Windows profile. Synthetic *unposted* records only.
4
+ const db = FINORA.Storage;
5
+ const company = await FINORA.Company.current();
6
+ const user = FINORA.Auth.current();
7
+ if (!company?.id || !user?.id || !FINORA.Auth.isAdmin() ||
8
+ !globalThis.__TAURI_INTERNALS__?.invoke) {
9
+ throw Error('Native A08 benchmark needs an installed desktop administrator');
10
+ }
11
+ const productCount = 10000;
12
+ const invoiceCount = 50000;
13
+ const t = fn => performance.now();
14
+ const duration = async work => {
15
+ const start = performance.now();
16
+ const value = await work();
17
+ return { ms: Math.round((performance.now() - start) * 100) / 100, value };
18
+ };
19
+ const batchWrite = async (name, count, generator) => {
20
+ const start = performance.now();
21
+ for (let i = 0; i < count; i += 200) {
22
+ const batch = Array.from({ length: Math.min(200, count - i) },
23
+ (_, offset) => generator(i + offset));
24
+ await db.transaction(name, async tx => {
25
+ await Promise.all(batch.map(item => tx.putRaw(name, item)));
26
+ });
27
+ }
28
+ return Math.round((performance.now() - start) * 100) / 100;
29
+ };
30
+ const productMs = await batchWrite('products', productCount, i => ({
31
+ id: 'vm-a08-product-' + i, companyId: company.id, ownerUserId: user.id,
32
+ name: 'VM synthetic item ' + i, code: 'VM-A08-' + i,
33
+ sellPrice: 1000 + i, trackInventory: false
34
+ }));
35
+ const invoiceMs = await batchWrite('invoices', invoiceCount, i => ({
36
+ id: 'vm-a08-invoice-' + i, companyId: company.id, ownerUserId: user.id,
37
+ number: String(i + 1), date: '1405/07/18', kind: 'sale',
38
+ isPreInvoice: true, financePosted: false,
39
+ grandTotal: 100000 + i, paidAmount: 0, remaining: 100000 + i
40
+ }));
41
+ const actualProducts = await db.count('products');
42
+ const actualInvoices = await db.count('invoices');
43
+ if (actualProducts !== productCount || actualInvoices !== invoiceCount) {
44
+ throw Error('Installed WebView2 seed count differs from requested A08 scale');
45
+ }
46
+ const samples = [];
47
+ for (let i = 0; i < 10; i++) {
48
+ const x = await duration(() => db.getByCompany('invoices', company.id));
49
+ if (x.value.length !== invoiceCount) {
50
+ throw Error('Installed WebView2 company invoice filter dropped records');
51
+ }
52
+ samples.push(x.ms);
53
+ }
54
+ samples.sort((a, b) => a - b);
55
+ const exported = await duration(() => db.exportAll());
56
+ const snap = exported.value;
57
+ if (snap.version !== 7 || snap.data.products.length !== productCount ||
58
+ snap.data.invoices.length !== invoiceCount ||
59
+ snap.data.users.some(x => x.pwHash || x.pwSalt || x.pass)) {
60
+ throw Error('A08 native performance snapshot is incomplete or has credentials');
61
+ }
62
+ const safe = x => Math.round(x * 100) / 100;
63
+ return {
64
+ environment: 'installed-Tauri-WebView2-IndexedDB',
65
+ products: productCount, invoices: invoiceCount,
66
+ companyInvoices: invoiceCount, companiesMeasured: 1,
67
+ unpostedSyntheticFixture: true,
68
+ timingsMs: {
69
+ seedProducts: productMs, seedInvoices: invoiceMs,
70
+ companyInvoiceReadP50: samples[4],
71
+ companyInvoiceReadP95: samples[9],
72
+ snapshotExport: exported.ms
73
+ },
74
+ measuredAt: new Date().toISOString(),
75
+ // No user/customer names, passwords, data payload or signing secrets.
76
+ note: 'Disposable native WebView2 sample; not a customer SLA, printer test or disk crash benchmark'
77
+ };
78
+})()
\ No newline at end of file