const {chromium}=require('playwright-core'),fs=require('node:fs'),assert=require('node:assert/strict'); (async()=>{ const base=JSON.parse(fs.readFileSync('D:/web/dj/huobao-data/last-launch.json')).api.replace('/api/v1',''); const browser=await chromium.launch({channel:'chrome',headless:true}); try{ const page=await browser.newPage({viewport:{width:1550,height:1050}}),errors=[]; page.on('pageerror',e=>errors.push(e.message)); await page.route('**/api/**',r=>['GET','HEAD'].includes(r.request().method())?r.continue():r.abort()); await page.goto(base+'/drama/6/episode/1',{waitUntil:'networkidle'}); await page.getByRole('navigation').getByRole('button',{name:/^资产制作/}).click(); const refs=page.locator('.asset-references');await refs.first().waitFor(); assert.equal(await refs.count(),9); assert.equal(await refs.locator('.reference-image').count(),0,'No test references may leak into live data'); const char=page.locator('.character-asset-card').first(); assert.equal(await char.getByRole('button',{name:'添加参考图',exact:true}).count(),1); await char.locator('.character-name').click(); const dialog=page.locator('.asset-detail-dialog');await dialog.waitFor(); assert.equal(await dialog.getByRole('button',{name:'添加参考图',exact:true}).count(),1); await page.keyboard.press('Escape'); await dialog.waitFor({state:'hidden'}); await refs.first().scrollIntoViewIfNeeded(); await page.screenshot({path:'D:/web/dj/integration-work/asset-references-installed.png'}); assert.deepEqual(errors,[]); console.log('PASS: installed app has 9 independent reference controls, detail panel works, no test data or runtime errors'); }finally{await browser.close()} })().catch(e=>{console.error(e.stack);process.exit(1)});