Files
dj/integration-work/browser-test/verify_progress_live.cjs
T

19 lines
1.3 KiB
JavaScript

const {chromium}=require('playwright-core'),fs=require('node:fs'),assert=require('node:assert/strict');
(async()=>{
const root='D:/web/dj',base=JSON.parse(fs.readFileSync(root+'/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:1600,height:1100}}),errors=[];
page.on('pageerror',e=>errors.push(e.message));
await page.addInitScript(()=>localStorage.setItem('huobao:tours',JSON.stringify(['episode'])));
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.getByText('视频制作',{exact:true}).first().click();
const panel=page.locator('.video-task-inspector > .task-progress');await panel.waitFor();
await panel.scrollIntoViewIfNeeded();
const text=await panel.innerText();assert.match(text,/已提交/);assert.match(text,/采样|解码|编码|处理|保存/);
await page.screenshot({path:root+'/integration-work/progress-installed.png'});
assert.deepEqual(errors,[]);console.log('Installed live panel:',text);
}finally{await browser.close()}
})().catch(e=>{console.error(e.stack);process.exit(1)});