@davoodmehraban89 / Factor-easy / commits / 74d3bd5
Fork 0

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

test: wait for organization and ERP bootstrap before synthetic accounting auth fixture

davoodmehraban89 committed Oct 15, 2026 at 21:52 UTC 74d3bd580484b4ae754e5f627e53ad7f08e57a63
1 file changed +7 -1
scripts/accounting-document-workflow.spec.js
+7 -1
@@ -35,7 +35,13 @@ async function installHarness(page,server){
35 }
36 async function authenticatedMockBrowser(page){
37 await page.goto(BASE,{waitUntil:'domcontentloaded'});
38 - await page.waitForFunction(()=>typeof enterApp==='function'&&typeof commitSaveInvoice==='function'&&typeof pullAll==='function');
38 + // Login hydrate must wait until the organization account adapter and all ERP bundles
39 + // have installed their wrappers; otherwise this synthetic auth fixture races
40 + // production-like asynchronous module bootstrap and fails intermittently.
41 + await page.waitForFunction(()=>typeof enterApp==='function'&&typeof commitSaveInvoice==='function'&&
42 + typeof pullAll==='function'&&window.FinoraStartupStatus?.extensionsReady===true&&
43 + window.FinoraStartupStatus?.failedExtensionCount===0&&
44 + window.FinoraStartupStatus?.authChecked===true,{timeout:20000});
45 await page.evaluate(async()=>{
46 window.__FINORA_PRINT_TEST_MODE=true;
47 window.__f0Alerts=[];