К основному содержанию
скилл CX Codex

appbuilder-testing — скилл для Claude Code: тесты App Builder

Скилл генерирует и запускает Jest-тесты для экшенов Adobe App Builder и React-компонентов, включая моки Adobe SDK.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add adobe/skills --skill appbuilder-testing -a claude-code
Открыть на GitHub

Что делает appbuilder-testing

Скилл закрывает тестовую часть проекта на Adobe App Builder. Он разбирает исходники экшенов и UI-компонентов, определяет зависимости и подставляет нужный шаблон: юнит-тест, интеграционный тест против задеплоенного экшена, контрактный тест для обращений к Adobe API или тест React-компонента через Testing Library. Для типовых запросов есть быстрый путь — назвали конкретный тип теста, скилл сразу берётся за генерацию, без обхода всего проекта.

Внутри набор шаблонов и справочников: assets/unit-test-template.js, assets/integration-test-template.js, assets/component-test-template.js, готовые моки для State, Files, Events и Database SDK, клиентов @adobe/aio-lib-*, контекста ExC Shell (@adobe/exc-app) и UIX Guest SDK (@adobe/uix-guest). Компоненты оборачиваются в <Provider theme={defaultTheme}>, потому что без него Spectrum ничего не рендерит. Тесты кладутся в test/ с зеркалированием пути экшена, запуск — aio app test или npx jest --coverage.

Для работы нужны aio CLI, Node.js 18+ и Jest. Если в проекте нестандартная структура каталогов или тестовый фреймворк не Jest, шаблоны придётся править руками — это повод проверить конфиг до генерации.

Какие задачи решает

  • написать юнит-тесты для Runtime-экшена
  • замокать State, Files или Events SDK в тесте
  • проверить задеплоенный экшен интеграционным тестом
  • протестировать React-компонент с Provider и ARIA-селекторами
  • разобраться, почему падает Jest в App Builder-проекте

Примеры запросов агенту

  • Напиши юнит-тесты для моего экшена
  • Мой экшен использует State SDK — помоги замокать его в тестах
  • Прогони тесты и покажи покрытие

Как установить appbuilder-testing

1Через Skills CLI (Vercel)

npx skills add adobe/skills --skill appbuilder-testing -a claude-code

2Вручную: положить файлы

~/.claude/skills/appbuilder-testing/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/appbuilder-testing/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о appbuilder-testing

Как установить appbuilder-testing в Claude?

Выполните npx skills add adobe/skills --skill appbuilder-testing -a claude-code. После этого файл скилла появится в ~/.claude/skills/appbuilder-testing/SKILL.md.

Что делает appbuilder-testing?

Генерирует Jest-тесты для экшенов и UI-компонентов Adobe App Builder и запускает их. Подставляет моки Adobe SDK и проверяет результат по чек-листу перед деплоем.

Что нужно для работы скилла?

aio CLI, Node.js 18+ и Jest. Тестовые файлы размещаются в test/, запуск идёт через aio app test или npx jest --coverage.

Исходный текст

SKILL.md · Apache-2.0
---
name: appbuilder-testing
description: >-
  Generate and run tests for Adobe App Builder actions and UI components. Scaffolds Jest unit tests,
  integration tests against deployed actions, contract tests for Adobe API interactions, and React
  component tests using Testing Library. Provides mock helpers for State, Files, Events SDKs,
  @adobe/aio-lib-* clients, ExC Shell context (@adobe/exc-app), and UIX Guest SDK (@adobe/uix-guest).
  Use this skill whenever the user mentions testing App Builder actions, writing unit tests for
  Runtime actions, creating integration tests, mocking Adobe SDKs, setting up test fixtures, running
  aio app test, or wants to verify action behavior before deployment. Also trigger when users mention
  Jest configuration for App Builder, test coverage, CI test setup, React component test, Testing
  Library, UI test, Provider wrapper, test my page, test my form, test my table, test my component,
  mock shell context, mock extension context, debug test failures, or fix Jest errors.
metadata:
  category: testing
