فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A07): capture accounting CSV blobs directly in installed WebView2
davoodmehraban89 committed
Nov 1, 2026 at 11:11 UTC
93abf05837af00d0ff3ca6d291475bcea8e8045f
1 file changed
+13
-7
tests/windows-vm-native-functional-matrix.cjs
+13
-7
@@ -1669,19 +1669,24 @@ async function nativeAccountingJournalAndExports() {
1669
x.companyId===company.id&&x.reversalOfId===posted.id&&x.status==='posted');
1670
check(originalAfter?.reversedById===reversal?.id&&reversal?.debit===100&&reversal?.credit===100,
1671
'Manual journal reversal did not preserve the original and post a balanced reversal');
1672
- const downloads=[],originalClick=HTMLAnchorElement.prototype.click;
1672
+ const downloads=[],originalClick=HTMLAnchorElement.prototype.click,
1673
+ originalCreateObjectURL=URL.createObjectURL;
1674
try {
1675
+ URL.createObjectURL=function(blob){
1676
+ const url=originalCreateObjectURL.call(URL,blob);
1677
+ downloads.push({blob,url,filename:''});
1678
+ return url;
1679
+ };
1680
HTMLAnchorElement.prototype.click=function(){
1675
- downloads.push({filename:this.download,url:this.href});
1681
+ const item=downloads.find(x=>x.url===this.href);
1682
+ if(item)item.filename=this.download;
1683
};
1684
await view.exportReports();
1685
await view.exportReconciliation();
1686
check(downloads.length===2,'Accounting report and reconciliation exports did not both download');
1680
- const content=await Promise.all(downloads.map(async item=>{
1681
- const response=await fetch(item.url);
1682
- if(!response.ok)throw Error('CSV blob URL could not be read');
1683
- return {filename:item.filename,text:await response.text()};
1684
- }));
1687
+ const content=await Promise.all(downloads.map(async item=>({
1688
+ filename:item.filename,text:await item.blob.text()
1689
+ })));
1690
check(content.some(x=>x.filename==='factor-easypro-ledger.csv'&&
1691
x.text.includes('account_code')&&x.text.includes(postedDescription)),
1692
'Ledger CSV export omitted the posted synthetic journal');
@@ -1689,6 +1694,7 @@ async function nativeAccountingJournalAndExports() {
1694
x.text.includes('code')&&x.text.includes('reference')),
1695
'Reconciliation CSV export omitted its expected schema');
1696
} finally {
1697
+ URL.createObjectURL=originalCreateObjectURL;
1698
HTMLAnchorElement.prototype.click=originalClick;
1699
}
1700
return {chartAccountCreated:true,journalRowAdded:true,draftJournalSaved:true,