فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(Q01): require exact native evidence for UI control coverage
davoodmehraban89 committed
Nov 1, 2026 at 15:27 UTC
2fd5ba6ebe49049f422847223c94f5368fa8bd39
4 files changed
+327
-70
scripts/q01-native-action-coverage.cjs
+263
-55
@@ -1,58 +1,266 @@
1
'use strict';
2
-const RULES=[
3
-{match:'window.InvoiceFormView._save(false)',scenarios:['purchase-and-post-ledger','partial-sale-and-inventory','sale-return-immutable-stock-and-ledger','purchase-return-and-stock-guardrails','return-cash-settlement-net-credit'],kind:'native-fixture-positive-and-negative',note:'فاکتور خرید، فروش و مرجوعی با اثر ثبتشده در نصب واقعی'},
4
-{match:'window.ContactsView.saveContact(',scenarios:['contacts-crud-form-and-tags'],kind:'native-ui-create-and-update',note:'ثبت و ویرایش شخص از فرم واقعی و ماندگاری برچسب در WebView2'},
5
-{match:'window.ProductsView.saveProduct(',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-create-and-update',note:'ثبت و ویرایش کالا از فرم واقعی با قیمت و نقطه سفارش و طبقهبندی انتخابشده'},
6
-{match:'window.ProductsView.saveUnit(true)',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-nested-create',note:'ایجاد واحد از پنجره تودرتو و انتخاب آن در فرم والد کالا'},
7
-{match:'window.ProductsView.saveCategory(true)',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-nested-create',note:'ایجاد گروه از پنجره تودرتو و انتخاب آن در فرم والد کالا'},
8
-{match:'window.StockKardexModal.openAdjustModal(',scenarios:['legacy-stock-adjustment-form-and-validation','integrated-stock-adjustment-guard'],kind:'native-ui-guarded-action',note:'اصلاح دستی در حالت قدیمی و جلوگیری از نمایش/فراخوانی آن در حسابداری یکپارچه'},
9
-{match:'window.StockKardexModal.saveAdjust(',scenarios:['legacy-stock-adjustment-form-and-validation'],kind:'native-ui-stock-posting',note:'رد مقدار منفی و دقت بیش از سه رقم و ثبت موجودی واقعی در نصب ویندوز'},
10
-{match:'window.TreasuryView.saveAccount(null)',scenarios:['partial-sale-and-inventory'],kind:'native-fixture-create',note:'ایجاد حساب خزانه در سناریوی فروش'},
11
-{match:'window.TreasuryView.saveAccount(',scenarios:['inactive-treasury-cheque-settlement'],kind:'native-ui-create-and-update',note:'ایجاد و ویرایش حساب خزانه از فرم واقعی در شرکت ساختگی'},
12
-{match:"window.TreasuryView._saveTransaction('transfer')",scenarios:['inactive-treasury-cheque-settlement'],kind:'native-fixture-positive-and-negative',note:'رد انتقال به حساب غیرفعال و ثبت موفق انتقال بین دو حساب فعال'},
13
-{match:"window.TreasuryView._saveTransaction('receipt')",scenarios:['return-cash-settlement-net-credit'],kind:'native-fixture-positive-and-negative',note:'رد دریافت بیش از مانده و ثبت دریافت مجاز'},
14
-{match:"window.TreasuryView._saveTransaction('payment')",scenarios:['return-cash-settlement-net-credit'],kind:'native-fixture-positive-and-negative',note:'رد بازپرداخت غیرمجاز و ثبت بازپرداخت تأییدشده'},
15
-{match:'window.ChequesView.saveCheque(null)',scenarios:['inactive-treasury-cheque-settlement','cheque-third-party-endorsement'],kind:'native-fixture-create',note:'ایجاد چک و اتصال دفتر کل'},
16
-{match:'window.ChequesView.changeStatus(',scenarios:['inactive-treasury-cheque-settlement','cheque-third-party-endorsement'],kind:'native-fixture-positive-and-negative',note:'وصول با بانک منتخب و واگذاری چک با تأیید'},
17
-{match:'window.AccountingView.savePeriod()',scenarios:['activate-accounting-and-inventory','fiscal-close-atomic-guardrails'],kind:'native-ui-period-create',note:'ایجاد دوره مالی ساختگی از فرم و آزمون بستن دوره'},
18
-{match:'window.AccountingView.saveWarehouse()',scenarios:['activate-accounting-and-inventory'],kind:'native-ui-warehouse-create',note:'ایجاد انبار ساختگی از فرم و تأیید ماندگاری'},
19
-{match:'window.AccountingView.previewOpeningFile()',scenarios:['positive-opening-ledger-and-idempotency','opening-dry-run-rejects-existing-postings'],kind:'native-fixture-positive-and-negative',note:'پیشنمایش و ثبت افتتاحیه، جلوگیری از تکرار و رد داده ناسازگار'},
2
21
-{match:'window.InvoiceFormView._save(true)',scenarios:['invoice-quick-add-and-save-print'],kind:'native-ui-create-and-print',note:'ثبت فاکتور از فرم و بازشدن تنظیمات چاپ با کالای و شخصی که در همان فرم سریع ساخته شدهاند'},
22
-{match:'window.InvoiceFormView._saveQuickContact()',scenarios:['invoice-quick-add-and-save-print'],kind:'native-ui-nested-create',note:'ساخت شخص از پنجره سریع و انتخاب آن در فاکتور والد'},
23
-{match:'window.InvoiceFormView._saveQuickProduct()',scenarios:['invoice-quick-add-and-save-print'],kind:'native-ui-nested-create',note:'ساخت خدمت از پنجره سریع و افزودن آن به ردیف فاکتور والد'},
24
-{match:'window.InvoicePrint._print()',scenarios:['invoice-quick-add-and-save-print'],kind:'native-rtl-print-render',note:'ساخت HTML چاپ فاکتور ذخیرهشده با محتوای فارسی و راستبهچپ؛ چاپگر فیزیکی آزمایش نشده'},
25
-{match:'window.StockKardexModal._printKardex(',scenarios:['auxiliary-rtl-print-rendering'],kind:'native-rtl-print-render',note:'تولید و ارسال سند چاپ راستبهچپ کاردکس برای کالاهای ساختگی'},
26
-{match:'window.ContactLedgerModal._printLedger(',scenarios:['auxiliary-rtl-print-rendering'],kind:'native-rtl-print-render',note:'تولید سند چاپ راستبهچپ دفتر اشخاص برای اشخاص ساختگی'},
27
-{match:'window.ReportsView._printReport()',scenarios:['auxiliary-rtl-print-rendering'],kind:'native-rtl-print-render',note:'تولید سند چاپ راستبهچپ گزارش مالی؛ چاپگر فیزیکی آزمایش نشده'},
28
-{match:'window.ExpensesView._promptNewCategory()',scenarios:['expense-form-category-and-posting'],kind:'native-ui-category-create',note:'افزودن سرفصل ساختگی در فرم هزینه و انتخاب آن قبل از ثبت'},
29
-{match:'window.ExpensesView.saveExpense(null)',scenarios:['expense-form-category-and-posting'],kind:'native-ui-financial-posting',note:'ثبت هزینه از فرم واقعی و تطبیق سند قطعی دفتر کل'},
30
-{match:'window.TreasuryView.saveAccount(',scenarios:['inactive-treasury-cheque-settlement'],kind:'native-ui-create-and-update',note:'ایجاد و ویرایش حساب خزانه از فرم واقعی در شرکت ساختگی'},
31
-{match:"window.AccountingView.addJournalRow()",scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-row-edit',note:'افزودن ردیف به فرم سند دستی حسابداری'},
32
-{match:"window.AccountingView.saveJournal('draft')",scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-draft-posting',note:'ثبت پیشنویس سند دستی در دوره باز'},
33
-{match:"window.AccountingView.saveJournal('posted')",scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-final-posting',note:'قطعیسازی سند دستی متوازن از پیشنویس'},
34
-{match:'window.AccountingView.saveReversal()',scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-reversal-posting',note:'ثبت سند معکوس مستقل و حفظ سند اصلی'},
35
-{match:'window.AccountingView.saveAccount()',scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-chart-account-create',note:'ایجاد گروه کدینگ ساختگی از فرم حسابداری'},
36
-{match:'window.AccountingView.exportReports()',scenarios:['manual-journal-reversal-and-exports'],kind:'native-csv-export',note:'خروجی CSV دفتر کل با سند ساختگی قطعی'},
37
-{match:'window.AccountingView.exportReconciliation()',scenarios:['manual-journal-reversal-and-exports'],kind:'native-csv-export',note:'خروجی CSV کنترل مغایرت با شمای مورد انتظار'},
38
-{match:'window.AccountingView.saveTransfer()',scenarios:['inventory-transfer-and-stocktake'],kind:'native-ui-inventory-transfer',note:'انتقال مقدار دقیق کالا بین دو انبار واقعی ساختگی'},
39
-{match:'window.AccountingView.createStocktake()',scenarios:['inventory-transfer-and-stocktake'],kind:'native-ui-stocktake-create',note:'ایجاد جلسه انبارگردانی از فرم واقعی'},
40
-{match:'window.AccountingView.saveStocktake()',scenarios:['inventory-transfer-and-stocktake'],kind:'native-ui-stocktake-save',note:'ذخیره شمارش همه اقلام جلسه ساختگی'},
41
-{match:'window.AccountingView.finishStocktake()',scenarios:['inventory-transfer-and-stocktake'],kind:'native-ui-stocktake-finalize',note:'تأیید نهایی شمارش همسان با موجودی و بستن جلسه'}
42
-,
43
-{match:'window.SettingsView.downloadBackup()',flag:'encryptedCompanyBackup',kind:'native-encrypted-backup-ui',note:'خروجی رمزگذاریشده fbackup از رابط تنظیمات'},
44
-{match:'window.SettingsView.restoreBackup()',flag:'encryptedCompanyBackup',kind:'native-encrypted-backup-ui',note:'بازیابی رابط کاربری، رد رمز و فایل خراب و rollback تراکنشی'},
45
-{match:'window.ProductsView.saveUnit(false)',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-standalone-create',note:'ایجاد واحد از تب مستقل واحدها و ثبت در فهرست'},
46
-{match:'window.ProductsView.saveCategory(false)',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-standalone-create',note:'ایجاد گروه از تب مستقل گروهها و ثبت در فهرست'},
47
-{match:'window.ProductsView.deleteUnit(',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-synthetic-delete',note:'حذف واحد ساختگی و بدون ارجاع از دکمه ردیف و تأیید صریح'},
48
-{match:'window.ProductsView.deleteCategory(',scenarios:['products-crud-form-and-nested-classifiers'],kind:'native-ui-synthetic-delete',note:'حذف گروه ساختگی و بدون ارجاع از دکمه ردیف و تأیید صریح'},
49
-{match:'window.ExpensesView.editExpense(',scenarios:['expense-form-category-and-posting'],kind:'native-ui-draft-edit',note:'ویرایش پیشنویس ساختگی و رد ویرایش سند قطعی مالی از فرم'},
50
-{match:'window.AccountingView.showJournal(',scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-read-only-details',note:'نمایش جزئیات سند قطعی ساختگی از صفحه اسناد'},
51
-{match:'window.AccountingView.openReversal(',scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-reversal-form',note:'بازکردن فرم برگشت برای سند ساختگی و ثبت برگشت متوازن مستقل'},
52
-{match:'this.closest(\'tr\').remove()',scenarios:['manual-journal-reversal-and-exports'],kind:'native-ui-draft-row-remove',note:'حذف ردیف اضافه از فرم پیشنویس بدون ثبت سند'}
3
+const RULES = [
4
+ { match:'window.InvoiceFormView._save(false)', checks:{
5
+ 'purchase-and-post-ledger':['purchasePosted'],
6
+ 'partial-sale-and-inventory':['salePosted'],
7
+ 'sale-return-immutable-stock-and-ledger':['separatePostedReturn','balancedLedgerAndReturnedStock','postedOriginalImmutable'],
8
+ 'purchase-return-and-stock-guardrails':['postedSupplierReturn','balancedLedger','stockIssued','originalPurchaseImmutable']
9
+ }, kind:'native-fixture-positive-and-negative',
10
+ note:'ثبت خرید، فروش و مرجوعی با سند متوازن، موجودی و حفظ سند اولیه در نصب واقعی' },
11
+ { match:'window.ContactsView.saveContact(', checks:{
12
+ 'contacts-crud-form-and-tags':['createdThroughForm','editedThroughForm','tagPersisted']
13
+ }, kind:'native-ui-create-and-update',
14
+ note:'ثبت و ویرایش شخص از فرم واقعی و ماندگاری برچسب در WebView2' },
15
+ { match:'window.ProductsView.saveProduct(', checks:{
16
+ 'products-crud-form-and-nested-classifiers':['createdThroughForm','editedThroughForm','fractionalReorderPointPreserved']
17
+ }, kind:'native-ui-create-and-update',
18
+ note:'ثبت و ویرایش کالا از فرم واقعی با قیمت، نقطه سفارش و طبقهبندی انتخابشده' },
19
+ { match:'window.ProductsView.saveUnit(true)', checks:{
20
+ 'products-crud-form-and-nested-classifiers':['nestedUnitSavedAndSelected']
21
+ }, kind:'native-ui-nested-create',
22
+ note:'ایجاد واحد از پنجره تودرتو و انتخاب آن در فرم والد کالا' },
23
+ { match:'window.ProductsView.saveCategory(true)', checks:{
24
+ 'products-crud-form-and-nested-classifiers':['nestedCategorySavedAndSelected']
25
+ }, kind:'native-ui-nested-create',
26
+ note:'ایجاد گروه از پنجره تودرتو و انتخاب آن در فرم والد کالا' },
27
+ { match:'window.StockKardexModal.openAdjustModal(', checks:{
28
+ 'legacy-stock-adjustment-form-and-validation':['validAdjustmentPosted'],
29
+ 'integrated-stock-adjustment-guard':['manualAdjustmentHidden','directOpenBlocked','directSaveBlocked']
30
+ }, kind:'native-ui-guarded-action',
31
+ note:'اصلاح دستی در حالت قدیمی و جلوگیری از نمایش و اجرای آن در حسابداری یکپارچه' },
32
+ { match:'window.StockKardexModal.saveAdjust(', checks:{
33
+ 'legacy-stock-adjustment-form-and-validation':['overPrecisionRejectedWithoutWrites','negativeRejectedWithoutWrites','validAdjustmentPosted','fractionalQuantityPreserved']
34
+ }, kind:'native-ui-stock-posting',
35
+ note:'رد مقدار منفی و دقت بیش از سه رقم و ثبت موجودی واقعی در نصب ویندوز' },
36
+ { match:'window.TreasuryView.saveAccount(null)', checks:{
37
+ 'inactive-treasury-cheque-settlement':['treasuryAccountCreatedThroughForm']
38
+ }, kind:'native-ui-create',
39
+ note:'ایجاد حساب خزانه ساختگی از فرم واقعی و اتصال آن به معین' },
40
+ { match:'window.TreasuryView.saveAccount(', checks:{
41
+ 'inactive-treasury-cheque-settlement':['treasuryAccountEditPersisted']
42
+ }, kind:'native-ui-update',
43
+ note:'ویرایش حساب خزانه از فرم واقعی در شرکت ساختگی' },
44
+ { match:"window.TreasuryView._saveTransaction('transfer')", checks:{
45
+ 'inactive-treasury-cheque-settlement':['inactiveTransferRejected','invalidTransferRolledBack','validTransferPosted']
46
+ }, kind:'native-fixture-positive-and-negative',
47
+ note:'رد انتقال به حساب غیرفعال و ثبت دقیق انتقال بین دو حساب فعال' },
48
+ { match:"window.TreasuryView._saveTransaction('receipt')", checks:{
49
+ 'return-cash-settlement-net-credit':['overcollectionRejectedWithoutWrites','netReceiptAccepted']
50
+ }, kind:'native-fixture-positive-and-negative',
51
+ note:'رد دریافت بیش از مانده و ثبت دریافت مجاز' },
52
+ { match:"window.TreasuryView._saveTransaction('payment')", checks:{
53
+ 'return-cash-settlement-net-credit':['nonexistentRefundCreditRejected','authorizedRefundTracedInInstalledWebView2']
54
+ }, kind:'native-fixture-positive-and-negative',
55
+ note:'رد بازپرداخت بدون اعتبار واقعی و ثبت بازپرداخت مجاز با ردپای تأیید' },
56
+ { match:'window.ChequesView.saveCheque(null)', checks:{
57
+ 'inactive-treasury-cheque-settlement':['chequeCreatedThroughForm']
58
+ }, kind:'native-ui-cheque-create',
59
+ note:'ایجاد چک ساختگی از فرم واقعی و ثبت سند دفتر کل' },
60
+ { match:'window.ChequesView.changeStatus(', checks:{
61
+ 'inactive-treasury-cheque-settlement':['disabledChequeClearingRejected','validChequeClearedExactlyOnce','confirmationRequiredBeforeCash'],
62
+ 'cheque-third-party-endorsement':['missingEndorseeRejected','confirmationRequiredBeforeWrite','endorseeLedgerDimensionCorrect','appendOnlyEndorsementCorrelated','noPhantomCash']
63
+ }, kind:'native-fixture-positive-and-negative',
64
+ note:'رد وصول بدون بانک فعال، وصول با حساب منتخب و واگذاری چک با تأیید' },
65
+ { match:'window.AccountingView.savePeriod()', checks:{
66
+ 'activate-accounting-and-inventory':['periodCreatedByForm'],
67
+ 'fiscal-close-atomic-guardrails':['successfulCloseCommitted','duplicateCloseRejected']
68
+ }, kind:'native-ui-period-create',
69
+ note:'ایجاد دوره مالی از فرم واقعی و آزمون بستن اتمیک دوره' },
70
+ { match:'window.AccountingView.saveWarehouse()', checks:{
71
+ 'activate-accounting-and-inventory':['warehouseCreatedByForm']
72
+ }, kind:'native-ui-warehouse-create',
73
+ note:'ایجاد انبار ساختگی از فرم و تأیید ماندگاری' },
74
+ { match:'window.AccountingView.previewOpeningFile()', checks:{
75
+ 'positive-opening-ledger-and-idempotency':['dryRunFirst','postedBalancedOpening','repeatPostingBlocked'],
76
+ 'opening-dry-run-rejects-existing-postings':['priorActivityBlocked','discrepancyCodesVisible','zeroWrites']
77
+ }, kind:'native-fixture-positive-and-negative',
78
+ note:'پیشنمایش و ثبت افتتاحیه، جلوگیری از تکرار و رد داده ناسازگار' },
79
+ { match:'window.InvoiceFormView._save(true)', checks:{
80
+ 'invoice-quick-add-and-save-print':['quickContactCreated','quickProductCreated','saveAndPrintOpened','invoicePrintRendered','invoicePosted']
81
+ }, kind:'native-ui-create-and-print',
82
+ note:'ثبت فاکتور از فرم و بازشدن تنظیمات چاپ با کالای و شخصی که در همان فرم سریع ساخته شدهاند' },
83
+ { match:'window.InvoiceFormView._saveQuickContact()', checks:{
84
+ 'invoice-quick-add-and-save-print':['quickContactCreated']
85
+ }, kind:'native-ui-nested-create',
86
+ note:'ساخت شخص از پنجره سریع و انتخاب آن در فاکتور والد' },
87
+ { match:'window.InvoiceFormView._saveQuickProduct()', checks:{
88
+ 'invoice-quick-add-and-save-print':['quickProductCreated']
89
+ }, kind:'native-ui-nested-create',
90
+ note:'ساخت خدمت از پنجره سریع و افزودن آن به ردیف فاکتور والد' },
91
+ { match:'window.InvoicePrint._print()', checks:{
92
+ 'invoice-quick-add-and-save-print':['invoicePrintRendered','invoicePosted']
93
+ }, kind:'native-rtl-print-render',
94
+ note:'ساخت HTML چاپ فاکتور ذخیرهشده با محتوای فارسی و راستبهچپ؛ چاپگر فیزیکی آزمایش نشده' },
95
+ { match:'window.StockKardexModal._printKardex(', checks:{
96
+ 'auxiliary-rtl-print-rendering':['kardexPrints','allDocumentsRtl']
97
+ }, kind:'native-rtl-print-render',
98
+ note:'تولید و ارسال سند چاپ راستبهچپ کاردکس برای کالاهای ساختگی' },
99
+ { match:'window.ContactLedgerModal._printLedger(', checks:{
100
+ 'auxiliary-rtl-print-rendering':['contactLedgerPrints','allDocumentsRtl']
101
+ }, kind:'native-rtl-print-render',
102
+ note:'تولید سند چاپ راستبهچپ دفتر اشخاص برای اشخاص ساختگی' },
103
+ { match:'window.ReportsView._printReport()', checks:{
104
+ 'auxiliary-rtl-print-rendering':['reportsPrintRendered','allDocumentsRtl']
105
+ }, kind:'native-rtl-print-render',
106
+ note:'تولید سند چاپ راستبهچپ گزارش مالی؛ چاپگر فیزیکی آزمایش نشده' },
107
+ { match:'window.ExpensesView._promptNewCategory()', checks:{
108
+ 'expense-form-category-and-posting':['customCategorySelected']
109
+ }, kind:'native-ui-category-create',
110
+ note:'افزودن سرفصل ساختگی در فرم هزینه و انتخاب آن قبل از ثبت' },
111
+ { match:'window.ExpensesView.saveExpense(null)', checks:{
112
+ 'expense-form-category-and-posting':['expenseCreatedThroughForm','expenseJournalPosted']
113
+ }, kind:'native-ui-financial-posting',
114
+ note:'ثبت هزینه از فرم واقعی و تطبیق سند قطعی دفتر کل' },
115
+ { match:'window.AccountingView.addJournalRow()', checks:{
116
+ 'manual-journal-reversal-and-exports':['journalRowAdded']
117
+ }, kind:'native-ui-row-edit',
118
+ note:'افزودن ردیف به فرم سند دستی حسابداری' },
119
+ { match:"window.AccountingView.saveJournal('draft')", checks:{
120
+ 'manual-journal-reversal-and-exports':['draftJournalSaved']
121
+ }, kind:'native-ui-draft-posting',
122
+ note:'ثبت پیشنویس سند دستی در دوره باز' },
123
+ { match:"window.AccountingView.saveJournal('posted')", checks:{
124
+ 'manual-journal-reversal-and-exports':['journalPosted']
125
+ }, kind:'native-ui-final-posting',
126
+ note:'قطعیسازی سند دستی متوازن از پیشنویس' },
127
+ { match:'window.AccountingView.saveReversal()', checks:{
128
+ 'manual-journal-reversal-and-exports':['reversalPosted']
129
+ }, kind:'native-ui-reversal-posting',
130
+ note:'ثبت سند معکوس مستقل و حفظ سند اصلی' },
131
+ { match:'window.AccountingView.saveAccount()', checks:{
132
+ 'manual-journal-reversal-and-exports':['chartAccountCreated']
133
+ }, kind:'native-ui-chart-account-create',
134
+ note:'ایجاد گروه کدینگ ساختگی از فرم حسابداری' },
135
+ { match:'window.AccountingView.exportReports()', checks:{
136
+ 'manual-journal-reversal-and-exports':['ledgerCsvExported']
137
+ }, kind:'native-csv-export',
138
+ note:'خروجی CSV دفتر کل با سند ساختگی قطعی' },
139
+ { match:'window.AccountingView.exportReconciliation()', checks:{
140
+ 'manual-journal-reversal-and-exports':['reconciliationCsvExported']
141
+ }, kind:'native-csv-export',
142
+ note:'خروجی CSV کنترل مغایرت با شمای مورد انتظار' },
143
+ { match:'window.AccountingView.saveTransfer()', checks:{
144
+ 'inventory-transfer-and-stocktake':['secondWarehouseCreated','transferPosted','exactInventoryMoved']
145
+ }, kind:'native-ui-inventory-transfer',
146
+ note:'انتقال مقدار دقیق کالا بین دو انبار واقعی ساختگی' },
147
+ { match:'window.AccountingView.createStocktake()', checks:{
148
+ 'inventory-transfer-and-stocktake':['stocktakeCreated']
149
+ }, kind:'native-ui-stocktake-create',
150
+ note:'ایجاد جلسه انبارگردانی از فرم واقعی' },
151
+ { match:'window.AccountingView.saveStocktake()', checks:{
152
+ 'inventory-transfer-and-stocktake':['stocktakeCountsSaved']
153
+ }, kind:'native-ui-stocktake-save',
154
+ note:'ذخیره شمارش همه اقلام جلسه ساختگی' },
155
+ { match:'window.AccountingView.finishStocktake()', checks:{
156
+ 'inventory-transfer-and-stocktake':['stocktakeFinalized']
157
+ }, kind:'native-ui-stocktake-finalize',
158
+ note:'تأیید نهایی شمارش همسان با موجودی و بستن جلسه' },
159
+ { match:'window.SettingsView.downloadBackup()', flag:'encryptedCompanyBackup',
160
+ kind:'native-encrypted-backup-ui',note:'خروجی رمزگذاریشده fbackup از رابط تنظیمات' },
161
+ { match:'window.SettingsView.restoreBackup()', flag:'encryptedCompanyBackup',
162
+ kind:'native-encrypted-backup-ui',note:'بازیابی رابط کاربری، رد رمز و فایل خراب و rollback تراکنشی' },
163
+ { match:'window.ProductsView.saveUnit(false)', checks:{
164
+ 'products-crud-form-and-nested-classifiers':['standaloneUnitCreatedAndDeleted']
165
+ }, kind:'native-ui-standalone-create',
166
+ note:'ایجاد واحد از تب مستقل واحدها و ثبت در فهرست' },
167
+ { match:'window.ProductsView.saveCategory(false)', checks:{
168
+ 'products-crud-form-and-nested-classifiers':['standaloneCategoryCreatedAndDeleted']
169
+ }, kind:'native-ui-standalone-create',
170
+ note:'ایجاد گروه از تب مستقل گروهها و ثبت در فهرست' },
171
+ { match:'window.ProductsView.deleteUnit(', checks:{
172
+ 'products-crud-form-and-nested-classifiers':['standaloneUnitCreatedAndDeleted']
173
+ }, kind:'native-ui-synthetic-delete',
174
+ note:'حذف واحد ساختگی و بدون ارجاع از دکمه ردیف و تأیید صریح' },
175
+ { match:'window.ProductsView.deleteCategory(', checks:{
176
+ 'products-crud-form-and-nested-classifiers':['standaloneCategoryCreatedAndDeleted']
177
+ }, kind:'native-ui-synthetic-delete',
178
+ note:'حذف گروه ساختگی و بدون ارجاع از دکمه ردیف و تأیید صریح' },
179
+ { match:'window.ExpensesView.editExpense(', checks:{
180
+ 'expense-form-category-and-posting':['draftExpenseEditedThroughForm','postedExpenseEditRejected']
181
+ }, kind:'native-ui-draft-edit',
182
+ note:'ویرایش پیشنویس ساختگی و رد ویرایش سند قطعی مالی از فرم' },
183
+ { match:'window.AccountingView.showJournal(', checks:{
184
+ 'manual-journal-reversal-and-exports':['journalDetailsOpened']
185
+ }, kind:'native-ui-read-only-details',
186
+ note:'نمایش جزئیات سند قطعی ساختگی از صفحه اسناد' },
187
+ { match:'window.AccountingView.openReversal(', checks:{
188
+ 'manual-journal-reversal-and-exports':['reversalFormOpened','reversalPosted']
189
+ }, kind:'native-ui-reversal-form',
190
+ note:'بازکردن فرم برگشت برای سند ساختگی و ثبت برگشت متوازن مستقل' },
191
+ { match:"this.closest('tr').remove()", checks:{
192
+ 'manual-journal-reversal-and-exports':['journalRowRemoveButtonClicked']
193
+ }, kind:'native-ui-draft-row-remove',
194
+ note:'حذف ردیف اضافه از فرم پیشنویس بدون ثبت سند' },
195
+ { match:'FINORA.Modal.close()', probe:'modalKeyboard',
196
+ checks:['escapeClosesWithoutConfirm','focusReturnsToTrigger','cancelDoesNotConfirmAndRestoresFocus','nestedDialogIsolation'],
197
+ kind:'native-shared-modal-close-contract',
198
+ note:'رفتار مشترک بستن مودال با Escape و لغو، حفظ فوکوس و جداسازی مودال تودرتو؛ کلیک مستقیم تکتک دکمههای بستن مشاهده نشده' },
199
+ { match:"FINORA.Router.go('invoices')", probe:'routesVisited', expected:10,
200
+ kind:'native-route-navigation',
201
+ note:'دسترسی واقعی به هر ۱۰ مسیر اصلی در WebView2؛ این شاهد کلیک مستقیم تکتک لینکها نیست' }
202
];
54
-function hasEvidence(rule,evidence){if(rule.flag)return evidence[rule.flag]===true;const results=evidence.nativeFunctional||{};return rule.scenarios.every(name=>{const result=results[name];return !!result&&typeof result==='object'&&!Array.isArray(result)&&Object.keys(result).length>0&&!Object.values(result).some(value=>value===false)&&Object.values(result).some(value=>value===true);});}
55
-function coverageFor(handler,evidence){if(!handler)return null;const rule=RULES.find(item=>handler.includes(item.match)&&hasEvidence(item,evidence));return rule?{kind:rule.kind,scenarios:rule.scenarios||[],summary:rule.note}:null;}
56
-function annotateAudit(audit,evidence={}){if(!audit||!Array.isArray(audit.uniqueActions)||!Array.isArray(audit.controls))throw Error('Q01_FIXTURE_COVERAGE_INVALID_AUDIT');for(const row of [...audit.uniqueActions,...audit.controls])row.fixtureCoverage=coverageFor(row.handler,evidence);const pending=audit.uniqueActions.filter(x=>x.status==='not-clicked');const covered=pending.filter(x=>x.fixtureCoverage);const uncovered=pending.filter(x=>!x.fixtureCoverage);return {uniqueActionCount:audit.uniqueActions.length,notClicked:pending.length,disabled:audit.uniqueActions.filter(x=>x.status==='disabled').length,fixtureCoveredNotClicked:covered.length,withoutFixtureEvidence:uncovered.length,entries:covered.map(x=>({route:x.route,label:x.label,handler:x.handler,status:x.status,coverage:x.fixtureCoverage}))};}
57
-function buildCoverageReport(result){if(!result||!Array.isArray(result.entries))throw Error('Q01_FIXTURE_COVERAGE_INVALID_REPORT');const lines=['# Q01 — شواهد سناریوهای مستقل برای کنترلهای کلیکنشده','','این گزارش جایگزین کلیک مستقیم یا تأیید تکتک دکمهها نیست؛ فقط فراخوانی همان handler در سناریوی مستقل نصب واقعی WebView2 را نشان میدهد.','', '- امضاهای متمایز: '+result.uniqueActionCount,'- امضاهای کلیکنشده: '+result.notClicked,'- کنترلهای غیرفعال: '+(result.disabled||0),'- دارای شواهد سناریوی مستقل: '+result.fixtureCoveredNotClicked,'- بدون شواهد سناریوی مستقل: '+result.withoutFixtureEvidence,'','| صفحه | کنترل | هندلر | نوع پوشش | شواهد |','|---|---|---|---|---|'];for(const x of result.entries)lines.push('| '+x.route+' | '+x.label+' | `'+x.handler+'` | '+x.coverage.kind+' | '+x.coverage.summary+' |');lines.push('','- native-negative-guard-only فقط رد سناریوی منفی را اثبات میکند.','- سناریوی متد-محور بهمعنای مشاهده کلیک مستقیم دکمه نیست.','- کنترلهای فاقد نگاشت همچنان نیازمند آزمون مستقل یا بررسی دستیاند.','');return lines.join('\n');}
58
-module.exports={annotateAudit,buildCoverageReport,coverageFor};
\ No newline at end of file
203
+
204
+function positiveEvidence(value) {
205
+ return value === true || (typeof value === 'number' && value > 0);
206
+}
207
+function hasEvidence(rule, evidence) {
208
+ if (rule.flag) return evidence[rule.flag] === true;
209
+ if (rule.probe === 'modalKeyboard') {
210
+ const probe = evidence.modalKeyboard || {};
211
+ return rule.checks.every(key => probe[key] === true);
212
+ }
213
+ if (rule.probe === 'routesVisited') return evidence.routesVisited === rule.expected;
214
+ if (!rule.checks) return false;
215
+ const results = evidence.nativeFunctional || {};
216
+ return Object.entries(rule.checks).every(([scenario, fields]) =>
217
+ fields.every(field => positiveEvidence(results[scenario]?.[field]))
218
+ );
219
+}
220
+function coverageFor(handler, evidence = {}) {
221
+ if (!handler) return null;
222
+ const rule = RULES.find(item => handler.includes(item.match) && hasEvidence(item, evidence));
223
+ return rule ? { kind: rule.kind, scenarios: rule.scenarios || Object.keys(rule.checks || {}),
224
+ summary: rule.note } : null;
225
+}
226
+function annotateAudit(audit, evidence = {}) {
227
+ if (!audit || !Array.isArray(audit.uniqueActions) || !Array.isArray(audit.controls))
228
+ throw Error('Q01_FIXTURE_COVERAGE_INVALID_AUDIT');
229
+ for (const row of [...audit.uniqueActions, ...audit.controls])
230
+ row.fixtureCoverage = coverageFor(row.handler, evidence);
231
+ const pending = audit.uniqueActions.filter(row => row.status === 'not-clicked');
232
+ const covered = pending.filter(row => row.fixtureCoverage);
233
+ const uncovered = pending.filter(row => !row.fixtureCoverage);
234
+ return {
235
+ uniqueActionCount: audit.uniqueActions.length,
236
+ notClicked: pending.length,
237
+ disabled: audit.uniqueActions.filter(row => row.status === 'disabled').length,
238
+ fixtureCoveredNotClicked: covered.length,
239
+ withoutFixtureEvidence: uncovered.length,
240
+ entries: covered.map(row => ({
241
+ route: row.route, label: row.label, handler: row.handler,
242
+ status: row.status, coverage: row.fixtureCoverage
243
+ }))
244
+ };
245
+}
246
+function buildCoverageReport(result) {
247
+ if (!result || !Array.isArray(result.entries)) throw Error('Q01_FIXTURE_COVERAGE_INVALID_REPORT');
248
+ const lines = [
249
+ '# Q01 — شواهد سناریوهای مستقل برای کنترلهای کلیکنشده', '',
250
+ 'این گزارش جایگزین کلیک مستقیم یا تأیید تکتک دکمهها نیست؛ فقط شواهد مستقل همان handler یا قرارداد مشترک رابط را در نصب واقعی WebView2 نشان میدهد.', '',
251
+ '- امضاهای متمایز: ' + result.uniqueActionCount,
252
+ '- امضاهای کلیکنشده: ' + result.notClicked,
253
+ '- کنترلهای غیرفعال: ' + (result.disabled || 0),
254
+ '- دارای شواهد سناریوی مستقل: ' + result.fixtureCoveredNotClicked,
255
+ '- بدون شواهد سناریوی مستقل: ' + result.withoutFixtureEvidence, '',
256
+ '| صفحه | کنترل | هندلر | نوع پوشش | شواهد |', '|---|---|---|---|---|'
257
+ ];
258
+ for (const row of result.entries)
259
+ lines.push('| ' + row.route + ' | ' + row.label + ' | "' + row.handler + '" | ' +
260
+ row.coverage.kind + ' | ' + row.coverage.summary + ' |');
261
+ lines.push('', '- پوشش قرارداد مشترک مودال به معنی مشاهده کلیک مستقیم تکتک دکمهها نیست.',
262
+ '- سناریوی متد-محور بهمعنای مشاهده کلیک مستقیم دکمه نیست.',
263
+ '- کنترلهای فاقد نگاشت همچنان نیازمند آزمون fixture مستقل یا بررسی دستیاند.', '');
264
+ return lines.join('\n');
265
+}
266
+module.exports = { annotateAudit, buildCoverageReport, coverageFor };
tests/q01-native-action-coverage.test.mjs
+54
-10
@@ -7,10 +7,10 @@ const { annotateAudit, coverageFor } = coverage;
7
test('Q01 maps invoice and treasury handlers only when every required native scenario passed',()=>{
8
const scenarios={
9
'purchase-and-post-ledger':{purchasePosted:true},'partial-sale-and-inventory':{salePosted:true},
10
- 'sale-return-immutable-stock-and-ledger':{separatePostedReturn:true},
11
- 'purchase-return-and-stock-guardrails':{postedSupplierReturn:true},
10
+ 'sale-return-immutable-stock-and-ledger':{separatePostedReturn:true,balancedLedgerAndReturnedStock:true,postedOriginalImmutable:true},
11
+ 'purchase-return-and-stock-guardrails':{postedSupplierReturn:true,balancedLedger:true,stockIssued:true,originalPurchaseImmutable:true},
12
'return-cash-settlement-net-credit':{netReceiptAccepted:true},
13
- 'inactive-treasury-cheque-settlement':{validChequeClearedExactlyOnce:true}
13
+ 'inactive-treasury-cheque-settlement':{inactiveTransferRejected:true,invalidTransferRolledBack:true,validTransferPosted:true}
14
};
15
const evidence={nativeFunctional:scenarios};
16
assert.equal(coverageFor('window.InvoiceFormView._save(false)',evidence).kind,'native-fixture-positive-and-negative');
@@ -23,7 +23,7 @@ test('Q01 maps invoice and treasury handlers only when every required native sce
23
test('Q01 maps contact, product, unit and category UI writes only to installed form scenarios',()=>{
24
const evidence={nativeFunctional:{
25
'contacts-crud-form-and-tags':{createdThroughForm:true,tagPersisted:true,editedThroughForm:true},
26
- 'products-crud-form-and-nested-classifiers':{createdThroughForm:true,nestedUnitSavedAndSelected:true,nestedCategorySavedAndSelected:true,editedThroughForm:true}
26
+ 'products-crud-form-and-nested-classifiers':{createdThroughForm:true,nestedUnitSavedAndSelected:true,nestedCategorySavedAndSelected:true,editedThroughForm:true,fractionalReorderPointPreserved:true}
27
}};
28
assert.equal(coverageFor('window.ContactsView.saveContact(null)',evidence).kind,'native-ui-create-and-update');
29
assert.equal(coverageFor('window.ProductsView.saveProduct(null)',evidence).kind,'native-ui-create-and-update');
@@ -36,7 +36,7 @@ test('Q01 maps contact, product, unit and category UI writes only to installed f
36
37
test('Q01 maps legacy stock adjustment and integrated-mode guard only to both native scenarios',()=>{
38
const evidence={nativeFunctional:{
39
- 'legacy-stock-adjustment-form-and-validation':{validAdjustmentPosted:true,overPrecisionRejectedWithoutWrites:true},
39
+ 'legacy-stock-adjustment-form-and-validation':{validAdjustmentPosted:true,overPrecisionRejectedWithoutWrites:true,negativeRejectedWithoutWrites:true,fractionalQuantityPreserved:true},
40
'integrated-stock-adjustment-guard':{manualAdjustmentHidden:true,directOpenBlocked:true,directSaveBlocked:true}
41
}};
42
assert.equal(coverageFor("window.StockKardexModal.openAdjustModal('prod_1')",evidence).kind,'native-ui-guarded-action');
@@ -57,8 +57,8 @@ test('Q01 coverage never converts an unclicked control into a clicked control',(
57
],controls:[]};
58
const evidence={nativeFunctional:{
59
'purchase-and-post-ledger':{purchasePosted:true},'partial-sale-and-inventory':{salePosted:true},
60
- 'sale-return-immutable-stock-and-ledger':{separatePostedReturn:true},
61
- 'purchase-return-and-stock-guardrails':{postedSupplierReturn:true},
60
+ 'sale-return-immutable-stock-and-ledger':{separatePostedReturn:true,balancedLedgerAndReturnedStock:true,postedOriginalImmutable:true},
61
+ 'purchase-return-and-stock-guardrails':{postedSupplierReturn:true,balancedLedger:true,stockIssued:true,originalPurchaseImmutable:true},
62
'return-cash-settlement-net-credit':{netReceiptAccepted:true}
63
}};
64
const summary=annotateAudit(audit,evidence);
@@ -105,8 +105,11 @@ test('Q01 transfer coverage requires both rejected inactive and successful activ
105
}}};
106
assert.equal(coverageFor("window.TreasuryView._saveTransaction('transfer')",evidence).kind,
107
'native-fixture-positive-and-negative');
108
+ assert.equal(coverageFor('window.TreasuryView.saveAccount(null)',evidence),null);
109
+ evidence.nativeFunctional['inactive-treasury-cheque-settlement'].treasuryAccountCreatedThroughForm=true;
110
+ assert.equal(coverageFor('window.TreasuryView.saveAccount(null)',evidence).kind,'native-ui-create');
111
assert.equal(coverageFor('window.TreasuryView.saveAccount("acc_1")',evidence).kind,
109
- 'native-ui-create-and-update');
112
+ 'native-ui-update');
113
evidence.nativeFunctional['inactive-treasury-cheque-settlement'].validTransferPosted=false;
114
assert.equal(coverageFor("window.TreasuryView._saveTransaction('transfer')",evidence),null);
115
});
@@ -149,10 +152,51 @@ test('Q01 maps draft expense edit and accounting read/reversal controls to insta
152
153
test('Q01 accounting period and warehouse form coverage requires positive installed evidence',()=>{
154
const evidence={nativeFunctional:{'activate-accounting-and-inventory':{
152
- periodCreated:true,chartAvailable:true,integrationEnabled:true,warehouseCreated:true
153
- },'fiscal-close-atomic-guardrails':{periodClosed:true,closedPeriodBlocksPosting:true}}};
155
+ periodCreatedByForm:true,warehouseCreatedByForm:true
156
+ },'fiscal-close-atomic-guardrails':{successfulCloseCommitted:true,duplicateCloseRejected:true}}};
157
assert.equal(coverageFor('window.AccountingView.savePeriod()',evidence).kind,'native-ui-period-create');
158
assert.equal(coverageFor('window.AccountingView.saveWarehouse()',evidence).kind,'native-ui-warehouse-create');
159
evidence.nativeFunctional['activate-accounting-and-inventory'].warehouseCreated=false;
160
assert.equal(coverageFor('window.AccountingView.saveWarehouse()',evidence),null);
161
});
162
+
163
+
164
+test('Q01 maps shared modal-close and invoice-route actions only to exact shell probes',()=>{
165
+ const evidence={
166
+ routesVisited:10,
167
+ modalKeyboard:{
168
+ escapeClosesWithoutConfirm:true,focusReturnsToTrigger:true,
169
+ cancelDoesNotConfirmAndRestoresFocus:true,nestedDialogIsolation:true
170
+ }
171
+ };
172
+ assert.equal(coverageFor('FINORA.Modal.close()',evidence).kind,'native-shared-modal-close-contract');
173
+ assert.equal(coverageFor("FINORA.Router.go('invoices')",evidence).kind,'native-route-navigation');
174
+ evidence.modalKeyboard.focusReturnsToTrigger=false;
175
+ assert.equal(coverageFor('FINORA.Modal.close()',evidence),null);
176
+ evidence.modalKeyboard.focusReturnsToTrigger=true;
177
+ evidence.routesVisited=9;
178
+ assert.equal(coverageFor("FINORA.Router.go('invoices')",evidence),null);
179
+});
180
+
181
+test('Q01 period and warehouse form mappings require the actual form-save result, not service setup',()=>{
182
+ const evidence={nativeFunctional:{
183
+ 'activate-accounting-and-inventory':{fiscalPeriods:1,accountCount:20,integration:'enabled',warehouse:'created'},
184
+ 'fiscal-close-atomic-guardrails':{successfulCloseCommitted:true,duplicateCloseRejected:true}
185
+ }};
186
+ assert.equal(coverageFor('window.AccountingView.savePeriod()',evidence),null);
187
+ assert.equal(coverageFor('window.AccountingView.saveWarehouse()',evidence),null);
188
+ evidence.nativeFunctional['activate-accounting-and-inventory'].periodCreatedByForm=true;
189
+ evidence.nativeFunctional['activate-accounting-and-inventory'].warehouseCreatedByForm=true;
190
+ assert.equal(coverageFor('window.AccountingView.savePeriod()',evidence).kind,'native-ui-period-create');
191
+ assert.equal(coverageFor('window.AccountingView.saveWarehouse()',evidence).kind,'native-ui-warehouse-create');
192
+});
193
+
194
+
195
+test('Q01 cheque create mapping requires the installed cheque form, not just cheque accounting',()=>{
196
+ const evidence={nativeFunctional:{'inactive-treasury-cheque-settlement':{
197
+ disabledChequeClearingRejected:true,validChequeClearedExactlyOnce:true
198
+ }}};
199
+ assert.equal(coverageFor('window.ChequesView.saveCheque(null)',evidence),null);
200
+ evidence.nativeFunctional['inactive-treasury-cheque-settlement'].chequeCreatedThroughForm=true;
201
+ assert.equal(coverageFor('window.ChequesView.saveCheque(null)',evidence).kind,'native-ui-cheque-create');
202
+});
tests/windows-vm-installed-tauri-cdp.cjs
+3
-1
@@ -411,7 +411,9 @@ async function connect(url) {
411
const fixtureCoverage = require('../scripts/q01-native-action-coverage.cjs').annotateAudit(audit, {
412
nativeFunctional: report.nativeFunctional,
413
encryptedCompanyBackup: report.encryptedCompanyBackup ===
414
- 'native-SettingsUI-AES-GCM-PBKDF2-wrong-password-and-audited-restore-passed'
414
+ 'native-SettingsUI-AES-GCM-PBKDF2-wrong-password-and-audited-restore-passed',
415
+ modalKeyboard: audit.shellResults?.modalKeyboard,
416
+ routesVisited: audit.routesVisited
417
});
418
report.nativeControlCoverage = fixtureCoverage;
419
assert.equal(audit.environment, 'installed-Windows-Tauri-WebView2-synthetic-VM');
tests/windows-vm-native-functional-matrix.cjs
+7
-4
@@ -128,6 +128,7 @@ async function activateAccounting() {
128
check(view && document.getElementById('pageContent')?.textContent.includes('حسابداری دوبل'),
129
'actual accounting route missing');
130
await view.switchTab('periods');
131
+ let periodCreatedByForm = false;
132
if (!view.periods.length) {
133
view.openPeriodModal();
134
check(document.getElementById('acPeriodName'), 'fiscal period form absent');
@@ -135,6 +136,7 @@ async function activateAccounting() {
136
document.getElementById('acPeriodStart').value = '1405/01/01';
137
document.getElementById('acPeriodEnd').value = '1405/12/29';
138
await view.savePeriod();
139
+ periodCreatedByForm = true;
140
}
141
check(view.periods.length > 0, 'period did not persist');
142
await view.switchTab('accounts');
@@ -162,8 +164,9 @@ async function activateAccounting() {
164
await view.saveWarehouse();
165
check((await FINORA.Storage.getAll('warehouses')).some(w => w.name === 'انبار ماشین مجازی'),
166
'warehouse did not persist');
165
- return { fiscalPeriods: view.periods.length, accountCount: view.accounts.length,
166
- integration: 'enabled', warehouse: 'created' };
167
+ return { fiscalPeriods: view.periods.length, periodCreatedByForm,
168
+ accountCount: view.accounts.length, chartAvailable: view.accounts.some(a => a.code === '402'),
169
+ integration: 'enabled', integrationEnabled: true, warehouse: 'created', warehouseCreatedByForm: true };
170
}
171
172
async function nativeContactCrudFormAndTags() {
@@ -997,8 +1000,8 @@ async function nativeInactiveBankSettlementGuard() {
1000
check(!document.querySelector('.toast-error')&&!document.querySelector('.modal-backdrop'),
1001
'A05 native treasury scenario left error toast/modal');
1002
return { inactiveTransferRejected:true, invalidTransferRolledBack:true,
1000
- validTransferPosted:true,treasuryAccountEditPersisted:true,
1001
- disabledChequeClearingRejected:true, validChequeClearedExactlyOnce:true,
1003
+ validTransferPosted:true,treasuryAccountCreatedThroughForm:true,treasuryAccountEditPersisted:true,
1004
+ chequeCreatedThroughForm:true,disabledChequeClearingRejected:true, validChequeClearedExactlyOnce:true,
1005
chequeEventDateDifferentFromDueDate:true,
1006
explicitNondefaultClearingAccount:true,confirmationRequiredBeforeCash:true };
1007
}