license: Apache-2.0
compatibility: Requires aio CLI, Node.js 18+, and Jest
allowed-tools: Bash(aio:*) Bash(npm:*) Bash(node:*) Bash(npx:*) Read Write Edit
---
# App Builder Testing

Generate and run Jest tests for Adobe App Builder actions and React Spectrum UI components. Scaffolds unit tests, integration tests, component tests, and mock helpers for Adobe SDKs.

## Pattern Quick-Reference

Pick the template or reference that matches the user's intent. Default to `assets/unit-test-template.js` for generic test requests.

| User wants | Reference | Template / Asset |
| --- | --- | --- |
| Unit test for an existing action | references/testing-patterns.md | assets/unit-test-template.js |
| Integration test against deployed action | references/testing-patterns.md | assets/integration-test-template.js |
| Component test for React Spectrum UI | references/component-testing-patterns.md | assets/component-test-template.js |
| Mock ExC Shell context in tests | references/component-testing-patterns.md | assets/shell-mock-helper.js |
| Mock AEM extension context in tests | references/component-testing-patterns.md | assets/uix-guest-mock-helper.js |
| Mock State SDK in tests | references/mock-catalog.md | assets/mock-state-sdk.js |
| Mock Files SDK in tests | references/mock-catalog.md | assets/mock-files-sdk.js |
| Mock Events SDK in tests | references/mock-catalog.md | assets/mock-events-sdk.js |
| Mock Database SDK in tests | references/mock-catalog.md | assets/mock-database-sdk.js |
| Full mock catalog (all SDKs) | references/mock-catalog.md | — |
| Contract test for API interactions | references/testing-patterns.md | — |
| Pre-deployment verification | references/checklist.md | — |
| Debug test failures | references/debugging.md | — |

## Fast Path (for clear requests)

When the user's request maps unambiguously to a single pattern above — they name a specific test type, reference a template, or describe a use case that clearly matches one entry — skip straight to generation. Use the matched template and proceed directly.

Examples of fast-path triggers:

- "Write tests for my action" → Read the action source, use `assets/unit-test-template.js`, generate immediately
- "Help me mock State SDK" → Use `assets/mock-state-sdk.js`, inject into test file
- "Add integration tests" → Use `assets/integration-test-template.js`, configure for deployed action
- "Run tests with coverage" → Execute `npx jest --coverage` or `aio app test`
- "Test my component/page/form/table" → Read the component source, use `assets/component-test-template.js`, wrap in Provider
- "Mock shell context" → Use `assets/shell-mock-helper.js`, inject into test file
- "Test my AEM extension component" → Use `assets/uix-guest-mock-helper.js` + `assets/component-test-template.js`

If there is any ambiguity — multiple test types needed, project structure unclear, or the user hasn't specified enough — fall through to the full workflow below.

## Quick Reference

- **Test directory:** Place test files in `test/` mirroring the action path, e.g., `test/actions/<action-name>/index.test.js`.
- **Jest configuration:** App Builder projects use Jest by default. Config lives in `package.json` or `jest.config.js`.
- **Test command:** `aio app test` (wrapper) or `npx jest --coverage` (direct).
- **Mock pattern:** Use `jest.mock()` at the top of test files to mock Adobe SDK dependencies before importing the action.
- **Response shape:** All actions return `{ statusCode, body }` — assert both in every test.
- **Error paths:** Always test 200 (success), 400 (bad input), and 500 (SDK failure) scenarios.
- **CommonJS:** Action test files use `require()` and `module.exports` (not ES imports).
- **Component test directory:** `test/web-src/components/<ComponentName>.test.js` (or `test/components/`).
- **Provider wrapper:** Always wrap in `<Provider theme={defaultTheme}>` — Spectrum renders nothing without it.
- **ARIA selectors:** Use `getByRole()`, not CSS classes — see `references/component-testing-patterns.md` selector table.
- **Async testing:** Use `findBy*` for data that appears async, `queryBy*` for absence, `waitFor` for state changes.

## Full Workflow (for ambiguous or complex requests)

