سامانه صدور فاکتور و حسابداری

test: trace unexpected synthetic save invocation before deciding if UI search writes

davoodmehraban89 committed Oct 15, 2026 at 21:42 UTC 65af68fd0c956eb2d25119a9c38f53675a394e53
1 file changed +6 -1
scripts/pages-artifact.spec.js
+6 -1
@@ -222,7 +222,8 @@ test('Published Pages F0-02 invoice product and buyer search only use synthetic
222 datastore.invoices=[];
223 window.__qaBackupSaveDatastore=saveDatastore;
224 window.__qaSaveCalls=0;
225 - saveDatastore=()=>{window.__qaSaveCalls++;throw Error('UNEXPECTED_FINANCIAL_WRITE')};
225 + window.__qaSaveStacks=[];
226 + saveDatastore=()=>{window.__qaSaveCalls++;window.__qaSaveStacks.push(new Error('CAPTURED_SAVE_CALL').stack||'unknown')};
227 document.getElementById('invoice-items-table-body').replaceChildren();
228 renderContacts();
229 addInvoiceItemRow();
@@ -265,6 +266,10 @@ test('Published Pages F0-02 invoice product and buyer search only use synthetic
266 productSelection:document.querySelector('#invoice-items-table-body .row-product-select')?.value||'',
267 buyerSelection:document.getElementById('invoice-contact-id')?.value||''
268 }));
269 + if(unchanged.saveCalls){
270 + const stacks=await page.evaluate(()=>window.__qaSaveStacks||[]);
271 + console.log('F0-02 unexpected synthetic save invocation stacks:',JSON.stringify(stacks));
272 + }
273 expect(unchanged).toEqual({saveCalls:0,invoiceCount:0,productSelection:'',buyerSelection:originalBuyer});
274 expect(errors).toEqual([]);
275 });