@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 7b01a01
Fork 0

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

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 4, 18:00 UTC

test: assert buyer filter preserves existing selection instead of assuming empty native select

davoodmehraban89 committed Oct 15, 2026 at 21:37 UTC 7b01a0187e0e1b65c78a19260bfe9a8d6a28b00a
1 file changed +4 -2
scripts/pages-artifact.spec.js
+4 -2
@@ -250,19 +250,21 @@ test('Published Pages F0-02 invoice product and buyer search only use synthetic
250 await productSearch.press('Escape');
251 const buyer=page.locator('#invoice-contact-id');
252 const buyerSearch=buyer.locator('xpath=..').locator('.finora-combobox-input');
253 + const originalBuyer=await buyer.inputValue();
254 await buyerSearch.click();
255 await buyerSearch.fill('شرکت');
256 const buyerOptions=buyer.locator('xpath=..').locator('.finora-combobox-list [role="option"]');
257 await expect(buyerOptions).toHaveCount(1);
258 await expect(buyerOptions).toContainText('خریدار آزمایشی');
259 await expect(buyerOptions).not.toContainText('تامین کننده');
259 - await expect(buyer).toHaveValue('QA_BUY1'.slice(0,0)); // no buyer selected by searching
260 + // Typing filter must NEVER silently change the already selected option.
261 + await expect(buyer).toHaveValue(originalBuyer);
262 await buyerSearch.press('Escape');
263 const unchanged=await page.evaluate(()=>({
264 saveCalls:window.__qaSaveCalls,invoiceCount:datastore.invoices.length,
265 productSelection:document.querySelector('#invoice-items-table-body .row-product-select')?.value||'',
266 buyerSelection:document.getElementById('invoice-contact-id')?.value||''
267 }));
266 - expect(unchanged).toEqual({saveCalls:0,invoiceCount:0,productSelection:'',buyerSelection:''});
268 + expect(unchanged).toEqual({saveCalls:0,invoiceCount:0,productSelection:'',buyerSelection:originalBuyer});
269 expect(errors).toEqual([]);
270 });