```
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:
@@ -13,7 +13,7 @@ const root=await mkdtemp(path.join(tmpdir(),'RID-module-navigation-'));
|
||||
const exe=process.argv[2]||'D:/Rust_Contact/util/target/Rid_Drone_Receivev/release/fpv-rid-registry-fullstack.exe';
|
||||
let child,browser,output='';const errors=[];
|
||||
const wait=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
function start(){child=spawn(exe,['--data-root',root,'--simulation-api'],{env:{...process.env,PATH:'C:\\Windows\\System32'},windowsHide:true,stdio:['ignore','pipe','pipe']});child.stdout.on('data',b=>output+=b);child.stderr.on('data',b=>output+=b);child.on('error',e=>output+=e.message)}
|
||||
function start(){child=spawn(exe,['--data-root',root,'--simulation-api','--no-browser'],{env:{...process.env,PATH:'C:\\Windows\\System32'},windowsHide:true,stdio:['ignore','pipe','pipe']});child.stdout.on('data',b=>output+=b);child.stderr.on('data',b=>output+=b);child.on('error',e=>output+=e.message)}
|
||||
async function stop(){if(child&&child.exitCode===null){const done=new Promise(r=>child.once('exit',r));child.kill();await done}}
|
||||
async function ready(){for(let i=0;i<150;i++){if(child.exitCode!==null)throw Error(output);try{if((await fetch(base+'/api/appearance')).ok)return}catch{}await wait(100)}throw Error('server timeout '+output)}
|
||||
let report={root};
|
||||
@@ -52,8 +52,8 @@ try {
|
||||
await page.setViewportSize({width,height:1000});
|
||||
for(const name of ['archives','register']) {await open(name);assert.ok(await page.locator('#workspace-content').evaluate(e=>e.scrollWidth<=e.clientWidth+1));}
|
||||
}
|
||||
await home();await page.locator('#home-app-realtime').click();await page.waitForURL('**/realtime');await labels(['实时工作台','电子围栏','黑白名单管理']);
|
||||
for(const name of ['geofences','target-lists','realtime']) {await open(name);await labels(['实时工作台','电子围栏','黑白名单管理']);assert.equal(await page.locator('.reference-rail [aria-current=page]').getAttribute('data-menu'),name);}
|
||||
await home();await page.locator('#home-app-realtime').click();await page.waitForURL('**/realtime');await labels(['实时工作台','设备管理','电子围栏','黑白名单管理']);
|
||||
for(const name of ['geofences','target-lists','receivers','realtime']) {await open(name);await labels(['实时工作台','设备管理','电子围栏','黑白名单管理']);assert.equal(await page.locator('.reference-rail [aria-current=page]').getAttribute('data-menu'),name);}
|
||||
await page.locator('#toggle-menu').click();assert.equal(await page.locator('.reference-rail').isVisible(),false);await page.locator('#toggle-menu').click();
|
||||
await home();await page.locator('#home-app-settings').focus();await page.keyboard.press('Enter');await labels(['壁纸与外观','显示方式','地图配置']);
|
||||
await page.locator('#toggle-menu').click();await page.locator('.workspace-home-link').click();await labels([]);assert.equal(await page.locator('#toggle-menu').isVisible(),false);await page.locator('#home-app-settings').click();assert.equal(await page.locator('.reference-rail').isVisible(),false);assert.equal(await page.locator('#toggle-menu').isVisible(),true);await page.locator('#toggle-menu').click();await labels(['壁纸与外观','显示方式','地图配置']);
|
||||
|
||||
Reference in New Issue
Block a user