Agent Skills › brijr/gui › e2e-motion

e2e-motion

GitHub

指导在Playwright端到端测试中处理GUI动画和布局过渡,避免使用固定等待,通过轮询状态确保元素稳定后再断言。

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

Trigger Scenarios

编写或修复涉及聊天移动、预览调整大小、视图切换的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
eecbbe2
Hash
62b8b8c4
Indexed
2026-11-19 21:09

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-20 02:07
浙ICP备14020137号-1