1. **Scan project structure** — Check for existing `test/` directory, `jest.config.js`, and test scripts in `package.json`. Scan both `src/` for actions AND `web-src/` for UI components.
2. **Identify targets to test** — Parse `ext.config.yaml` (or `app.config.yaml`) for declared actions and their source paths. Check `web-src/src/components/` for React components.
3. **Determine test types needed** — Unit tests for logic, integration tests for deployed actions, contract tests for API interactions.
4. **For each action:**a. Read the action source to identify SDK dependencies (State, Files, Events, Logger, etc.).b. Generate unit test using `assets/unit-test-template.js` as the base.c. Inject appropriate mocks from `references/mock-catalog.md` based on detected dependencies.d. Add error scenario tests (missing params, auth failures, SDK errors).
5. **For each UI component:**a. Read the component source to identify dependencies (shell context, UIX guest, action calls).b. Generate component test using `assets/component-test-template.js` as the base.c. Wrap all renders in `<Provider theme={defaultTheme}>` — Spectrum renders nothing without it.d. Inject shell mock (`assets/shell-mock-helper.js`) or UIX guest mock (`assets/uix-guest-mock-helper.js`) as needed.e. Add loading, success, and error state tests for async data using `findBy*` and `waitFor`.
6. **Run tests** — Execute `aio app test` or `npx jest --coverage` and report results.
7. **Validate** — Check against `references/checklist.md` before marking done.

## Example User Prompts

- "Write unit tests for my generic action"
- "Add integration tests for my deployed action"
- "My action uses State SDK — help me mock it in tests"
- "Run tests and show me coverage"
- "Set up Jest for my App Builder project"
- "Test my action handles errors properly"
- "Write component tests for my data table page"
- "Test my AEM extension panel component"
- "Help me mock shell context in my tests"
- "Add tests for my React Spectrum form"

## Inputs To Request

- Current repository path and action file locations
- Which actions need tests (or test all declared actions)
- Target test types: unit, integration, contract, or all
- Whether action is deployed (needed for integration tests)

## Deliverables

- Test files in `test/` matching the action directory structure
- Component test files in `test/web-src/components/` for UI components
- Mock helpers for detected Adobe SDK dependencies
- Shell or UIX Guest mock helpers when components depend on context SDKs
- Jest configuration if not already present (including jsdom environment for component tests)
- Coverage report from test execution

## Quality Bar

- Every action test covers at minimum: success (200), bad input (400), and SDK failure (500) paths
- Mocks are isolated per test via `beforeEach(() => jest.clearAllMocks())`
- No real SDK calls in unit tests — all external dependencies are mocked
- Tests are deterministic and can run offline (no network dependencies in unit tests)
- Coverage reporting is enabled (`--coverage` flag)
- All component tests wrap in `<Provider theme={defaultTheme}>` — Spectrum renders nothing without it

## References

- Use `references/testing-patterns.md` for unit, integration, and contract test patterns with annotated examples.
- Use `references/component-testing-patterns.md` for React Spectrum component testing with Provider wrapping, ARIA selectors, and async patterns.
- Use `references/mock-catalog.md` for mock helpers covering all Adobe SDKs (State, Files, Events, Logger, Database, Shell, UIX Guest).
- Use `references/checklist.md` for pre-deployment test verification.
- Use `assets/unit-test-template.js` for Jest unit test boilerplate (CommonJS).
- Use `assets/integration-test-template.js` for integration test against deployed actions.
- Use `assets/component-test-template.js` for React Spectrum component test boilerplate with `renderWithSpectrum()` helper.
- Use `assets/shell-mock-helper.js` for ExC Shell context mock (`@adobe/exc-app`).
- Use `assets/uix-guest-mock-helper.js` for AEM UIX Guest mock (`@adobe/uix-guest`).
- Use `assets/mock-state-sdk.js`, `assets/mock-files-sdk.js`, `assets/mock-events-sdk.js`, and `assets/mock-database-sdk.js` for ready-to-use SDK mock setups.

## Common Issues

