Complete guide for running, monitoring, and debugging e2e tests.
E2E tests run against pushed code in AWS CodeBuild, not local changes. Always commit and push before triggering.
- User explicitly requests e2e tests
- User approves e2e testing as part of a task
- Implied when user says "fix and test ..." or "add feature ... and test"
# 1. Commit and push all changes first
git push
# 2. Trigger e2e suite
yarn cloud-e2e
# 3. Monitor (auto-retries failed builds, polls every 5 min)
yarn e2e-monitor {batchId}Batch ID format: amplify-category-api-e2e-workflow:{UUID} — always use the full ID.
yarn e2e-status {batchId} # Check status once
yarn e2e-retry {batchId} # Retry failed builds
yarn e2e-list [limit] # List recent batches
yarn e2e-failed {batchId} # Show failed builds
yarn e2e-logs {buildId} # View build logsyarn cloud-e2e fires a single CodeBuild batch from codebuild_specs/e2e_workflow.yml (~183
shards). Because the batch orchestrator faults materially above ~100 simultaneously in-flight
builds, there is an alternative split mode that fires TWO independent, self-contained batches
against the same amplify-category-api-e2e-workflow project:
- api+gql batch —
codebuild_specs/e2e_workflow_api_gql.yml(amplify-e2e-tests + graphql-transformers-e2e-tests, ~78 shards) - cdk batch —
codebuild_specs/e2e_workflow_cdk.yml(amplify-graphql-api-construct-tests, ~105 shards)
Each batch carries the full prep/build chain (build_linux, build_windows, test, all
verify_*, publish_to_local_registry) and its own cleanup_e2e_resources, and is waved
independently at SPLIT_E2E_WAVE_SIZE (95 — the peak in-flight shards per batch, just under the
~100 orchestrator fault ceiling).
# Trigger BOTH batches (prints two Batch IDs)
yarn cloud-e2e-split
# Poll both to terminal state and aggregate pass/fail
yarn wait-for-all-codebuild-split <apiGqlBatchId> <cdkBatchId>All three specs are regenerated together by yarn split-e2e-tests, which runs a reconciliation
self-check asserting the two split batches exactly cover the combined shard set (no missing, extra,
or overlapping shards). The combined e2e_workflow.yml remains the project's default buildspec and
is still produced for the single-batch yarn cloud-e2e path.
The monitor auto-retries failed builds up to 10 times by default. It skips retrying build_linux, build_windows, test, and lint because failures in those are typically code-related and require fixes, not retries.
If errors persist after multiple retries or multiply as fixes are applied, ask the user for guidance.
cd packages/amplify-e2e-tests
yarn e2e src/__tests__/api_1.test.tsLocal e2e tests create real AWS resources. You need valid credentials.
The repo scripts use ada (Amazon's credential management tool), called automatically. Setup:
- Ensure
adaandmwinitare installed - Create
scripts/.env:E2E_ACCOUNT_PROD=<account-id> E2E_ACCOUNT_BETA=<account-id>
- If you see auth errors, run
mwinit
For personal AWS profiles, export credentials before running:
export AWS_PROFILE=your-profile-nameyarn e2e-failed <batch-id>yarn e2e-logs <build-id>Run the equivalent local command to reproduce. See Development Commands for build step equivalents.
git stash
git checkout main
yarn <failing-command>
git checkout <your-branch>
git stash popA passing e2e run means 100% of tests pass with zero failures. There is no "close enough" — if any test fails, the run has failed and the failures must be investigated and fixed. Do not dismiss failures as pre-existing or infrastructure-related without verifying on main and fixing them.
| Pattern | Symptoms | Action |
|---|---|---|
| Transient infrastructure | Timeouts, credential expiration, quota errors | Retry the build |
| Code-related | Test failures, build errors, coverage threshold | Fix the code, don't retry |
| Dependency-related | Module not found, version conflicts, breaking APIs | Check for major version changes, consider pinning |
build_linux/build_windows— Platform builds (not auto-retried)test— Unit tests (not auto-retried)lint— Linting (not auto-retried)verify_dependency_licenses_extract— License verificationverify_api_extract— API surface verificationverify_yarn_lock— yarn.lock consistencypublish_to_local_registry— Verdaccio publishgraphql_e2e_tests_*— GraphQL e2e test suites (171 jobs)
E2e tests create real AWS resources. Run periodically:
yarn cleanup-stale-resources- "Command failed with exit code 1" — Generic error. Read the full output for the actual message.
- "Cannot read properties of undefined" — Usually a dependency version mismatch or breaking API change.
- "Coverage threshold not met" — Check if pre-existing by testing on the base branch.
- "License change detected" — Expected after dependency updates. Run
yarn extract-dependency-licensesand commit.