Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | # CLI E2E Tests |
| 2 | |
| 3 | End-to-end tests for the compiled `composio` CLI binary. |
| 4 | |
| 5 | ## How It Works |
| 6 | |
| 7 | Each test suite runs the `composio` binary inside a scratch Debian Docker container built from `Dockerfile.cli`. The binary is compiled via `bun build --compile` during the Docker image build, producing a self-contained executable with no runtime dependencies. |
| 8 | |
| 9 | Tests use `runCmd` to execute shell commands in the container and assert on exit code, stdout, and stderr. When stdout is piped (e.g., `composio version > out.txt`), the CLI suppresses all decoration and writes only machine-readable data — these tests verify that contract. |
| 10 | |
| 11 | ## Test Suites |
| 12 | |
| 13 | | Suite | Description | Env Vars | |
| 14 | | ----------------------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------- | |
| 15 | | [upgrade](./upgrade/) | `composio upgrade` replaces a running Linux executable | None | |
| 16 | | [operations](./operations/) | Login, session, search, execute, link, run, upgrade and their `dev` counterparts under a fault catalogue | None | |
| 17 | | [agent-journeys](./agent-journeys/) | Tasks driven by a model replayed through aimock, with the `composio-cli` skill as its guidance | None | |
| 18 | | [fake-backend](./fake-backend/) | Test support: the fake Composio deployment the two suites above talk to, and its contract check | None | |
| 19 | | [version](./version/) | `composio version` output and exit code | None | |
| 20 | | [whoami](./whoami/) | `composio whoami` prints the API key | `COMPOSIO_USER_API_KEY` | |
| 21 | |
| 22 | ## Journeys |
| 23 | |
| 24 | `runCmd` starts a fresh container for every command. A test that needs several commands to share state (log in, link, then execute) holds one container instead: |
| 25 | |
| 26 | ```typescript |
| 27 | import { startJourneyContainer } from '@e2e-tests/utils'; |
| 28 | |
| 29 | const journey = await startJourneyContainer({ env: { COMPOSIO_BASE_URL: fake.docker.http } }); |
| 30 | await journey.exec('composio login --user-api-key …'); |
| 31 | const result = await journey.exec('composio whoami'); |
| 32 | await journey.stop(); |
| 33 | ``` |
| 34 | |
| 35 | A journey container mounts nothing from the host and passes through no API key. The `operations` and `agent-journeys` suites use it through `startCliRig` from `@e2e-tests/cli-fake-backend/rig`, which also starts the fake backend and points every host the CLI knows at it. Other outbound traffic is not blocked. |
| 36 | |
| 37 | Those two suites and `fake-backend` need no secret. CI runs them in their own step with the API keys blanked, on every pull request, fork and Dependabot ones included; the suites that talk to staging run in a second step that is skipped when the keys are missing. |
| 38 | |
| 39 | ## Isolation Tool |
| 40 | |
| 41 | **Docker** with the CLI version resolved from the current monorepo build (`cli: ['current']`). |
| 42 | |
| 43 | ## Running |
| 44 | |
| 45 | ```bash |
| 46 | # All CLI e2e tests |
| 47 | pnpm test:e2e:cli |
| 48 | |
| 49 | # A specific suite |
| 50 | cd ts/e2e-tests/cli/version && pnpm test:e2e:cli |
| 51 | cd ts/e2e-tests/cli/whoami && pnpm test:e2e:cli |
| 52 | cd ts/e2e-tests/cli/upgrade && pnpm test:e2e:cli |
| 53 | ``` |