Testing Blocks

Test AEM Edge Delivery block code with unit, browser, and linting checks.

Updated Aug 26, 2025
One-click install
npx skills add https://github.com/aemysites/sagarsane-20250826 --skill testing-blocks-aemysites
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Testing Blocks
Source: https://github.com/aemysites/sagarsane-20250826/tree/main/.claude/skills/testing-blocks
Command: npx skills add https://github.com/aemysites/sagarsane-20250826 --skill testing-blocks-aemysites

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Ensuring the quality and functionality of code changes in AEM Edge Delivery Services projects can be complex, involving various types of testing (unit, browser, performance) and a clear strategy for what to test and how. This Skill provides a comprehensive guide to testing, balancing value and cost.

Core Features & Use Cases

  • Pragmatic Testing Philosophy: Guides you on when to create "keeper" unit tests for critical logic versus "throwaway" browser tests for visual validation.
  • Multi-faceted Testing Methods: Covers unit testing with Vitest, browser testing with Playwright/Puppeteer for UI/DOM, linting for code quality, and automated performance validation via GitHub checks.
  • Comprehensive Workflow: Provides a step-by-step workflow from development to PR, ensuring all necessary checks are performed.
  • Use Case: After implementing a new AEM block, use this Skill to ensure all its variants render correctly across devices, core logic functions as expected, and the code adheres to quality standards before submitting a pull request.

Quick Start

Use the Testing Blocks skill to validate the new "Carousel" block. Ensure all variants are tested, linting passes, and performance is optimal.

Frequently Asked Questions about Testing Blocks

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

FAQPage Schema
How do I test code changes in AEM Edge Delivery blocks?

Testing AEM Edge Delivery blocks involves unit testing with Vitest for core logic, browser testing with Playwright or Puppeteer for UI rendering, and linting for code quality. This Skill provides a comprehensive workflow covering block implementations, scripts (scripts.js, delayed.js, aem.js), and stylesheets to validate functionality before submitting pull requests.

What's the difference between keeper tests and throwaway tests?

Keeper tests are unit tests for critical business logic you maintain long-term; throwaway tests are browser tests for visual validation that verify a feature works once then can be discarded. This Skill guides you on which approach fits each scenario to balance testing value against implementation cost.

Can I run linting and performance checks automatically in CI?

Yes. This Skill covers CI/linting integration and automated performance validation via GitHub checks. You can configure linting to enforce code quality standards and set up GitHub checks to validate performance metrics, ensuring all quality gates pass before merge.

How do I organize test content for AEM block testing?

This Skill provides guidance on structuring test content alongside your block implementations, scripts, and stylesheets. It covers best practices for organizing tests so they map clearly to the code they validate, supporting both unit and browser test workflows.

Do I need browser testing with Playwright or Puppeteer for every change?

Not necessarily. This Skill teaches a pragmatic approach: use browser testing for UI/DOM validation and variant rendering, but rely on unit tests for core logic. The framework helps you decide which tool and testing method suits each type of code change.

What performance aspects can I validate for AEM blocks?

This Skill covers automated performance validation integrated into GitHub checks, allowing you to measure and validate performance metrics for your blocks, scripts, and stylesheets. It ensures performance gates are met before code ships to production.