Testing Blocks

Guide testing for AEM Edge Delivery blocks with unit and browser tests.

Updated Oct 7, 2025
One-click install
npx skills add https://github.com/blakebauman/aem-camp --skill testing-blocks-blakebauman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Testing Blocks
Source: https://github.com/blakebauman/aem-camp/tree/main/.claude/skills/testing-blocks
Command: npx skills add https://github.com/blakebauman/aem-camp --skill testing-blocks-blakebauman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires playwright, vitest, jsdom.

What problem does it solve?

Ensuring code quality and preventing regressions in AEM Edge Delivery projects can be complex, requiring various testing methodologies. This skill provides a comprehensive guide to efficient testing, balancing value and cost, so you can ship high-quality code faster.

Core Features & Use Cases

  • Unit Testing Guidance: Best practices for writing and maintaining unit tests for logic-heavy utilities and data processing, catching regressions early.
  • Browser Testing Workflow: Guides through using Playwright/Puppeteer for visual and functional validation of block decoration and responsive design, ensuring a flawless user experience.
  • Automated Quality Checks: Integrates linting and performance validation via GitHub checks, streamlining your CI/CD pipeline and maintaining code standards.
  • Use Case: After implementing a new "hero" block, use this skill to guide you through writing unit tests for its utility functions, running browser tests to capture screenshots of its rendering across devices, and ensuring all linting and CI checks pass before creating a PR.

Quick Start

Guide me through the testing workflow for a new "cards" block, focusing on browser testing and linting.

Frequently Asked Questions about Testing Blocks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up unit testing for AEM Edge Delivery blocks?

Unit testing for AEM Edge Delivery blocks uses Vitest with jsdom environment. Place test files alongside source code, write tests for logic-heavy utilities and data processing, and configure npm scripts to run tests before PR submission to catch regressions early.

Can I use Playwright to test block rendering across devices?

Yes, Playwright enables browser testing of block decoration and responsive design. Run visual and functional validation tests to capture screenshots across devices, ensuring your blocks render correctly before pushing code through CI/CD checks.

What testing should I do before submitting a pull request for a new block?

Before PR submission, run unit tests with Vitest, execute browser tests with Playwright to validate rendering and interactions, and pass all linting and performance checks. This workflow ensures code quality and prevents regressions across blocks, scripts, and styles.

How do linting and CI/CD checks integrate into the testing workflow?

Linting and performance validation run as automated GitHub checks in your CI/CD pipeline. These checks maintain code standards and catch issues before review, working alongside unit and browser tests to streamline the path from development to merged code.

What's the difference between keeper and throwaway tests in AEM development?

Keeper tests validate core functionality and prevent regressions; throwaway tests explore behavior during development but aren't retained. Testing Blocks guidance helps classify which tests to maintain, balancing comprehensive coverage with practical maintenance costs.

Does this testing approach work with content-driven development workflows?

Yes, Testing Blocks covers testing guidance that integrates with content-driven development in AEM Edge Delivery. It specifies test file placement, naming conventions, and the end-to-end workflow from implementation through review for content-driven projects.