Report phone playback metadata once per browser session

This commit is contained in:
Jonathan Sykes
2026-10-03 17:56:01 +08:00
parent 856ddda6a6
commit 8ea92c1aac
6 changed files with 73 additions and 0 deletions

View File

@@ -61,3 +61,13 @@ test('saved deletion is confirmed and a storage failure retains the file',async(
await page.locator('#listFilterInput').fill('extended');
await expect(page.locator('.saved-card')).toHaveCount(1);
});
test('actual device playback reports metadata once without requesting streams',async({page})=>{
await openClassic(page);
const reports=[];await page.route('**/api/media/*/meta',route=>{reports.push(route.request().postDataJSON());return route.fulfill({contentType:'application/json',body:'{"ok":true,"known":false,"cache":"queued"}'});});
await page.evaluate(()=>{
current={meta:{id:'0gfX0dFLaBc',title:'Phone saved song',channel:'Phone artist',duration:240},qualities:[]};
Player.master=els.audio;Player.secondary=null;
els.audio.dispatchEvent(new Event('playing'));els.audio.dispatchEvent(new Event('playing'));
});
await expect.poll(()=>reports.length).toBe(1);expect(reports[0]).toMatchObject({id:'0gfX0dFLaBc',title:'Phone saved song',channel:'Phone artist'});
});