Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

test(web): 缺预览用例复用服务提供的可播放资源

longmeidao06e7143cf9bc
diff --git a/frontend/e2e/library-completion.test.ts b/frontend/e2e/library-completion.test.ts
index e55ba65c1..cc466901b 100644
--- a/frontend/e2e/library-completion.test.ts
+++ b/frontend/e2e/library-completion.test.ts
@@ -4,9 +4,12 @@ import path from 'node:path';
import { after, before, describe, it } from 'node:test';
import type { Browser } from 'playwright-core';
-import { launch, layout, VIEWPORTS } from './harness.ts';
+import { launch, layout, requiredEnv, VIEWPORTS } from './harness.ts';
import { openItemPage } from './item-fixture.ts';
+// 暂无预览只表示图片尚未生成,媒体仍复用测试服务提供的有效短片。
+const itemId = Number(requiredEnv('PEACH_E2E_ITEM'));
+
describe('缺预览时的统一补全入口', () => {
let browser: Browser;
before(async () => { browser = await launch() });
@@ -22,7 +25,7 @@ describe('缺预览时的统一补全入口', () => {
let pendingStage = '';
const posts: Record<string, unknown>[] = [];
await page.route(url => url.pathname === '/api/items', route => route.fulfill({ json: {
- items: [{ id: 11, name: '没有预览的本地影片.mp4', medium: 'video', location: 'local',
+ items: [{ id: itemId, name: '没有预览的本地影片.mp4', medium: 'video', location: 'local',
has_thumb: complete, has_local_poster: complete, size: 12345, duration: 3600 }],
total: 1, has_more: false,
} }));
@@ -107,7 +110,7 @@ describe('缺预览时的统一补全入口', () => {
await menu.getByRole('button', { name: /^仅补全预览图/ }).click();
await prompt.waitFor({ state: 'hidden' });
await page.locator('[data-media-card] img.poster').waitFor();
- assert.deepEqual(posts, [{ stage: 'previews', asset_ids: [11] }]);
+ assert.deepEqual(posts, [{ stage: 'previews', asset_ids: [itemId] }]);
assert.deepEqual(opened.problems, []);
} finally { await opened.close() }
});
diff --git a/frontend/e2e/library-processing-controls.test.ts b/frontend/e2e/library-processing-controls.test.ts
index a55bd5aa0..301128c5c 100644
--- a/frontend/e2e/library-processing-controls.test.ts
+++ b/frontend/e2e/library-processing-controls.test.ts
@@ -3,7 +3,10 @@ import { mkdir } from 'node:fs/promises';
import path from 'node:path';
import { after, before, describe, it } from 'node:test';
import type { Browser } from 'playwright-core';
-import { launch, layout, settle, visit, VIEWPORTS } from './harness.ts';
+import { launch, layout, requiredEnv, settle, visit, VIEWPORTS } from './harness.ts';
+
+// 暂无预览只表示图片尚未生成,媒体仍复用测试服务提供的有效短片。
+const itemId = Number(requiredEnv('PEACH_E2E_ITEM'));
describe('扫描与采集控制', () => {
let browser: Browser;
@@ -301,7 +304,7 @@ describe('扫描与采集控制', () => {
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',
+ items: [{ id: itemId, name: '没有预览的本地影片.mp4', medium: 'video', location: 'local',
has_thumb: false, has_local_poster: false, size: 12345, duration: 3600 }],
total: 1, has_more: false,
} }));