Peach: Local-first video metadata scraper and media manager.
test(web): 对齐运行态补全契约并等待字幕媒体就绪
longmeidaofb3eca2bd201
diff --git a/frontend/e2e/library-processing-controls.test.ts b/frontend/e2e/library-processing-controls.test.tsindex 9e1dfa621..a55bd5aa0 100644--- a/frontend/e2e/library-processing-controls.test.ts+++ b/frontend/e2e/library-processing-controls.test.ts@@ -300,8 +300,21 @@ describe('扫描与采集控制', () => {assert.deepEqual(measured.offenders, []);await page.screenshot({ path: path.join(artifacts, `${viewport.name}-page.png`), fullPage: true });await card.screenshot({ path: path.join(artifacts, `${viewport.name}.png`) });+ await page.route(url => url.pathname === '/api/items', route => route.fulfill({ json: {+ items: [{ id: 11, name: '没有预览的本地影片.mp4', medium: 'video', location: 'local',+ has_thumb: false, has_local_poster: false, size: 12345, duration: 3600 }],+ total: 1, has_more: false,+ } }));await page.goto(new URL('/', page.url()).href);- assert.equal(await page.locator('[data-library-completion]').count(), 0, '运行期间首页由常驻任务卡承接进度');+ const completion = page.locator('[data-library-completion]');+ await completion.getByText(/1 部暂无预览,当前任务结束后可单独补全/).waitFor();+ const complete = completion.getByRole('button', { name: '同步这些影片', exact: true });+ assert.equal(await complete.getAttribute('aria-disabled'), 'true');+ const writesBefore = writes.length;+ await complete.dispatchEvent('click');+ await completion.getByRole('button', { name: '更多同步方式', exact: true }).dispatchEvent('click');+ assert.equal(await completion.getByRole('button', { name: '更多同步方式', exact: true }).getAttribute('aria-expanded'), 'false');+ assert.equal(writes.length, writesBefore, '运行期间不能追加或替换补全任务');await dock.getByRole('button', { name: '暂停', exact: true }).waitFor();await page.emulateMedia({ reducedMotion: 'no-preference' });await dock.getByText('查看明细', { exact: true }).click();diff --git a/frontend/e2e/player-subtitles.test.ts b/frontend/e2e/player-subtitles.test.tsindex f9eb43375..c80d2865b 100644--- a/frontend/e2e/player-subtitles.test.ts+++ b/frontend/e2e/player-subtitles.test.ts@@ -201,6 +201,8 @@ describe('播放器字幕', () => {try {await page.locator('#stage .vjs-peach-bezel').waitFor({ state: 'attached' });await page.waitForFunction(id => [...(document.querySelector<HTMLVideoElement>('#stage video.vjs-tech')?.textTracks || [])].some(track => track.id === id), key);+ await page.waitForFunction(() => document.querySelector<HTMLVideoElement>('#stage video.vjs-tech')!.readyState >= 2);+ await page.locator('#stage video.vjs-tech').evaluate((video: HTMLVideoElement) => { video.currentTime = .25 });await menu(page);await page.getByRole('menuitemradio', { name: 'SRT', exact: true }).click();await caption(page, '同目录字幕');