test(scripts): 更新测试脚本以适配无头模式和接收器重构

- 所有测试脚本的 spawn 调用添加 --no-browser 参数,避免自动打开浏览器
- 更新 test-browser.mjs 导航流程,改为从 archives 页面通过 reference-rail 进入注册模块
- 更新 test-receiver.mjs 断言以适配多接收器架构(receivers.json 数组格式、
  接收器前缀 target_id、默认 receiver_id)
- test-module-navigation.mjs 新增设备管理模块的导航标签断言
```
This commit is contained in:
2026-10-27 20:04:53 +08:00
parent 281af4fe3d
commit 9befb6e9e0
7 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ function xy(lon,lat,z){const n=2**z,r=lat*Math.PI/180;return [Math.floor((lon+18
const [x,y]=xy(120.155,30.285,11);
for(const layer of ['vec_w','cva_w','img_w','cia_w']){const dir=path.join(root,`maps/cache/${layer}/11/${x}`);await mkdir(dir,{recursive:true});await writeFile(path.join(dir,y+'.tile'),png);}
let child,browser,output='';const errors=[],csp=[];let report={};
function start(){child=spawn(exe,['--data-root',root,'--simulation-api'],{env,windowsHide:true,stdio:['ignore','pipe','pipe']});child.stdout.on('data',b=>output+=b);child.stderr.on('data',b=>output+=b);}
function start(){child=spawn(exe,['--data-root',root,'--simulation-api','--no-browser'],{env,windowsHide:true,stdio:['ignore','pipe','pipe']});child.stdout.on('data',b=>output+=b);child.stderr.on('data',b=>output+=b);}
async function ready(){for(let i=0;i<150;i++){if(child.exitCode!==null)throw Error(output);try{if((await fetch(base+'/api/maps/preferences')).ok)return;}catch{}await new Promise(r=>setTimeout(r,100));}throw Error('server timeout');}
async function stop(){if(child?.exitCode===null){const done=new Promise(r=>child.once('exit',r));child.kill();await done;}}
const json=async(url,method='GET',body)=>{const r=await fetch(base+url,{method,headers:{'content-type':'application/json'},...(body?{body:JSON.stringify(body)}:{})});const v=await r.json();return {status:r.status,value:v};};