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

test(invoice): compare exact unsaved input snapshot across late option hydration (#216)

davoodmehraban89 committed Nov 22, 2026 at 01:53 UTC e8d089a5a42f0348919418a046041659907ffcda
1 file changed +10 -3
scripts/phase0-invoice-persistence.spec.js
+10 -3
@@ -111,6 +111,11 @@ test('late invoice product hydration preserves unsaved number, quantity and pric
111 await page.locator('#invoice-number').fill('UNSAVED-HYDRATION');
112 await page.locator('#invoice-items-table-body .row-quantity').first().fill('7');
113 await page.locator('#invoice-items-table-body .row-price').first().fill('2,500');
114 + const before=await page.evaluate(()=>({
115 + number:document.getElementById('invoice-number').value,
116 + quantity:document.querySelector('#invoice-items-table-body .row-quantity').value,
117 + price:document.querySelector('#invoice-items-table-body .row-price').value
118 + }));
119 // Reproduce the pre-login placeholder after a user has already filled fields.
120 await page.evaluate(()=>{
121 const select=document.querySelector('#invoice-items-table-body .row-product-select');
@@ -118,9 +123,11 @@ test('late invoice product hydration preserves unsaved number, quantity and pric
123 renderInvoices();
124 });
125 await expect(page.locator('#invoice-items-table-body .row-product-select option[value="QA_PROD"]')).toHaveCount(1);
121 - await expect(page.locator('#invoice-number')).toHaveValue('UNSAVED-HYDRATION');
122 - await expect(page.locator('#invoice-items-table-body .row-quantity').first()).toHaveValue('7');
123 - await expect(page.locator('#invoice-items-table-body .row-price').first()).toHaveValue('2,500');
126 + expect(await page.evaluate(()=>({
127 + number:document.getElementById('invoice-number').value,
128 + quantity:document.querySelector('#invoice-items-table-body .row-quantity').value,
129 + price:document.querySelector('#invoice-items-table-body .row-price').value
130 + }))).toEqual(before);
131 });
132
133 test('F0-03 isolated invoice save → mock-server sync → reload → edit → reload → print',async({page})=>{