Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计提醒

testing-blocks测试块

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

2,752

周安装

117

GitHub Stars

55

下载量

964
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:testing-blocks(测试块)
来源仓库:https://github.com/adobe/skills
仓库路径:skills/testing-blocks
安装命令:
npx skills add https://github.com/adobe/skills --skill testing-blocks
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/adobe/skills --skill testing-blocks

简介

用于模块化组织和管理测试相关功能组件。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 适合构建可复用的测试工具链和辅助脚本。
  • 支持快速搭建测试环境和初始化基础结构。
  • 需根据具体项目选择合适的技术栈和依赖项。
  • testing-blocks 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Testing Blocks

This skill guides you through testing code changes in AEM Edge Delivery Services projects. Testing follows a value-versus-cost philosophy: create and maintain tests when the value they bring exceeds the cost of creation and maintenance.

CRITICAL: Browser validation is MANDATORY. You cannot complete this skill without providing proof of functional testing in a real browser environment.

Related Skills

  • content-driven-development: Test content created during CDD serves as the basis for testing
  • building-blocks: Invokes this skill during Step 5 for comprehensive testing
  • block-collection-and-party: May provide reference test patterns from similar blocks

When to Use This Skill

Use this skill:

  • ✅ After implementing or modifying blocks
  • ✅ After changes to core scripts (scripts.js, delayed.js, aem.js)
  • ✅ After style changes (styles.css, lazy-styles.css)
  • ✅ After configuration changes that affect functionality
  • ✅ Before opening any pull request with code changes

This skill is typically invoked by the building-blocks skill during Step 5 (Test Implementation).

Testing Workflow

Track your progress:

  • Step 1: Run linting and fix issues
  • Step 2: Perform browser validation (MANDATORY)
  • Step 3: Determine if unit tests are needed (optional)
  • Step 4: Run existing tests and verify they pass

Step 1: Run Linting

Run linting first to catch code quality issues:

npm run lint

If linting fails:

npm run lint:fix

Manually fix remaining issues that auto-fix couldn't handle.

Success criteria:

  • ✅ Linting passes with no errors
  • ✅ Code follows project standards

Mark complete when: npm run lint passes with no errors


Step 2: Browser Validation (MANDATORY)

CRITICAL: You must test in a real browser and provide proof.

What to Test

Load test content URL(s) in browser and validate:

  • ✅ Block/functionality renders correctly
  • ✅ Responsive behavior (mobile, tablet, desktop viewports)
  • ✅ No console errors
  • ✅ Visual appearance matches requirements/acceptance criteria
  • ✅ Interactive behavior works (if applicable)
  • ✅ All variants render correctly (if applicable)

How to Test

Choose the method that makes most sense given your available tools:

Option 1: Browser/Playwright MCP (Recommended)

If you have MCP browser or Playwright tools available, use them directly:

  • Navigate to test content URL
  • Take accessibility snapshots to inspect rendered content (preferred for interaction)
  • Take screenshots at different viewports for visual validation

- Consider both full-page screenshots and element-specific screenshots of the block being tested

  • Interact with elements as needed
  • Most efficient for agents with tool access

Option 2: Playwright automation

Write one (or more) temporary test scripts to validate functionality with playwright and capture snapshots/screenshots for inspection and validation.

// test-my-block.js (temporary - don't commit)
import { chromium } from 'playwright';

async function test() {
  const browser = await chromium.launch({ headless: false });
  const page = await browser.newPage();

  // Navigate and wait for block
  await page.goto('http://localhost:3000/path/to/test');
  await page.waitForSelector('.my-block');

  // Inspect accessibility tree (useful for validating structure)
  const accessibilityTree = await page.accessibility.snapshot();
  console.log('Accessibility tree:', JSON.stringify(accessibilityTree, null, 2));

  // Optionally save to file for easier analysis
  await require('fs').promises.writeFile(
    'accessibility-tree.json',
    JSON.stringify(accessibilityTree, null, 2)
  );

  // Test viewports and take screenshots
  await page.setViewportSize({ width: 375, height: 667 });
  await page.screenshot({ path: 'mobile.png', fullPage: true });
  await page.locator('.my-block').screenshot({ path: 'mobile-block.png' });

  await page.setViewportSize({ width: 768, height: 1024 });
  await page.screenshot({ path: 'tablet.png', fullPage: true });
  await page.locator('.my-block').screenshot({ path: 'tablet-block.png' });

  await page.setViewportSize({ width: 1200, height: 800 });
  await page.screenshot({ path: 'desktop.png', fullPage: true });
  await page.locator('.my-block').screenshot({ path: 'desktop-block.png' });

  // Check for console errors
  page.on('console', msg => console.log('Browser:', msg.text()));

  await browser.close();
}

