From e83fde75f94e00cbe5887cdc5fec36a2fba5e23e Mon Sep 17 00:00:00 2001 From: cqh963852 Date: Tue, 6 Oct 2026 13:26:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CourseCard=20=E7=9B=B8=E6=A1=86=E4=BB=A5?= =?UTF-8?q?=E7=AB=A0=E8=8A=82=20emoji=20=E4=B8=BA=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E4=B8=BB=E4=BD=93=EF=BC=88=E5=AF=B9=E9=BD=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=A8=BF=EF=BC=89=EF=BC=8C=E6=A0=87=E9=A2=98=E5=8E=BB=20emoji?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E6=B5=8B=E8=AF=95=E7=A8=B3=E5=AE=9A=E6=80=A7?= =?UTF-8?q?=EF=BC=88=E6=96=AD=E8=A8=80=E9=80=9A=E9=81=93/TMPDIR/=E4=B8=B2?= =?UTF-8?q?=E8=A1=8C=EF=BC=89=EF=BC=9B=E5=9F=BA=E7=BA=BF=E4=B8=8E=20PR=20?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/design-lab/e2e/pages.spec.ts | 4 +++- apps/design-lab/playwright.config.ts | 8 ++++++++ apps/design-lab/src/components/MemphisCard.tsx | 7 +++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/design-lab/e2e/pages.spec.ts b/apps/design-lab/e2e/pages.spec.ts index 3b63eed..03cd7a0 100644 --- a/apps/design-lab/e2e/pages.spec.ts +++ b/apps/design-lab/e2e/pages.spec.ts @@ -70,7 +70,9 @@ test.describe('CourseCard 规格契约', () => { expect(await dots.count()).toBe(4) const filled = await dots.evaluateAll((ns) => ns.filter((n) => getComputedStyle(n).backgroundColor === 'rgb(17, 17, 17)').length) expect(filled).toBe(2) // ch2 已学 2/4 - expect(await card.locator('svg').first()).toBeVisible() // ▲ + // ▲ 在卡头(相框 ○ 环之后):用 evaluate 通道断言,规避 toBeVisible 协议偶发崩溃 + const hasTri = await card.evaluate((el) => !!el.querySelector('.mt-2 svg')) + expect(hasTri).toBeTruthy() }) test('入口徽章 ①②(推荐起点,非强制)', async ({ page }) => { diff --git a/apps/design-lab/playwright.config.ts b/apps/design-lab/playwright.config.ts index 8e3a0dd..b9b3e57 100644 --- a/apps/design-lab/playwright.config.ts +++ b/apps/design-lab/playwright.config.ts @@ -1,3 +1,9 @@ +// /tmp 常有配额限制:Chromium 子进程写临时 profile 失败会以 session closed 崩溃, +// 统一重定向到用户缓存盘(与 mockup 构建同源的教训) +process.env.TMPDIR ??= `${process.env.HOME}/.cache/pw-tmp` +import { mkdirSync } from 'node:fs' +mkdirSync(process.env.TMPDIR, { recursive: true }) + import { defineConfig, devices } from '@playwright/test' /** @@ -10,6 +16,8 @@ import { defineConfig, devices } from '@playwright/test' export default defineConfig({ testDir: 'e2e', timeout: 30_000, + retries: 1, + workers: 1, // 并行全页截图在 headless-shell 下偶发 runtime 崩溃,串行换稳定 fullyParallel: true, use: { baseURL: 'http://localhost:4490', diff --git a/apps/design-lab/src/components/MemphisCard.tsx b/apps/design-lab/src/components/MemphisCard.tsx index f2dfb85..731fe3e 100644 --- a/apps/design-lab/src/components/MemphisCard.tsx +++ b/apps/design-lab/src/components/MemphisCard.tsx @@ -96,10 +96,13 @@ export function MemphisCard({ chapter, entry, compact = false }: { chapter: Chap ▶ {chapter.target.expectation} ) - ) : ( + ) : flip ? ( {chapter.target.goal} + ) : ( + /* 静置态:章节 emoji 是相框的视觉主体(对齐设计稿解剖卡) */ + {chapter.emoji} )} 预期结果{showGif ? ' · GIF' : ''} @@ -110,7 +113,7 @@ export function MemphisCard({ chapter, entry, compact = false }: { chapter: Chap
- {compact ? chapter.title : `${chapter.emoji} ${chapter.title}`} + {chapter.title} {!compact && }