- **Tests fail with "Cannot find module":** Ensure the action path in `require()` matches the actual file location. App Builder actions are typically at `src/dx-excshell-1/actions/<name>/index.js`.
- **Mocks not working:** `jest.mock()` calls must appear before `require()` of the module under test. Jest hoists mock declarations but order still matters for manual mocks.
- **State/Files SDK tests fail:** These SDKs require Runtime environment for real calls. Always mock them in unit tests. Use `aio app run` (not `aio app dev`) for integration tests that need real SDK access.
- **Coverage too low:** Add tests for error branches — missing params, invalid auth headers, SDK `init()` failures, and timeout scenarios.
- `aio app test`** vs `npx jest`:** `aio app test` is a thin wrapper around Jest. Use `npx jest --coverage` directly for more control over flags and reporters.
- **Spectrum components render blank in tests:** Missing `<Provider theme={defaultTheme}>` wrapper. Use `renderWithSpectrum()` helper from `assets/component-test-template.js`.
- **ARIA role queries return null:** Spectrum components use ARIA roles, not CSS classes. See `references/component-testing-patterns.md` section g for the role reference table.

## Chaining

- Chains FROM `appbuilder-action-scaffolder` (test actions after implementation)
- Chains FROM `appbuilder-ui-scaffolder` (test UI components after scaffolding)
- Chains TO `appbuilder-cicd-pipeline` (automated test execution in CI)

© adobe · Apache-2.0 · adobe/skills

Похожие скиллы

Всё по теме «Тесты и QA» →
testing-patterns davila7 Скилл для Claude с готовыми паттернами тестирования на Jest: фабрики данных, моки и цикл red-green-refactor. 365установок react-native-testing callstack Скилл для написания и проверки тестов компонентов React Native с помощью Testing Library. Покрывает запросы, взаимодействия, асинхронные паттерны и работает с версиями v13 (React 18) и v14 (React 19+). CX Codex +1 5 300установок typescript-unit-testing bmad-labs Скилл для юнит-тестов TypeScript и NestJS: Jest, моки через @golevelup/ts-jest и структура AAA. Пригодится, когда пишете или чините .spec.ts. CX Codex +1 496установок jest-react-testing manutej Скилл для тестирования React-компонентов и хуков через Jest и React Testing Library: конфигурация, моки, асинхронные сценарии. CX Codex +1 1 200установок react-testing-library pproenca Скилл с 43 правилами для тестов на React Testing Library. Помогает агенту писать и ревьюить тесты, которые проверяют поведение, а не внутренности компонента. CX Codex +1 402установок javascript-testing-patterns Seth Hobson Скилл подсказывает, как писать unit-, интеграционные и end-to-end-тесты для JavaScript и TypeScript. Пригодится при настройке тестовой инфраструктуры и работе по TDD. CX Codex 20 472установок

Из того же набора46

aem-rde Скилл помогает агенту работать с плагином Adobe I/O CLI для AEM Rapid Development Environments: деплой, логи, снапшоты, диагностика. CX Codex +1 729установок appbuilder-ui-scaffolder Генерирует интерфейсы на React Spectrum для Adobe Experience Cloud Shell и расширений AEM. Помогает настроить формы, таблицы данных и модальные окна. CX Codex +1 716установок handover-developer Генерирует техническую документацию для разработчиков проекта на AEM Edge Delivery Services. Анализирует архитектуру кодовой базы и создаёт гайд для онбординга. CX Codex +1 714установок appbuilder-action-scaffolder Разворачивает, настраивает и отлаживает бессерверные действия Adobe Runtime в проектах App Builder. Пригодится для вебхуков, баз данных и фоновых задач. CX Codex +1 713установок handover-admin Создаёт руководство для передачи администрирования проекта AEM Edge Delivery Services. Пригодится при онбординге нового администратора и фиксации рабочих процедур. CX Codex +1 712установок handover-author Собирает документацию для контент-авторов, которые принимают проект на AEM Edge Delivery Services: блоки, шаблоны, конфигурации и публикация. CX Codex +1 711установок appbuilder-cicd-pipeline Собирает workflow-файлы GitHub Actions для сборки и деплоя проектов Adobe App Builder, плюс шаблоны для Azure DevOps и GitLab CI. CX Codex +1 710установок aem-replication Точка входа в набор скиллов по репликации AEM 6.5 LTS: настройка агентов, публикация контента, Replication API и разбор зависших очередей. CX Codex +1 564установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой