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 && }