Agent Skills › brijr/gui › e2e-motion

e2e-motion

GitHub

指导在 Playwright E2E 测试中处理 GUI 动画、布局过渡及视口变化时的等待策略。提供替代 waitForTimeout 的状态轮询方法,涵盖预览变形、聊天面板弹簧动画及页面转换的处理技巧。

.cursor/skills/e2e-motion/SKILL.md brijr/gui

触发场景

编写或修复涉及界面动画的 E2E 测试 解决因 UI 动效导致的测试不稳定问题 需要等待布局稳定后断言

安装

npx skills add brijr/gui --skill e2e-motion -g -y
更多选项

不安装直接使用

npx skills use brijr/gui@e2e-motion

指定 Agent (Claude Code)

npx skills add brijr/gui --skill e2e-motion -a claude-code -g -y

安装 repo 全部 skill

npx skills add brijr/gui --all -g -y

预览 repo 内 skill

npx skills add brijr/gui --list

SKILL.md

Frontmatter
{
    "name": "e2e-motion",
    "description": "Wait for Gui preview morphs, chat springs, and layout to settle in Playwright e2e tests. Use when writing or fixing e2e tests that move the chat, resize the preview, change viewports, or assert geometry."
}

Waiting out motion

Do not use Playwright waitForTimeout. Architecture CI rejects it in e2e/**/*.spec.ts.

Poll for the state you mean, with waitFor from e2e/helpers/env.ts. Errors from the check count as "not yet".

Preview morphs (viewport, zoom, dock, drawer, focus mode) spring the live view. Unpackaged builds expose globalThis.guiMorphing (a Set of in-flight ids in src/main/preview-morph.ts). Wait until it is empty and the layout you care about matches, as e2e/sidebar.spec.ts and e2e/select-bubble.spec.ts do:

const now = await session.app.evaluate(() => ({
  morphing: ((globalThis as { guiMorphing?: Set<number> }).guiMorphing?.size ?? 0) > 0,
}))
if (now.morphing) return null

Chat panel springs (drag, throw, dodge) move the native view in src/main/panel-flight.ts. Read bounds from main (WebContentsView.getBounds()), not a screenshot, and waitFor the corner/gap you expect. See e2e/panel-motion.spec.ts.

Chat page transitions (send, queue, permission collapse) are view transitions in the chat renderer. Assert the DOM or snapshot, not elapsed milliseconds. See e2e/chat-motion.spec.ts.

Fixed sleep from e2e/helpers/env.ts is only for measuring motion (sampling springs) or capturing a recording for a duration. Prefer waitFor everywhere else.

Mid-motion shots (session.shot with GUI_E2E_SHOTS=1) capture each layer separately, so a moving spring tears between them. Set globalThis.guiMotionScale = 10 in main (unpackaged builds) to run main's springs ten times slower while you shoot, and back to 1 after; see shootDockMorphs in e2e/panel-motion.spec.ts.

launch({ reducedMotion: 'reduce' }) disables springs when the test is about the end state, not the path.

版本历史

  • eecbbe2 当前 2026-11-19 21:09

同 Skill 集合

.cursor/skills/release/SKILL.md

元信息

文件数
0
版本
63f6ae4
Hash
62b8b8c4
收录时间
2026-11-19 21:09

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-22 19:18
浙ICP备14020137号-1