فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(a02): verify no double import or stale preview on actual installed WebView2
davoodmehraban89 committed
Oct 31, 2026 at 00:43 UTC
cae6a7d5da687e8b75a60060bcd74db17886b5a1
1 file changed
+34
tests/windows-vm-ui-interaction-audit-browser.js
+34
@@ -442,7 +442,41 @@
442
throw Error('Financial contact ledger interpreted imported text as executable markup');
443
}
444
delete window.Q01_LEDGER_INJECTION;
445
+ // Simulate two rapid clicks on a private workbook preview. No real Excel
446
+ // rows are persisted; a canceled preview must never be importable later.
447
+ const excel = window.ExcelController;
448
+ const settingsView = window.SettingsView;
449
+ const originalExcelPreview = excel.previewFile;
450
+ const originalExcelImport = excel.importProducts;
451
+ let importCount = 0;
452
+ try {
453
+ excel.previewFile=async()=>({sheets:[{name:'کالاها',count:1}],
454
+ raw:{'کالاها':[{'نام':'Synthetic VM-only name'}]}});
455
+ excel.importProducts=async()=>{importCount++;await wait(85);return {added:1,skipped:0};};
456
+ await settingsView._handleImportFile({name:'synthetic-vm-preview.xlsx'},'products');
457
+ const importDialog=FINORA.Modal.stack[FINORA.Modal.stack.length-1]?.card;
458
+ const submit=importDialog?.querySelector('[data-excel-import-submit]');
459
+ if(!submit) throw Error('Synthetic Excel preview import button missing');
460
+ submit.click();submit.click();await wait(160);
461
+ if(importCount!==1 || submit.disabled!==true || FINORA.Modal.stack.length ||
462
+ Object.hasOwn(window,'__importRawData') || Object.hasOwn(window,'__importKind')) {
463
+ throw Error('Rapid Excel import clicks wrote twice or exposed a global workbook');
464
+ }
465
+ await settingsView._handleImportFile({name:'synthetic-vm-cancel.xlsx'},'products');
466
+ FINORA.Modal.close();
467
+ await settingsView._confirmImport('products');
468
+ document.querySelectorAll('.toast .toast-close').forEach(x=>x.click());
469
+ if(importCount!==1 || FINORA.Modal.stack.length) {
470
+ throw Error('Canceled private Excel preview remained importable');
471
+ }
472
+ } finally {
473
+ excel.previewFile=originalExcelPreview;
474
+ excel.importProducts=originalExcelImport;
475
+ FINORA.Modal.closeAll();
476
+ document.querySelectorAll('.toast .toast-close').forEach(x=>x.click());
477
+ }
478
const modalKeyboard={roleAndLabel:true,nestedDialogIsolation:true,
479
+ privateExcelPreviewAndSingleFlight:true,
480
financialLedgerContentEscaped:true,
481
excelReplacementRejectedWithoutWrites:true,
482
importedInvoiceHtmlEscaped:true,