Peach: Local-first video metadata scraper and media manager.
test(web): 浏览器用例跟上作品列、紧凑档控件与稍后看状态图标
longmeidaoa173fcc64466
diff --git a/frontend/e2e/card-layout.test.ts b/frontend/e2e/card-layout.test.tsindex f65a1cd04..df53d3ce3 100644--- a/frontend/e2e/card-layout.test.ts+++ b/frontend/e2e/card-layout.test.ts@@ -72,7 +72,8 @@ describe('混排作品的画面框',()=>{}finally{await context.close()}});}- for(const theme of ['light','dark'])it(`${theme} 稍后看底色与按钮及撤销同步`,async()=>{+ // 稍后看由卡上的状态图标表示,卡面底色留给媒体库来源色,不随稍后看变化。+ for(const theme of ['light','dark'])it(`${theme} 稍后看状态图标与按钮及撤销同步`,async()=>{const context=await browser.newContext({viewport:{width:1280,height:800},colorScheme:theme,reducedMotion:'reduce'});try{const page=await context.newPage();let later=false;@@ -84,10 +85,11 @@ describe('混排作品的画面框',()=>{await page.locator('#filterBtn').focus();await page.mouse.move(0,0);const base=await background();await card.hover();await button.click();await page.locator('#filterBtn').focus();await page.mouse.move(0,0);await page.waitForFunction(()=>document.querySelector('#grid [data-media-card]')?.hasAttribute('data-watch-later'));- assert.equal(await button.getAttribute('aria-pressed'),'true');assert.notEqual(await background(),base);+ const status=card.locator('[data-media-status] [data-status="later"]');+ assert.equal(await button.getAttribute('aria-pressed'),'true');assert.equal(await status.count(),1);assert.ok(await status.isVisible());assert.equal(await background(),base);await page.getByRole('button',{name:'撤销',exact:true}).last().click();await page.locator('#filterBtn').focus();await page.mouse.move(0,0);await page.waitForFunction(()=>!document.querySelector('#grid [data-media-card]')?.hasAttribute('data-watch-later'));- assert.equal(await button.getAttribute('aria-pressed'),'false');assert.equal(await background(),base);+ assert.equal(await button.getAttribute('aria-pressed'),'false');assert.equal(await status.count(),0);assert.equal(await background(),base);}finally{await context.close()}});for(const viewport of VIEWPORTS)it(`${viewport.name} 接着看理由独占两行并可打开完整文本`,async()=>{diff --git a/frontend/e2e/catalog-filter.test.ts b/frontend/e2e/catalog-filter.test.tsindex 1f4e7d236..069a93679 100644--- a/frontend/e2e/catalog-filter.test.ts+++ b/frontend/e2e/catalog-filter.test.ts@@ -133,11 +133,14 @@ describe('首页筛选条', () => {color: style.color, border: style.border, shadow: style.boxShadow, radius: style.borderRadius };});return { heights: candidates.map(node => ({ label: node.getAttribute('aria-label') || node.textContent,- height: node.getBoundingClientRect().height })), actions };+ height: node.getBoundingClientRect().height })), actions,+ compact: parseFloat(getComputedStyle(frame).getPropertyValue('--control-h-compact')) };});- for (const control of controls.heights) assert.equal(control.height, 30, JSON.stringify(control));+ // 筛选条整条取紧凑档:页签、药丸、分段与两枚动作键同高。+ assert.equal(controls.compact, 32);+ for (const control of controls.heights) assert.equal(control.height, controls.compact, JSON.stringify(control));assert.deepEqual(controls.actions[0], controls.actions[1]);- assert.equal(controls.actions[0].width, 30);+ assert.equal(controls.actions[0].width, controls.compact);assert.equal(controls.actions[0].color, 'rgb(255, 255, 255)');assert.match(controls.actions[0].background, /^linear-gradient\(/);const gap = await opened.page.evaluate(() => document.querySelector('#grid [data-media-card]')!.getBoundingClientRect().topdiff --git a/frontend/e2e/catalog-list-widths.test.ts b/frontend/e2e/catalog-list-widths.test.tsindex de7f265e4..edd935c51 100644--- a/frontend/e2e/catalog-list-widths.test.ts+++ b/frontend/e2e/catalog-list-widths.test.ts@@ -32,21 +32,22 @@ describe('馆藏表格列宽与占位图', () => {return { picture: getComputedStyle(picture).backgroundColor,expected: getComputedStyle(picture).getPropertyValue('--sunk').trim(),centerDelta: Math.abs(a.top + a.height / 2 - b.top - b.height / 2),- titleWidth: title.clientWidth, fullWidth: title.scrollWidth,- overflow: getComputedStyle(title).textOverflow };+ titleWidth: title.clientWidth, titleHeight: title.clientHeight, fullHeight: title.scrollHeight,+ lineHeight: parseFloat(getComputedStyle(title).lineHeight), clamp: getComputedStyle(title).webkitLineClamp };});assert.ok(geometry.centerDelta <= 1, JSON.stringify(geometry));assert.notEqual(geometry.picture, 'rgb(255, 255, 255)');- assert.ok(geometry.titleWidth < 320 && geometry.fullWidth > geometry.titleWidth, JSON.stringify(geometry));- assert.equal(geometry.overflow, 'ellipsis');+ // 长标题在「作品」列里最多两行,多出的截掉。+ assert.ok(geometry.titleWidth < 320 && geometry.clamp === '2' && geometry.fullHeight > geometry.titleHeight+ && geometry.titleHeight <= geometry.lineHeight * 2 + 1, JSON.stringify(geometry));assert.equal(await row.locator('[data-list-name]').getAttribute('title'), name);- const defaultLabels = ['名称', '时长', '分辨率', '体积', '评分', '观看次数'];+ const defaultLabels = ['作品', '标签', '时长', '分辨率', '体积', '评分', '观看次数'];const visibleLabels = () => page.locator('[data-catalog-table] th:not([data-table-space]) > span').allTextContents();assert.deepEqual(await visibleLabels(), defaultLabels);await page.getByRole('button', { name: '显示列', exact: true }).click();await page.getByRole('button', { name: '显示全部列', exact: true }).click();await page.keyboard.press('Escape');- assert.deepEqual(await visibleLabels(), ['名称', '番号', '时长', '分辨率', '体积', '评分', '观看次数', '高潮计数', '观看时间', '入库时间', '发行时间']);+ assert.deepEqual(await visibleLabels(), ['作品', '标签', '番号', '时长', '分辨率', '体积', '评分', '观看次数', '高潮计数', '观看时间', '入库时间', '发行时间']);for (const label of ['分辨率', '评分', '高潮计数', '观看次数', '时长', '体积', '入库时间', '观看时间', '发行时间', '番号']) {await page.getByRole('columnheader', { name: label, exact: false }).waitFor();}@@ -55,7 +56,7 @@ describe('馆藏表格列宽与占位图', () => {assert.equal(await row.locator('[data-rating-stars] [data-rate]').count(), 5);assert.equal(await row.locator('[data-rating-stars] [data-rate][data-on="true"]').count(), 4);assert.ok((await row.textContent())?.includes('2026-01-03'));- const header = page.getByRole('columnheader', { name: /^名称/ });+ const header = page.getByRole('columnheader', { name: /^作品/ });const initialWidth = (await header.boundingBox())!.width;if (!viewport.mobile) {const sort = await header.getAttribute('aria-sort');diff --git a/frontend/e2e/catalog-list.test.ts b/frontend/e2e/catalog-list.test.tsindex 2cec27a32..227c688a4 100644--- a/frontend/e2e/catalog-list.test.ts+++ b/frontend/e2e/catalog-list.test.ts@@ -160,7 +160,7 @@ describe('馆藏卡片与列表', () => {const url = new URL(response.url());return url.pathname === '/api/items' && url.searchParams.get('sort') === 'name';});- await page.getByRole('columnheader', { name: /名称/ }).click();+ await page.getByRole('columnheader', { name: /^作品/ }).click();await namedResponse;await page.waitForFunction(() => document.querySelector('[data-catalog-row]')?.getAttribute('data-id') === '9000');assert.equal(requests.at(-1)!.get('dir'), 'asc');diff --git a/frontend/e2e/design-manage.test.ts b/frontend/e2e/design-manage.test.tsindex 1050e4caf..ca9c11dfe 100644--- a/frontend/e2e/design-manage.test.ts+++ b/frontend/e2e/design-manage.test.ts@@ -608,7 +608,8 @@ describe('设计决定:数据管理、索引页与资料页头', () => {const header = getComputedStyle(head);const code = getComputedStyle(head.querySelector('b')!);return {- glass: { filter: glass.backdropFilter, padding: glass.padding, height: glass.height },+ glass: { filter: glass.backdropFilter, padding: glass.padding, height: glass.height,+ compact: parseFloat(glass.getPropertyValue('--control-h-compact')) },card: { radius: card.borderRadius, overflow: card.overflow, face: card.backgroundColor },head: { padding: header.padding, face: header.backgroundColor, size: code.fontSize, weight: code.fontWeight },rows: [...group.querySelectorAll('.duplicate-row')].map((row) => {@@ -618,7 +619,8 @@ describe('设计决定:数据管理、索引页与资料页头', () => {};});assert.match(faces.glass.filter, /blur\(/, '汇总条没有背景模糊,不是玻璃面');- assert.deepEqual([faces.glass.padding, faces.glass.height], ['10px 16px', '50px']);+ // 汇总条里的控件取紧凑档,条高是上下各 10px 内边距加一档紧凑控件。+ assert.deepEqual([faces.glass.padding, faces.glass.height], ['10px 16px', `${20 + faces.glass.compact}px`]);assert.deepEqual([faces.card.radius, faces.card.overflow], ['14px', 'hidden'], '组卡圆角或裁切不对');assert.notEqual(faces.head.face, faces.card.face, '组头和组卡同色,番号那一行分不出来');assert.deepEqual([faces.head.padding, faces.head.size, faces.head.weight], ['20px', '20px', '500']);