skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
adobe/skills1.7k installs

testing-blocks

Use before writing unit or Playwright E2E tests for an AEM Edge Delivery Services block or script, when deciding what tests a block change needs, or when validating block, script or style changes in a browser before a pull request. EDS block testing has non-obvious conventions (how to locate elements without breaking on author edits, library page vs drafts, analytics assertions, no-framework-addition rule, and waiting on decoration), so check here first. Not for implementing block code (building-blocks) or PR review comments (code-review).

How do I install this agent skill?

npx skills add https://github.com/adobe/skills --skill testing-blocks
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill provides guidance and best practices for testing AEM Edge Delivery Services blocks. No malicious patterns or security risks were detected.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerwarn

    5/5 files flagged

  • ZeroLeakspass

    Score: 93/100 · 2 sections analyzed

What does this agent skill do?

Testing Blocks

Validate code changes and write maintainable tests in AEM Edge Delivery Services projects.

Related Skills

  • content-driven-development: test content created during CDD is what you validate against
  • aem-cli: running aem up (ports in git worktrees, serving ./content/, cleaning up stale ./content/ files that shadow remote .aem.page updates)

Testing Workflow

  • Step 1: Run linting and fix issues
  • Step 2: Validate in a browser (MANDATORY when validating a code change)
  • Step 3: Decide which tests to commit, and write them
  • Step 4: Run the project's tests

Step 2: Browser Validation

Exercise the block in a real browser on the test content URL(s): every variant, mobile, tablet and desktop widths (e.g. 375px, 768px, 1200px), and every interaction. Use whatever tooling you have: browser/Playwright MCP tools, a throwaway Playwright script (delete it afterwards), or a manual browser.


Step 3: Committed Tests

Committed tests guard functional behavior so it doesn't silently regress. Write a test only when a wrong answer is plausible and costly to miss. 100% coverage is not the goal, and neither is a test per variant or per branch; a block with static decoration and no behavior may need no tests at all.

Use the project's test tools. Find them in package.json scripts, test config and existing tests, and follow their file locations and naming. Don't add a second framework. aem-boilerplate ships without one; if the project has no test setup, ask the user before adding one.

Browser (E2E) tests assert the block's functional behavior. Rules for E2E specs:

  • Run them against the block's library page (the canonical example content). It is author-facing reference content and the happy path: don't add rows to it to drive a test. Cover edge cases in unit tests or on a separate drafts page (e.g. ./content/drafts/).
  • Locate elements by role and accessible name. Don't use classes or ids the block's own decorate() adds, or hardcoded authored copy; when you need a label, read it from the page at runtime. The block root class (.{block}) comes from aem.js and is stable.
  • Assert behavior, not visuals: no computed CSS (toHaveCSS, getComputedStyle), geometry (boundingBox), or screenshot comparisons (toHaveScreenshot).

Step 4: Run the Project's Tests

If package.json defines test scripts (the boilerplate has none), run them, including any new tests. E2E suites usually need the dev server (aem up) running.

Troubleshooting

Browser tests fail

  • Verify aem up is running and check the port it logged (in a git worktree aem up uses a branch-hashed port, not 3000; see aem-cli).
  • Local test pages belong under ./content/ (e.g. content/drafts/my-block.html served at /drafts/my-block with no --html-folder flag). If testing a remote .aem.page update, make sure a stale file in ./content/ isn't shadowing that path.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/adobe/skills/testing-blocks">View testing-blocks on skillZs</a>