@davoodmehraban89 / Factor-easy / commits / 2fd930b
Fork 0

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

test(print): verify clean formal draft print with unchanged accounting state

davoodmehraban89 committed Oct 12, 2026 at 09:48 UTC 2fd930bf05b3576c48749704d600767095878a16
1 file changed +12
scripts/accounting-document-workflow.spec.js
+12
@@ -85,6 +85,18 @@ test('formal invoice remains editable draft across server reload; explicit posti
85 expect(remoteInvoices(server)[0].accountingStatus).toBe('draft');
86 expect([...server.records.values()].filter(x=>x.collection==='journalVouchers')).toHaveLength(0);
87 const id=remoteInvoices(server)[0].id;
88 + // A saved formal draft prints its complete invoice; the print UI must not stamp it
89 + // as provisional. The underlying draft state and zero-posting invariant remain.
90 + await page.evaluate(x=>renderAndPrintDirect(x),id);
91 + await expect(page.locator('#printable-invoice')).toContainText('FIN-DRAFT-۰۰۱');
92 + await expect(page.locator('#printable-invoice')).toContainText('۳٬۰۰۰');
93 + await expect(page.locator('#printable-invoice')).not.toContainText('پیش‌نویس — غیرقطعی');
94 + await expect(page.locator('#printable-invoice [style*="rotate(-12deg)"]')).toHaveCount(0);
95 + const isolatedPrint=page.frameLocator('#finora-print-frame').locator('#finora-print-document');
96 + await expect(isolatedPrint).toContainText('FIN-DRAFT-۰۰۱');
97 + await expect(isolatedPrint).not.toContainText('پیش‌نویس — غیرقطعی');
98 + expect(remoteInvoices(server)[0].accountingStatus).toBe('draft');
99 + expect([...server.records.values()].filter(x=>x.collection==='journalVouchers')).toHaveLength(0);
100 await page.reload({waitUntil:'domcontentloaded'});await authenticatedMockBrowser(page);
101 await page.evaluate(x=>editInvoice(x),id);
102 await expect(page.locator('#edit-invoice-id')).toHaveValue(id);