aem-skill-testing-blocks

Validates AEM Edge Delivery blocks through linting, browser testing, and optional Vitest unit tests.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/capella-hotel-group/capella-hotel-group-poc --skill aem-skill-testing-blocks-capella-hotel-group
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: aem-skill-testing-blocks
Source: https://github.com/capella-hotel-group/capella-hotel-group-poc/tree/main/.github/skills/aem-skill-testing-blocks
Command: npx skills add https://github.com/capella-hotel-group/capella-hotel-group-poc --skill aem-skill-testing-blocks-capella-hotel-group

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes to AEM Edge Delivery Services blocks, scripts, and styles can ship with rendering bugs, console errors, responsive breakdowns, and type errors that linting alone misses. This Skill provides a structured pre-PR testing workflow that catches these issues before they reach review. ## Core Features & Use Cases - Lint and TypeScript validation: Runs npm run lint and npm run build first to surface code quality and type errors, accounting for this project's noEmit TypeScript setup. - Browser validation with Playwright or MCP browser tools: Guides viewport testing (mobile, tablet, desktop), console error checks, and screenshot capture as proof of testing. - Selective unit testing with Vitest: Helps decide when unit tests are worth writing (logic-heavy utilities, data transformations) versus when browser testing suffices, including full Vitest setup instructions. - Use Case: After modifying a hero block in src/blocks/hero/, follow the workflow to lint, load the draft page at http://localhost:3000/drafts/hero, capture screenshots at three viewports, and confirm zero console errors before opening the pull request. ## Quick Start Test my recent block changes by running lint, validating the block in a browser at multiple viewports, and confirming no console errors before I open a pull request.

Frequently Asked Questions about aem-skill-testing-blocks

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

FAQPage Schema
How do I test AEM Edge Delivery blocks before opening a pull request?▼

Run npm run lint and npm run build first, then load the block's test content at http://localhost:3000 in a browser. Validate rendering at mobile, tablet, and desktop viewports, check for console errors, and capture screenshots as proof.

How do I test AEM blocks with Playwright?▼

Write a temporary Playwright script that launches Chromium, navigates to the local test URL, waits for the block selector, and screenshots at 375px, 768px, and 1200px widths. Run it with npx tsx, then delete the script since browser tests are not committed.

When should I write unit tests for AEM block code?▼

Write unit tests only for logic-heavy utilities, data transformations, API integrations, and shared helpers used across blocks. Skip unit tests for DOM manipulation, CSS-only changes, and block decoration logic, which are better validated in a browser.

How do I set up Vitest in a TypeScript AEM project?▼

Install vitest, jsdom, and optionally @vitest/coverage-v8, then create vitest.config.ts with the @/* path alias and jsdom environment. Add test scripts to package.json and include the test/ directory in tsconfig.json.

Why do TypeScript errors not stop the Vite dev server?▼

This project configures tsc with noEmit: true, so TypeScript only type-checks while Vite handles compilation. Errors appear in the terminal but do not block dev mode, so always run npm run build to see the full error list before a PR.

Why does my block return a 404 at the local test URL?▼

Confirm the test file exists at drafts/{name}.plain.html and the URL omits the extension: http://localhost:3000/drafts/{name}. Also verify the dev server is running via npm run start rather than bare aem up.