Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

Isolate Windows Electron userData for second native QA replay and rely on actual CDP readiness instead of launcher PID exit

davoodmehraban89 committed Oct 26, 2026 at 08:22 UTC b495131fa708d48786209616c3ca284bce7ca204
1 file changed +9 -2
qa/windows/v7-installed-native-cdp-smoke.mjs
+9 -2
@@ -46,7 +46,10 @@ async function connect(target){
46 async function until(fn,timeoutMs=65000){
47 const stop=Date.now()+timeoutMs;let latest;
48 while(Date.now()<stop){
49 - if(app?.exitCode!==null&&app?.exitCode!==undefined)throw Error('ELECTRON_EXITED');
49 + // On Windows, the launcher PID may exit after handing off to a renderer.
50 + // Require actual localhost readiness and CDP instead of equating launcher
51 + // lifecycle with failure. The test deadline remains bounded.
52 + if(app?.exitCode!==null&&app?.exitCode!==undefined)report.launcherExited=true;
53 try{const outcome=await fn();if(outcome)return outcome}catch(e){latest=e}
54 await sleep(350);
55 }
@@ -82,7 +85,9 @@ async function go(path,heading){
85 },65000);
86 }
87 try{
85 - const env={...process.env,TREASURYFLOW_DESKTOP_LOCAL:'1',BANK_ADAPTER_MODE:'disabled',
88 + const separateUserData=join(fixtureDir,'isolated-electron-localappdata');
89 + mkdirSync(separateUserData,{recursive:true});
90 + const env={...process.env,LOCALAPPDATA:separateUserData,TREASURYFLOW_DESKTOP_LOCAL:'1',BANK_ADAPTER_MODE:'disabled',
91 TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ:'0',TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ:'0',
92 TREASURYFLOW_ENABLE_SQL_LAB:'0',
93 TREASURYFLOW_DATA_FILE:join(fixtureDir,'synthetic-v7-ui.sqlite')};
@@ -123,6 +128,8 @@ try{
128 }catch(e){
129 report.status='FAIL';
130 report.error=String(e?.message||'UNKNOWN').replace(/[^A-Z0-9_]/gi,'_').slice(0,90);
131 + report.launcherExitCode=Number.isInteger(app?.exitCode)?app.exitCode:null;
132 + report.cdpAttempts=report.reconnections;
133 console.log('V7_NATIVE_CDP_FAILURE_CLASS_'+report.error);
134 process.exitCode=1;
135 }finally{