appbuilder-e2e-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseApp Builder E2E Testing
Adobe App Builder E2E 测试
Playwright-based browser E2E testing for Adobe App Builder SPAs and AEM extensions. This skill generates Playwright configs, test files, and CI workflows for browser-level validation.
基于Playwright的浏览器端到端测试,适用于Adobe App Builder SPA和AEM扩展。此技能可生成Playwright配置文件、测试文件以及用于浏览器级验证的CI工作流。
Pattern Quick-Reference
模式快速参考
Identify the user's intent, then read the referenced sections to generate tailored tests.
| User wants | Reference | Asset |
|---|---|---|
| E2E test for ExC Shell SPA | | |
| Test AEM extension in browser | | |
| E2E tests in CI pipeline | | |
识别用户意图,然后阅读参考章节以生成定制化测试。
| 用户需求 | 参考文档 | 资源 |
|---|---|---|
| ExC Shell SPA的E2E测试 | | |
| 浏览器中测试AEM扩展 | | |
| CI流水线中的E2E测试 | | |
Fast Path (for clear requests)
快速路径(适用于明确请求)
When the user says "add E2E tests" or "write Playwright tests" and intent is clear:
- Scan project for (SPA) or
web-src/in dependencies (AEM extension)@adobe/uix-guest - Install Playwright if not present:
npm install -D @playwright/test && npx playwright install chromium - Generate from
playwright.config.tsassets/playwright.config.ts - For ExC Shell SPA: read , generate test with iframe navigation, shell wait, Spectrum ARIA selectors
references/e2e-testing-patterns.md - For AEM extension: read , generate test with Extension Tester URL, nested iframe handling, modal flows
references/aem-extension-testing.md - Run tests:
npx playwright test - If CI requested: generate GitHub Actions workflow from
assets/e2e-ci-workflow.yml
当用户说“添加E2E测试”或“编写Playwright测试”且意图明确时:
- 扫描项目,查找(SPA)或依赖项中的
web-src/(AEM扩展)@adobe/uix-guest - 若未安装Playwright则进行安装:
npm install -D @playwright/test && npx playwright install chromium - 从生成
assets/playwright.config.tsplaywright.config.ts - 对于ExC Shell SPA:阅读,生成包含iframe导航、shell等待、Spectrum ARIA选择器的测试
references/e2e-testing-patterns.md - 对于AEM扩展:阅读,生成包含Extension Tester URL、嵌套iframe处理、模态框流程的测试
references/aem-extension-testing.md - 运行测试:
npx playwright test - 若需要CI:从生成GitHub Actions工作流
assets/e2e-ci-workflow.yml
Quick Reference
快速参考
- Test directory: at project root (separate from Jest
e2e/)test/ - Config file: at project root
playwright.config.ts - Install command: (installs Playwright + Chromium browser)
npm install -D @playwright/test && npx playwright install chromium - Run command: (headless) or
npx playwright test(visible browser)npx playwright test --headed - Debug command: (step-through mode)
npx playwright test --debug - Report command: (open HTML report)
npx playwright show-report - ExC Shell iframe: Access SPA inside shell via — exact selector varies, see
page.frameLocator('iframe')references/e2e-testing-patterns.md - Spectrum selectors: Use ARIA roles, not CSS classes: ,
getByRole('button', { name: 'Save' }),getByRole('grid')getByRole('textbox') - Auth note: Full ExC Shell auth automation is complex — recommend testing against (local) first. See
aio app dev§ Authentication.references/e2e-testing-patterns.md - AEM extensions: Use Extension Tester URL with . See
devMode=true.references/aem-extension-testing.md
- 测试目录: 项目根目录下的(与Jest的
e2e/分开)test/ - 配置文件: 项目根目录下的
playwright.config.ts - 安装命令: (安装Playwright + Chromium浏览器)
npm install -D @playwright/test && npx playwright install chromium - 运行命令: (无头模式)或
npx playwright test(可见浏览器模式)npx playwright test --headed - 调试命令: (分步调试模式)
npx playwright test --debug - 报告命令: (打开HTML报告)
npx playwright show-report - ExC Shell iframe: 通过访问shell内的SPA —— 具体选择器有所不同,请查看
page.frameLocator('iframe')references/e2e-testing-patterns.md - Spectrum选择器: 使用ARIA角色而非CSS类:,
getByRole('button', { name: 'Save' }),getByRole('grid')getByRole('textbox') - 认证说明: 完整的ExC Shell认证自动化较为复杂 —— 建议先针对(本地环境)进行测试。请查看
aio app dev中的“认证”章节。references/e2e-testing-patterns.md - AEM扩展: 使用带有的Extension Tester URL。请查看
devMode=true。references/aem-extension-testing.md
Full Workflow (for ambiguous or complex requests)
完整工作流(适用于模糊或复杂请求)
- Scan project — Check for (SPA),
web-src/(AEM extension), existing test setup,@adobe/uix-guestextension typeapp.config.yaml - Confirm scope — Which pages/flows to test? Local dev or deployed? CI needed?
- Install Playwright — if not already installed
npm install -D @playwright/test && npx playwright install chromium - Generate config — Copy and customize for the project
assets/playwright.config.ts - Generate test files — Read appropriate reference doc, generate tests matching project structure:
- ExC Shell SPA →
references/e2e-testing-patterns.md - AEM extension →
references/aem-extension-testing.md
- ExC Shell SPA →
- Add action stubbing — If tests need deterministic backend responses, add intercepts
page.route() - Run and iterate — , fix selectors/timing as needed
npx playwright test - Add CI workflow — If requested, read and generate workflow from
references/ci-integration.mdassets/e2e-ci-workflow.yml - Validate — All tests pass, use ARIA selectors, have assertions, no hardcoded waits
- 扫描项目 —— 检查是否存在(SPA)、
web-src/(AEM扩展)、现有测试设置、@adobe/uix-guest扩展类型app.config.yaml - 确认范围 —— 需要测试哪些页面/流程?是本地开发环境还是已部署环境?是否需要CI?
- 安装Playwright —— 若尚未安装,执行
npm install -D @playwright/test && npx playwright install chromium - 生成配置 —— 复制并根据项目定制
assets/playwright.config.ts - 生成测试文件 —— 阅读相应的参考文档,生成匹配项目结构的测试:
- ExC Shell SPA →
references/e2e-testing-patterns.md - AEM扩展 →
references/aem-extension-testing.md
- ExC Shell SPA →
- 添加action存根 —— 如果测试需要确定的后端响应,添加拦截
page.route() - 运行并迭代 —— ,根据需要修复选择器/计时问题
npx playwright test - 添加CI工作流 —— 若有需求,阅读并从
references/ci-integration.md生成工作流assets/e2e-ci-workflow.yml - 验证 —— 所有测试通过,使用ARIA选择器,包含断言,无硬编码等待
Inputs To Request
需要请求的输入信息
- Current repository path and project type (SPA vs AEM extension)
- Which pages or user flows need E2E coverage
- Whether tests should run against local dev or deployed environment
- Whether CI integration is needed
- 当前仓库路径和项目类型(SPA vs AEM扩展)
- 需要E2E覆盖的页面或用户流程
- 测试应针对本地开发环境还是已部署环境
- 是否需要CI集成
Deliverables
交付成果
- configured for the project
playwright.config.ts - E2E test files in directory
e2e/ - GitHub Actions workflow (if CI requested)
- Passing test run output
- 针对项目配置的
playwright.config.ts - 目录下的E2E测试文件
e2e/ - GitHub Actions工作流(若需要CI)
- 测试运行通过的输出结果
Quality Bar
质量标准
- All tests use ARIA selectors (,
getByRole) — no CSS class selectorsgetByLabel - Iframe navigation uses — no
frameLocator()with indexframe() - All tests have assertions — no assertion-free tests
await expect() - Action responses are stubbed with for deterministic results
page.route() - No hardcoded — use
page.waitForTimeout(),waitForSelector, or Playwright auto-waitingwaitForResponse - Tests run in < 60s on local machine
- 所有测试使用ARIA选择器(,
getByRole)—— 不使用CSS类选择器getByLabel - Iframe导航使用—— 不使用带索引的
frameLocator()frame() - 所有测试包含断言 —— 无无断言测试
await expect() - 使用存根action响应以获得确定结果
page.route() - 无硬编码的—— 使用
page.waitForTimeout(),waitForSelector或Playwright自动等待waitForResponse - 本地机器上测试运行时间<60秒
References
参考资料
- Use for Playwright E2E patterns for ExC Shell SPAs (iframe nav, Spectrum selectors, auth, action stubbing).
references/e2e-testing-patterns.md - Use for AEM extension testing patterns (Extension Tester, nested iframes, modal lifecycle, extension points).
references/aem-extension-testing.md - Use for running Playwright in GitHub Actions (browser install, artifact upload, headless config).
references/ci-integration.md - Use as the base Playwright configuration template.
assets/playwright.config.ts - Use as the GitHub Actions workflow template for E2E tests.
assets/e2e-ci-workflow.yml
- 针对ExC Shell SPA的Playwright E2E模式(iframe导航、Spectrum选择器、认证、action存根),请使用。
references/e2e-testing-patterns.md - 针对AEM扩展的测试模式(Extension Tester、嵌套iframe、模态框生命周期、扩展点),请使用。
references/aem-extension-testing.md - 关于在GitHub Actions中运行Playwright(浏览器安装、工件上传、无头配置),请使用。
references/ci-integration.md - 请使用作为Playwright配置模板的基础。
assets/playwright.config.ts - 请使用作为E2E测试的GitHub Actions工作流模板。
assets/e2e-ci-workflow.yml
Common Issues
常见问题
- Iframe not found: The ExC Shell iframe selector varies — use DevTools to inspect. Try or discover with
page.frameLocator('iframe[src*="your-app"]').page.frames() - Shell spinner never dismissed: Ensure is called in the SPA. For E2E, wait for content inside the iframe rather than the shell itself.
runtime.done() - Spectrum component not clickable: React Spectrum components render ARIA roles — use instead of CSS selectors. Check
getByRole()§ Spectrum Selectors.references/e2e-testing-patterns.md - Auth popup blocks test: Test against local dev () which skips shell auth. See auth section in
aio app dev.references/e2e-testing-patterns.md - AEM extension not loading: Extension Tester requires IMS login. Use generous timeouts (10s+) for extension load. Check § Common Gotchas.
references/aem-extension-testing.md - Tests flaky in CI: Add retries (), use
retries: 1for action calls, and checkwaitForResponse()for headless configuration.references/ci-integration.md
- 找不到iframe: ExC Shell的iframe选择器有所不同 —— 使用DevTools进行检查。尝试或通过
page.frameLocator('iframe[src*="your-app"]')查找。page.frames() - Shell加载动画永不消失: 确保SPA中调用了。对于E2E测试,请等待iframe内的内容而非shell本身。
runtime.done() - Spectrum组件无法点击: React Spectrum组件会渲染ARIA角色 —— 使用而非CSS选择器。请查看
getByRole()中的“Spectrum选择器”章节。references/e2e-testing-patterns.md - 认证弹窗阻止测试: 针对本地开发环境()进行测试,该环境会跳过shell认证。请查看
aio app dev中的认证章节。references/e2e-testing-patterns.md - AEM扩展无法加载: Extension Tester需要IMS登录。为扩展加载设置充足的超时时间(10秒以上)。请查看中的“常见问题”章节。
references/aem-extension-testing.md - CI中测试不稳定: 添加重试(),对action调用使用
retries: 1,并查看waitForResponse()中的无头配置。references/ci-integration.md
Chaining
技能联动
- Chains FROM (after UI components are generated, add E2E tests)
appbuilder-ui-scaffolder - Chains FROM (when user wants browser-level validation beyond Jest unit tests)
appbuilder-testing - Chains TO (add E2E test job to CI/CD pipeline)
appbuilder-cicd-pipeline
- 从联动(生成UI组件后,添加E2E测试)
appbuilder-ui-scaffolder - 从联动(当用户需要超越Jest单元测试的浏览器级验证时)
appbuilder-testing - 联动至(将E2E测试任务添加到CI/CD流水线)
appbuilder-cicd-pipeline