test().catch(console.error);

Run: node test-my-block.js then delete the script and analyze the resulting artifacts.

Option 3: Manual browser testing

Use a standard web browser with dev tools:

  1. Navigate to test content: http://localhost:3000/path/to/test/content
  2. Use browser dev tools responsive mode to test viewports:

- Mobile: <600px (e.g., 375px) - Tablet: 600-900px (e.g., 768px) - Desktop: >900px (e.g., 1200px)

  1. Check console for errors at each viewport
  2. Take screenshots as proof (browser screenshot tool or dev tools)

Validation Against Acceptance Criteria

If acceptance criteria provided (from CDD Step 2):

  • Review each criterion
  • Test specific scenarios mentioned
  • Verify all criteria are met

If design/mockup screenshots provided:

  • Compare implementation to design
  • Verify visual alignment
  • Note any intentional deviations

Proof of Testing

You must provide:

  • ✅ Screenshots of test content in browser (at least one viewport)
  • ✅ Confirmation no console errors
  • ✅ Confirmation acceptance criteria met (if provided)

Success criteria:

  • ✅ All test content loads and renders correctly
  • ✅ Responsive behavior validated across viewports
  • ✅ No console errors
  • ✅ Screenshots captured as proof
  • ✅ Acceptance criteria validated (if provided)

Mark complete when: Browser testing complete with screenshots as proof


Step 3: Unit Tests (Optional)

Determine if unit tests are needed for this change.

Write unit tests when:

  • ✅ Logic-heavy functions (calculations, transformations)
  • ✅ Utility functions used across multiple blocks
  • ✅ Data processing or API integrations
  • ✅ Complex business logic

Skip unit tests when:

  • ❌ Simple DOM manipulation
  • ❌ CSS-only changes
  • ❌ Straightforward decoration logic
  • ❌ Changes easily validated in browser

For guidance on what to test: See resources/testing-philosophy.md

If unit tests needed:

# Verify test setup (see resources/vitest-setup.md if not configured)
npm test

# Write test for utility function
# test/utils/my-utility.test.js
import { describe, it, expect } from 'vitest';
import { myUtility } from '../../scripts/utils/my-utility.js';

describe('myUtility', () => {
  it('should transform input correctly', () => {
    expect(myUtility('input')).toBe('OUTPUT');
  });
});

For detailed unit testing guidance: See resources/unit-testing.md

Success criteria:

  • ✅ Unit tests written for logic-heavy code
  • ✅ Tests pass: npm test
  • ✅ OR determined unit tests not needed

Mark complete when: Unit tests written and passing, or determined not needed


Step 4: Run Existing Tests

Verify your changes don't break existing functionality:

npm test

If tests fail:

  1. Read error message carefully
  2. Run single test to isolate: npm test -- path/to/test.js
  3. Fix code or update test if expectations changed
  4. Re-run full test suite

Success criteria:

  • ✅ All existing tests pass
  • ✅ No regressions introduced

Mark complete when: npm test passes with no failures

Troubleshooting

For detailed troubleshooting guide, see resources/troubleshooting.md.

Common issues:

Tests fail

  • Read error message carefully
  • Run single test: npm test -- path/to/test.js
  • Fix code or update test

Linting fails

  • Run npm run lint:fix
  • Manually fix remaining issues

Browser tests fail

  • Verify dev server running: aem up --html-folder drafts
  • Check test content exists in drafts/tmp/
  • Verify URL uses /tmp/ path: http://localhost:3000/drafts/tmp/my-block
  • Add waits: await page.waitForSelector('.block')

Resources

  • Unit Testing: resources/unit-testing.md - Complete guide to writing and maintaining unit tests
  • Troubleshooting: resources/troubleshooting.md - Solutions to common testing issues
  • Vitest Setup: resources/vitest-setup.md - One-time configuration guide
  • Testing Philosophy: resources/testing-philosophy.md - Guide on what and how to test

Integration with Building Blocks Skill

The building-blocks skill invokes this skill during Step 5 (Test Implementation).

Inputs received from building-blocks:

  • Block name being tested
  • Test content URL(s) (from CDD Step 4)
  • Any variants that need testing
  • Screenshots of existing implementation/design/mockup to verify against (if provided)
  • Acceptance criteria to verify (from CDD Step 2)

Expected outputs to return to building-blocks:

  • ✅ Confirmation all testing steps complete
  • ✅ Screenshots from browser testing as proof
  • ✅ Confirmation linting passes
  • ✅ Confirmation tests pass
  • ✅ Any issues discovered and resolved

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.8%
按下载量换算355

Claude

28.37%
按下载量换算273

Cursor

19.51%
按下载量换算188

Gemini CLI

8.29%
按下载量换算80

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills