Peach: Local-first video metadata scraper and media manager.
test(web): 将浏览器与 CSS 门槛对齐单入口产物
longmeidao9fcba1eaf034
diff --git a/frontend/e2e/design-cards.test.ts b/frontend/e2e/design-cards.test.tsindex 0d9d2d721..fa7d2bf65 100644--- a/frontend/e2e/design-cards.test.ts+++ b/frontend/e2e/design-cards.test.ts@@ -563,7 +563,7 @@ describe('设计决定:作品卡、管理页与复核', () => {/* 回执走真的入口发一条不会自己消失的,等栈里每一条都进场停稳再量。演示库刚跑完扫描,「扫描与资料采集已完成」随时可能也进栈,所以判据是栈里每一条都在卡上沿之上。 */await opened.page.evaluate(async () => {- const entry = '/dist/peach-ui.js';+ const entry = '/dist/peach-app.js';const ui = await import(entry);ui.showToast(document.getElementById('toasts'), { success: '', error: '' }, 'e2e-tutorial-lift',{ html: '已保存配置', alert: false, timeout: 0, action: null });diff --git a/frontend/e2e/design-controls.test.ts b/frontend/e2e/design-controls.test.tsindex 68303e15a..d47cde115 100644--- a/frontend/e2e/design-controls.test.ts+++ b/frontend/e2e/design-controls.test.ts@@ -464,7 +464,7 @@ describe('设计决定:控件、状态与首页顶部', () => {try {await opened.page.emulateMedia({ reducedMotion: 'no-preference' });const result = await opened.page.evaluate(async () => {- const { popCount } = await import('/js/ui-components.js');+ const { popCount } = await import('/dist/peach-app.js');const host = document.createElement('span');document.body.append(host);popCount(host, '12');diff --git a/frontend/e2e/index-people.test.ts b/frontend/e2e/index-people.test.tsindex ce45894dd..79f9cf61f 100644--- a/frontend/e2e/index-people.test.ts+++ b/frontend/e2e/index-people.test.ts@@ -35,12 +35,13 @@ describe('本地与在线艺人共用名册布局', () => {const page = await context.newPage();let release!: () => void;const gate = new Promise<void>(resolve => { release = resolve });- await page.route('**/dist/peach-react.js*', async route => {+ await page.route('**/dist/peach-app.js*', async route => {await gate;await route.continue();});try {- await page.goto(requiredEnv('PEACH_E2E_ORIGIN') + path, { waitUntil: 'domcontentloaded' });+ // 主模块落地前直接验收 HTML 骨架;DOMContentLoaded 要等这份模块执行。+ await page.goto(requiredEnv('PEACH_E2E_ORIGIN') + path, { waitUntil: 'commit' });await page.locator('#index [data-skeleton]').first().waitFor();assert.equal(await page.locator('#index [role="tablist"]').count(), 1);assert.deepEqual(await page.locator('#index [role="tab"]').allTextContents(), ['艺人', '卖家', '在线']);diff --git a/frontend/e2e/item-detail.test.ts b/frontend/e2e/item-detail.test.tsindex 34bdb3fff..b3c0d0f19 100644--- a/frontend/e2e/item-detail.test.ts+++ b/frontend/e2e/item-detail.test.ts@@ -59,12 +59,12 @@ describe('作品详情岛', () => {try {const page = opened.page;await page.evaluate(async (path) => {- const moduleUrl = '/dist/peach-ui.js';+ const moduleUrl = '/dist/peach-app.js';const { peachHistory } = await import(moduleUrl);peachHistory.push(path);}, destination);await pathIs(page, destination);- await page.evaluate(async () => { const moduleUrl = '/dist/peach-ui.js'; (await import(moduleUrl)).peachHistory.push('/') });+ await page.evaluate(async () => { const moduleUrl = '/dist/peach-app.js'; (await import(moduleUrl)).peachHistory.push('/') });await page.locator(PART_CARD).waitFor();const depth = await page.evaluate(() => history.length);let arrived = () => {};@@ -87,14 +87,14 @@ describe('作品详情岛', () => {await page.goBack();await pathIs(page, destination);await page.waitForFunction(() => !document.querySelector('#stage[open]'));- const seq = await page.evaluate(async () => { const moduleUrl = '/dist/peach-ui.js'; return (await import(moduleUrl)).peachHistory.navigation.seq });+ const seq = await page.evaluate(async () => { const moduleUrl = '/dist/peach-app.js'; return (await import(moduleUrl)).peachHistory.navigation.seq });release();await responded;await page.waitForTimeout(500);assert.equal(await page.locator('#stage[open]').count(), 0);assert.equal(await page.evaluate(() => location.pathname), destination);assert.equal(await page.evaluate(() => history.length), depth);- assert.equal(await page.evaluate(async () => { const moduleUrl = '/dist/peach-ui.js'; return (await import(moduleUrl)).peachHistory.navigation.seq }), seq);+ assert.equal(await page.evaluate(async () => { const moduleUrl = '/dist/peach-app.js'; return (await import(moduleUrl)).peachHistory.navigation.seq }), seq);assert.deepEqual(opened.stub.writes, []);assert.deepEqual(withoutPlayer(opened.problems), []);} finally { release(); await opened.close() }diff --git a/frontend/e2e/theme-switch.test.ts b/frontend/e2e/theme-switch.test.tsindex e9630fe14..876f66139 100644--- a/frontend/e2e/theme-switch.test.ts+++ b/frontend/e2e/theme-switch.test.ts@@ -27,7 +27,7 @@ describe('切换主题', () => {await settle(page);const result = await section.evaluate(async (host) => {- const entry = '/dist/peach-ui.js', ui = await import(entry);+ const entry = '/dist/peach-app.js', ui = await import(entry);const root = document.documentElement;const thumb = document.querySelector<HTMLElement>('.board-theme-thumb')!;/* `.resourceaction` 只在这一页的加载骨架里出现,页面画完就换成 React 卡片;diff --git a/frontend/e2e/toast-accent.test.ts b/frontend/e2e/toast-accent.test.tsindex 121858013..56e486a10 100644--- a/frontend/e2e/toast-accent.test.ts+++ b/frontend/e2e/toast-accent.test.ts@@ -17,7 +17,7 @@ describe('Toast 操作强调色',()=>{document.documentElement.classList.toggle('dark',theme==='dark');document.documentElement.dataset.accent=accent;(window as any).__undoClicked=0;- const entry='/dist/peach-ui.js',ui=await import(entry);+ const entry='/dist/peach-app.js',ui=await import(entry);ui.showToast(document.getElementById('toasts'),{success:'',error:''},'accent-undo',{html:'已加入稍后看',alert:false,timeout:0,action:{label:'撤销',run:()=>{(window as any).__undoClicked++}}});},{theme,accent});diff --git a/frontend/test/legacy-class-names.test.ts b/frontend/test/legacy-class-names.test.tsindex 40655238e..7ac1554c1 100644--- a/frontend/test/legacy-class-names.test.ts+++ b/frontend/test/legacy-class-names.test.ts@@ -1,6 +1,6 @@/* React 样式产物里的类名不能和旧样式表的类选择器同名。*- * 两份样式表都不分层,`board.css` 与 `/app.css` 排在 `peach-react.css` 后面,同名类按先后由旧规则+ * 两份样式表都不分层,`board.css` 与 `/app.css` 排在 `peach-app.css` 后面,同名类按先后由旧规则* 胜出:卡片网格的 `.grid` 会把 `grid-cols-7` 压成一列、把 `gap-1` 撑到 16px。反过来,生成出来的* `.ring` 也会落到旧页面的 `.ring` 元素上。React 侧真要用的工具类换一种写法(flex 父元素里的网格* 容器写 `inline-grid`);注释里的英文词被扫成工具类的,在 `styles.css` 用 `@source not inline` 排除。 */@@ -39,7 +39,7 @@ it('React 样式产物的类名不和旧样式表同名', () => {(`src/player/player.css`、沉浸岛的 `immerse.css`)只能按这些类写;旧样式表里的同名规则选中的是同一种元素,同名正是契约。 */const videojs = (name: string) => name === 'video-js' || name.startsWith('vjs-');- const shared = [...classNames(read('dist', 'peach-react.css'))]+ const shared = [...classNames(read('dist', 'peach-app.css'))].filter((name) => !agreed.has(name) && !videojs(name) && legacy.has(name));expect(shared).toEqual([]);});diff --git a/frontend/test/react-color-scheme.test.ts b/frontend/test/react-color-scheme.test.tsindex a9cc5e68c..03bd3cbcc 100644--- a/frontend/test/react-color-scheme.test.ts+++ b/frontend/test/react-color-scheme.test.ts@@ -9,7 +9,7 @@ import { resolve } from 'node:path';import { expect, it } from 'vitest';-const css = readFileSync(resolve(process.cwd(), '../web/dist/peach-react.css'), 'utf8');+const css = readFileSync(resolve(process.cwd(), '../web/dist/peach-app.css'), 'utf8');it('React 样式产物里没有依赖 color-scheme 的 lightningcss 变量', () => {const rules = css.match(/[^{}]*\{[^{}]*--lightningcss-(?:light|dark)[^{}]*\}/g) ?? [];