سامانه صدور فاکتور و حسابداری
test: use real form change handlers for intentionally hidden native combobox selects
davoodmehraban89 committed
Oct 11, 2026 at 19:36 UTC
961547cd635a720caa1b1fb255931637dd9c38e8
1 file changed
+11
-4
scripts/phase0-invoice-persistence.spec.js
+11
-4
@@ -54,12 +54,19 @@ async function authenticatedMockBrowser(page){
54
await expect(page.locator('#invoice-items-table-body .row-product-select').first().locator('option[value="QA_PROD"]')).toHaveCount(1);
55
}
56
async function fillInvoice(page,number,qty){
57
- await page.locator('#invoice-kind').selectOption('pre_invoice');
58
- await page.locator('#invoice-company-id').selectOption('QA_CO');
59
- await page.locator('#invoice-contact-id').selectOption('QA_CONTACT');
57
+ // The native invoice-kind/contact selectors are hidden by the unified commercial combobox.
58
+ // Drive their real DOM change handlers, not Playwright visibility on replaced native selects.
59
+ await page.evaluate(()=>{
60
+ for(const [id,value] of [['invoice-kind','pre_invoice'],['invoice-company-id','QA_CO'],['invoice-contact-id','QA_CONTACT']]){
61
+ const el=document.getElementById(id);el.value=value;el.dispatchEvent(new Event('change',{bubbles:true}));
62
+ }
63
+ });
64
await page.locator('#invoice-number').fill(number);
65
await page.locator('#invoice-date-input').fill('۱۴۰۵/۰۷/۱۹');
62
- await page.locator('#invoice-items-table-body .row-product-select').first().selectOption('QA_PROD');
66
+ await page.evaluate(()=>{
67
+ const el=document.querySelector('#invoice-items-table-body .row-product-select');
68
+ el.value='QA_PROD';el.dispatchEvent(new Event('change',{bubbles:true}));
69
+ });
70
await page.locator('#invoice-items-table-body .row-quantity').first().fill(String(qty));
71
await page.locator('#invoice-items-table-body .row-quantity').first().dispatchEvent('input');
72
}