Agent Skills › brijr/gui › e2e-motion

e2e-motion

GitHub

指导在 Playwright E2E 测试中处理 GUI 动画、布局和过渡效果,禁止使用 waitForTimeout,推荐通过轮询状态或断言 DOM 来确保元素稳定,并提供慢动作录制技巧。

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

Trigger Scenarios

编写或修复涉及聊天移动、预览缩放、布局变化的 Playwright E2E 测试 需要等待 GUI 动画(如弹簧效果、视图过渡)结束以进行几何断言

Install

npx skills add brijr/gui --skill e2e-motion -g -y
More Options

Use without installing

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.

Version History

  • eecbbe2 Current 2026-11-19 21:09

Same Skill Collection

.cursor/skills/release/SKILL.md

Metadata

Files
0
Version
73623b0
Hash
62b8b8c4
Indexed
2026-11-19 21:09

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-20 17:17
浙ICP备14020137号-1