AgentSkillsCN

canvas-test-selector

为 Drupal Canvas 的变更选择并运行最安全的验证命令。当需要根据 UI、后端、Playwright 测试或相关软件包路径中的变更文件,来决定运行哪些 DDEV 测试、分析或 lint 命令时,可选用此方法。

SKILL.md
--- frontmatter
name: canvas-test-selector
description:
  Select and run the minimum safe verification commands for Drupal Canvas
  changes. Use when determining which DDEV test, analysis, or lint commands to
  run based on changed files in UI, backend, Playwright tests, or related
  package paths.

Canvas test selector

Use this skill after identifying changed files and before running broad validation.

Decision flow

  1. Classify changed paths:
  • UI app: web/modules/contrib/canvas/ui/**.
  • Playwright tests or E2E-affecting code: web/modules/contrib/canvas/tests/**.
  • Backend PHP: web/modules/contrib/canvas/** outside ui/** and tests/**.
  • Other packages: web/modules/contrib/canvas/packages/**.
  1. Run narrow, directly impacted tests first.
  2. Run broader suite only where policy requires it.

Command matrix

  • UI targeted Vitest: ddev n run test -- <relative-test-path-from-ui-dir>
  • UI full Vitest after targeted pass: ddev n run test
  • UI targeted Cypress component spec: ddev cy --component --spec tests/unit/<spec-file>
  • Playwright targeted spec: ddev playwright --spec tests/src/Playwright/<spec-file>
  • Backend targeted PHPUnit: ddev phpunit <relative-path-from-canvas-root>
  • Backend static analysis: ddev phpstan
  • Backend coding standards: ddev phpcs [optional-relative-path]

Guardrails

  • Never run full Cypress component suite.
  • Never run Cypress end-to-end tests.
  • Do not invent unverified broad test commands for CLI package paths.

Output format

When asked to choose tests, return:

  1. Exact commands in run order.
  2. Why each command is included.
  3. Explicit mention of what is intentionally skipped.

Read references/path-mapping.md when path classification is ambiguous.