fix: CourseCard 相框以章节 emoji 为视觉主体(对齐设计稿),标题去 emoji;修测试稳定性(断言通道/TMPDIR/串行);基线与 PR 截图同步

This commit is contained in:
cqh963852 committed 2026-10-06 13:26:51 +08:00
1 parent 084d868eec
commit e83fde75f9
3 files changed
+16 -3

No files matched your search

+3 -1
View File
@@ -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 }) => {
+8
View File
@@ -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',
@@ -96,10 +96,13 @@ export function MemphisCard({ chapter, entry, compact = false }: { chapter: Chap
▶ {chapter.target.expectation}
</span>
)
) : (
) : flip ? (
<span className="px-3 text-center text-[11px] leading-snug text-ink/80 mix-blend-multiply">
{chapter.target.goal}
</span>
) : (
/* 静置态:章节 emoji 是相框的视觉主体(对齐设计稿解剖卡) */
<span style={{ fontSize: compact ? '28px' : '40px' }}>{chapter.emoji}</span>
)}
<span className="absolute left-1.5 top-1 text-[9px] font-bold tracking-wide text-paper">
预期结果{showGif ? ' · GIF' : ''}
@@ -110,7 +113,7 @@ export function MemphisCard({ chapter, entry, compact = false }: { chapter: Chap
<div className="mt-2 flex items-center gap-2">
<Tri size={14} />
<b className="flex-1 text-[14px] text-[#2b1d10] [text-shadow:0_1px_1px_rgba(255,255,255,0.9)]">
{compact ? chapter.title : `${chapter.emoji} ${chapter.title}`}
{chapter.title}
</b>
{!compact && <BrickDots bricks={chapter.target.bricks} />}
</div>