@devries-cameron20 / composio Mirror · read-only / commits / 5704e27ca
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 08:15 UTC

test(ts/e2e): add e2e tests for composio toolkits list, info, and search

Docker-based e2e tests validating piped-mode JSON output against the real API. Also adds nested workspace glob to pnpm-workspace.yaml.

jkomyno committed Feb 18, 2026 at 21:57 UTC 5704e27ca760ebdaa79390f91fc31975d8668812
12 files changed +524 -57
pnpm-lock.yaml
+30 -56
@@ -173,6 +173,24 @@ importers:
173 specifier: 'catalog:'
174 version: 5.9.3
175
176 + ts/e2e-tests/cli/toolkits/info:
177 + devDependencies:
178 + '@e2e-tests/utils':
179 + specifier: workspace:*
180 + version: link:../../../_utils
181 +
182 + ts/e2e-tests/cli/toolkits/list:
183 + devDependencies:
184 + '@e2e-tests/utils':
185 + specifier: workspace:*
186 + version: link:../../../_utils
187 +
188 + ts/e2e-tests/cli/toolkits/search:
189 + devDependencies:
190 + '@e2e-tests/utils':
191 + specifier: workspace:*
192 + version: link:../../../_utils
193 +
194 ts/e2e-tests/cli/version:
195 devDependencies:
196 '@e2e-tests/utils':
@@ -662,16 +680,16 @@ importers:
680 version: link:../../packages/providers/llamaindex
681 '@llamaindex/openai':
682 specifier: ^0.4.20
665 - version: 0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@3.25.76)
683 + version: 0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@4.3.6)
684 '@llamaindex/workflow':
685 specifier: ^1.1.24
668 - version: 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
686 + version: 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
687 dotenv:
688 specifier: ^16.4.1
689 version: 16.6.1
690 llamaindex:
691 specifier: ^0.12.0
674 - version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@3.25.76)
692 + version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
693 devDependencies:
694 '@types/bun':
695 specifier: ^1.2.9
@@ -1268,7 +1286,7 @@ importers:
1286 dependencies:
1287 llamaindex:
1288 specifier: ^0.12.0
1271 - version: 0.12.1(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
1289 + version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
1290 devDependencies:
1291 '@composio/core':
1292 specifier: workspace:*
@@ -7530,43 +7548,26 @@ snapshots:
7548 tree-sitter: 0.22.4
7549 web-tree-sitter: 0.24.7
7550
7533 - '@llamaindex/openai@0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@3.25.76)':
7551 + '@llamaindex/openai@0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.19.0)(zod@4.3.6)':
7552 dependencies:
7553 '@llamaindex/core': 0.6.22
7554 '@llamaindex/env': 0.1.30
7537 - openai: 5.23.2(ws@8.19.0)(zod@3.25.76)
7555 + openai: 5.23.2(ws@8.19.0)(zod@4.3.6)
7556 transitivePeerDependencies:
7557 - ws
7558 - zod
7559
7542 - '@llamaindex/workflow-core@1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)':
7560 + '@llamaindex/workflow-core@1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)':
7561 optionalDependencies:
7544 - '@modelcontextprotocol/sdk': 1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76)
7562 + '@modelcontextprotocol/sdk': 1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6)
7563 hono: 4.11.9
7546 - zod: 3.25.76
7547 -
7548 - '@llamaindex/workflow-core@1.3.3(zod@4.3.6)':
7549 - optionalDependencies:
7564 zod: 4.3.6
7565
7552 - '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)':
7553 - dependencies:
7554 - '@llamaindex/core': 0.6.22
7555 - '@llamaindex/env': 0.1.30
7556 - '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
7557 - transitivePeerDependencies:
7558 - - '@modelcontextprotocol/sdk'
7559 - - hono
7560 - - next
7561 - - p-retry
7562 - - rxjs
7563 - - zod
7564 -
7565 - '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(zod@4.3.6)':
7566 + '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)':
7567 dependencies:
7568 '@llamaindex/core': 0.6.22
7569 '@llamaindex/env': 0.1.30
7569 - '@llamaindex/workflow-core': 1.3.3(zod@4.3.6)
7570 + '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
7571 transitivePeerDependencies:
7572 - '@modelcontextprotocol/sdk'
7573 - hono
@@ -9947,34 +9948,12 @@ snapshots:
9948 rfdc: 1.4.1
9949 wrap-ansi: 9.0.2
9950
9950 - llamaindex@0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@3.25.76):
9951 - dependencies:
9952 - '@llamaindex/core': 0.6.22
9953 - '@llamaindex/env': 0.1.30
9954 - '@llamaindex/node-parser': 2.0.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)
9955 - '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
9956 - '@types/lodash': 4.17.23
9957 - '@types/node': 24.10.13
9958 - lodash: 4.17.23
9959 - magic-bytes.js: 1.13.0
9960 - transitivePeerDependencies:
9961 - - '@huggingface/transformers'
9962 - - '@modelcontextprotocol/sdk'
9963 - - gpt-tokenizer
9964 - - hono
9965 - - next
9966 - - p-retry
9967 - - rxjs
9968 - - tree-sitter
9969 - - web-tree-sitter
9970 - - zod
9971 -
9972 - llamaindex@0.12.1(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6):
9951 + llamaindex@0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6):
9952 dependencies:
9953 '@llamaindex/core': 0.6.22
9954 '@llamaindex/env': 0.1.30
9955 '@llamaindex/node-parser': 2.0.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)
9977 - '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(zod@4.3.6)
9956 + '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
9957 '@types/lodash': 4.17.23
9958 '@types/node': 24.10.13
9959 lodash: 4.17.23
@@ -10254,11 +10233,6 @@ snapshots:
10233 is-inside-container: 1.0.0
10234 wsl-utils: 0.1.0
10235
10257 - openai@5.23.2(ws@8.19.0)(zod@3.25.76):
10258 - optionalDependencies:
10259 - ws: 8.19.0
10260 - zod: 3.25.76
10261 -
10236 openai@5.23.2(ws@8.19.0)(zod@4.3.6):
10237 optionalDependencies:
10238 ws: 8.19.0
pnpm-workspace.yaml
+1
@@ -1,6 +1,7 @@
1 packages:
2 - ts/e2e-tests/_utils
3 - ts/e2e-tests/cli/*
4 + - ts/e2e-tests/cli/**/*
5 - ts/e2e-tests/runtimes/node/*
6 - ts/e2e-tests/runtimes/deno/*
7 - ts/e2e-tests/runtimes/cloudflare/*
ts/e2e-tests/README.md
+5 -1
@@ -42,7 +42,11 @@ ts/e2e-tests/
42 └── cf-workers-tool-router-ai/ # Cloudflare Workers AI SDK tool router tests
43 └── cli/ # CLI runtime tests (scratch)
44 ├── version/ # composio version command tests
45 - └── whoami/ # composio whoami command tests
45 + ├── whoami/ # composio whoami command tests
46 + └── toolkits/ # composio toolkits command tests
47 + ├── list/ # composio toolkits list tests
48 + ├── info/ # composio toolkits info tests
49 + └── search/ # composio toolkits search tests
50 ```
51
52 ## Running Tests
ts/e2e-tests/cli/toolkits/info/README.md new
+22
@@ -0,0 +1,22 @@
1 +# CLI `composio toolkits info` Test
2 +
3 +Verifies that `composio toolkits info <slug>` returns detailed toolkit JSON in piped mode, handles invalid slugs gracefully, and supports stdout redirection.
4 +
5 +## What It Tests
6 +
7 +| Test | Description |
8 +| --- | --- |
9 +| Valid slug | `info gmail` returns JSON object with name, slug, meta, auth_config_details |
10 +| Stdout redirection | `info gmail > out.json` captures the JSON in the file |
11 +| Invalid slug | `info nonexistent_toolkit_xyz12345` exits 0, empty stdout |
12 +| Missing slug | `info` (no arg) exits 0, empty stdout |
13 +
14 +## Requirements
15 +
16 +- `COMPOSIO_API_KEY` (**required**) — Composio API key passed to the container
17 +
18 +## Running
19 +
20 +```bash
21 +pnpm test:e2e:cli
22 +```
ts/e2e-tests/cli/toolkits/info/e2e.test.ts new
+146
@@ -0,0 +1,146 @@
1 +/**
2 + * CLI `composio toolkits info` e2e test
3 + *
4 + * Verifies that the info subcommand returns detailed toolkit JSON in piped mode,
5 + * handles invalid slugs gracefully, and supports stdout redirection.
6 + */
7 +
8 +import {
9 + e2e,
10 + sanitizeOutput,
11 + type E2ETestResult,
12 + type E2ETestResultWithFiles,
13 +} from '@e2e-tests/utils';
14 +import { TIMEOUTS } from '@e2e-tests/utils/const';
15 +import { describe, it, expect, beforeAll } from 'bun:test';
16 +
17 +declare module 'bun' {
18 + interface Env {
19 + COMPOSIO_API_KEY: string;
20 + }
21 +}
22 +
23 +e2e(import.meta.url, {
24 + versions: {
25 + cli: ['current'],
26 + },
27 + env: {
28 + COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
29 + },
30 + defineTests: ({ runCmd }) => {
31 + let validResult: E2ETestResult;
32 + let redirectResult: E2ETestResultWithFiles<'out.json'>;
33 + let invalidResult: E2ETestResult;
34 + let missingSlugResult: E2ETestResult;
35 +
36 + beforeAll(async () => {
37 + validResult = await runCmd('composio toolkits info gmail');
38 + redirectResult = await runCmd({
39 + command: 'composio toolkits info gmail > out.json',
40 + files: ['out.json'],
41 + });
42 + invalidResult = await runCmd('composio toolkits info nonexistent_toolkit_xyz12345');
43 + missingSlugResult = await runCmd('composio toolkits info');
44 + }, TIMEOUTS.FIXTURE);
45 +
46 + describe('composio toolkits info gmail (valid slug)', () => {
47 + it('exits successfully', () => {
48 + expect(validResult.exitCode).toBe(0);
49 + });
50 +
51 + it('stderr is empty', () => {
52 + expect(validResult.stderr).toBe('');
53 + });
54 +
55 + it('stdout is a valid JSON object', () => {
56 + const obj = JSON.parse(sanitizeOutput(validResult.stdout));
57 + expect(typeof obj).toBe('object');
58 + expect(Array.isArray(obj)).toBe(false);
59 + });
60 +
61 + it('has the correct name and slug', () => {
62 + const obj = JSON.parse(sanitizeOutput(validResult.stdout));
63 + expect(obj.name).toBe('Gmail');
64 + expect(obj.slug).toBe('gmail');
65 + });
66 +
67 + it('has meta with description, tools_count, and triggers_count', () => {
68 + const obj = JSON.parse(sanitizeOutput(validResult.stdout));
69 + expect(obj.meta).toHaveProperty('description');
70 + expect(typeof obj.meta.tools_count).toBe('number');
71 + expect(typeof obj.meta.triggers_count).toBe('number');
72 + });
73 +
74 + it('has auth_config_details array', () => {
75 + const obj = JSON.parse(sanitizeOutput(validResult.stdout));
76 + expect(Array.isArray(obj.auth_config_details)).toBe(true);
77 + expect(obj.auth_config_details.length).toBeGreaterThan(0);
78 + });
79 +
80 + it('each auth_config_detail has mode, name, and fields', () => {
81 + const obj = JSON.parse(sanitizeOutput(validResult.stdout));
82 + for (const detail of obj.auth_config_details) {
83 + expect(detail).toHaveProperty('mode');
84 + expect(detail).toHaveProperty('name');
85 + expect(detail).toHaveProperty('fields');
86 + expect(detail.fields).toHaveProperty('auth_config_creation');
87 + expect(detail.fields).toHaveProperty('connected_account_initiation');
88 + }
89 + });
90 +
91 + it('has composio_managed_auth_schemes, no_auth, and is_local_toolkit', () => {
92 + const obj = JSON.parse(sanitizeOutput(validResult.stdout));
93 + expect(Array.isArray(obj.composio_managed_auth_schemes)).toBe(true);
94 + expect(typeof obj.no_auth).toBe('boolean');
95 + expect(typeof obj.is_local_toolkit).toBe('boolean');
96 + });
97 + });
98 +
99 + describe('composio toolkits info gmail > out.json (stdout redirection)', () => {
100 + it('exits successfully', () => {
101 + expect(redirectResult.exitCode).toBe(0);
102 + });
103 +
104 + it('stdout is empty', () => {
105 + expect(redirectResult.stdout).toBe('');
106 + });
107 +
108 + it('stderr is empty', () => {
109 + expect(redirectResult.stderr).toBe('');
110 + });
111 +
112 + it('out.json contains valid JSON with slug "gmail"', () => {
113 + const obj = JSON.parse(sanitizeOutput(redirectResult.files['out.json']));
114 + expect(obj.slug).toBe('gmail');
115 + });
116 + });
117 +
118 + describe('composio toolkits info nonexistent_toolkit_xyz12345 (invalid slug)', () => {
119 + it('exits successfully (graceful error handling)', () => {
120 + expect(invalidResult.exitCode).toBe(0);
121 + });
122 +
123 + it('stdout is empty (no data on error)', () => {
124 + expect(sanitizeOutput(invalidResult.stdout)).toBe('');
125 + });
126 +
127 + it('stderr is empty (piped mode suppresses decoration)', () => {
128 + expect(invalidResult.stderr).toBe('');
129 + });
130 + });
131 +
132 + describe('composio toolkits info (missing slug)', () => {
133 + it('exits successfully (optional arg, handler guards)', () => {
134 + expect(missingSlugResult.exitCode).toBe(0);
135 + });
136 +
137 + it('stdout is empty', () => {
138 + expect(sanitizeOutput(missingSlugResult.stdout)).toBe('');
139 + });
140 +
141 + it('stderr is empty', () => {
142 + expect(missingSlugResult.stderr).toBe('');
143 + });
144 + });
145 + },
146 +});
ts/e2e-tests/cli/toolkits/info/package.json new
+14
@@ -0,0 +1,14 @@
1 +{
2 + "name": "@e2e-tests/cli-toolkits-info",
3 + "version": "0.0.0",
4 + "private": true,
5 + "type": "module",
6 + "scripts": {
7 + "typecheck": "tsc --noEmit",
8 + "test:e2e": "bun test e2e.test.ts",
9 + "test:e2e:cli": "bun test e2e.test.ts"
10 + },
11 + "devDependencies": {
12 + "@e2e-tests/utils": "workspace:*"
13 + }
14 +}
ts/e2e-tests/cli/toolkits/list/README.md new
+21
@@ -0,0 +1,21 @@
1 +# CLI `composio toolkits list` Test
2 +
3 +Verifies that `composio toolkits list` returns toolkits as JSON in piped mode with correct `--query` filtering behavior.
4 +
5 +## What It Tests
6 +
7 +| Test | Description |
8 +| --- | --- |
9 +| Exact slug match | `--query gmail --limit 1` returns 1 item with slug "gmail" |
10 +| Prefix search | `--query gmai --limit 1` returns 1 item (API supports prefix matching) |
11 +| No fuzzy search | `--query gmal --limit 1` returns empty (backend doesn't support fuzzy search) |
12 +
13 +## Requirements
14 +
15 +- `COMPOSIO_API_KEY` (**required**) — Composio API key passed to the container
16 +
17 +## Running
18 +
19 +```bash
20 +pnpm test:e2e:cli
21 +```
ts/e2e-tests/cli/toolkits/list/e2e.test.ts new
+101
@@ -0,0 +1,101 @@
1 +/**
2 + * CLI `composio toolkits list` e2e test
3 + *
4 + * Verifies that the list subcommand returns toolkits as JSON in piped mode,
5 + * supports --query filtering (exact, prefix, no fuzzy), and respects --limit.
6 + */
7 +
8 +import { e2e, sanitizeOutput, type E2ETestResult } from '@e2e-tests/utils';
9 +import { TIMEOUTS } from '@e2e-tests/utils/const';
10 +import { describe, it, expect, beforeAll } from 'bun:test';
11 +
12 +declare module 'bun' {
13 + interface Env {
14 + COMPOSIO_API_KEY: string;
15 + }
16 +}
17 +
18 +e2e(import.meta.url, {
19 + versions: {
20 + cli: ['current'],
21 + },
22 + env: {
23 + COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
24 + },
25 + defineTests: ({ runCmd }) => {
26 + let exactResult: E2ETestResult;
27 + let prefixResult: E2ETestResult;
28 + let noFuzzyResult: E2ETestResult;
29 +
30 + beforeAll(async () => {
31 + exactResult = await runCmd('composio toolkits list --query gmail --limit 1');
32 + prefixResult = await runCmd('composio toolkits list --query gmai --limit 1');
33 + noFuzzyResult = await runCmd('composio toolkits list --query gmal --limit 1');
34 + }, TIMEOUTS.FIXTURE);
35 +
36 + describe('composio toolkits list --query gmail --limit 1 (exact slug)', () => {
37 + it('exits successfully', () => {
38 + expect(exactResult.exitCode).toBe(0);
39 + });
40 +
41 + it('stderr is empty', () => {
42 + expect(exactResult.stderr).toBe('');
43 + });
44 +
45 + it('stdout is a JSON array with 1 element', () => {
46 + const items = JSON.parse(sanitizeOutput(exactResult.stdout));
47 + expect(Array.isArray(items)).toBe(true);
48 + expect(items).toHaveLength(1);
49 + });
50 +
51 + it('the element has slug "gmail"', () => {
52 + const items = JSON.parse(sanitizeOutput(exactResult.stdout));
53 + expect(items[0].slug).toBe('gmail');
54 + });
55 +
56 + it('the element has the expected shape', () => {
57 + const item = JSON.parse(sanitizeOutput(exactResult.stdout))[0];
58 + expect(item).toHaveProperty('name');
59 + expect(item).toHaveProperty('slug');
60 + expect(item).toHaveProperty('tools_count');
61 + expect(item).toHaveProperty('triggers_count');
62 + expect(item).toHaveProperty('description');
63 + });
64 + });
65 +
66 + describe('composio toolkits list --query gmai --limit 1 (prefix search)', () => {
67 + it('exits successfully', () => {
68 + expect(prefixResult.exitCode).toBe(0);
69 + });
70 +
71 + it('stderr is empty', () => {
72 + expect(prefixResult.stderr).toBe('');
73 + });
74 +
75 + it('stdout is a JSON array with 1 element', () => {
76 + const items = JSON.parse(sanitizeOutput(prefixResult.stdout));
77 + expect(Array.isArray(items)).toBe(true);
78 + expect(items).toHaveLength(1);
79 + });
80 +
81 + it('the element has slug "gmail"', () => {
82 + const items = JSON.parse(sanitizeOutput(prefixResult.stdout));
83 + expect(items[0].slug).toBe('gmail');
84 + });
85 + });
86 +
87 + describe('composio toolkits list --query gmal --limit 1 (no fuzzy search)', () => {
88 + it('exits successfully', () => {
89 + expect(noFuzzyResult.exitCode).toBe(0);
90 + });
91 +
92 + it('stderr is empty', () => {
93 + expect(noFuzzyResult.stderr).toBe('');
94 + });
95 +
96 + it('stdout is empty (no results)', () => {
97 + expect(sanitizeOutput(noFuzzyResult.stdout)).toBe('');
98 + });
99 + });
100 + },
101 +});
ts/e2e-tests/cli/toolkits/list/package.json new
+14
@@ -0,0 +1,14 @@
1 +{
2 + "name": "@e2e-tests/cli-toolkits-list",
3 + "version": "0.0.0",
4 + "private": true,
5 + "type": "module",
6 + "scripts": {
7 + "typecheck": "tsc --noEmit",
8 + "test:e2e": "bun test e2e.test.ts",
9 + "test:e2e:cli": "bun test e2e.test.ts"
10 + },
11 + "devDependencies": {
12 + "@e2e-tests/utils": "workspace:*"
13 + }
14 +}
ts/e2e-tests/cli/toolkits/search/README.md new
+22
@@ -0,0 +1,22 @@
1 +# CLI `composio toolkits search` Test
2 +
3 +Verifies that `composio toolkits search <query>` returns matching toolkits as JSON in piped mode, respects `--limit`, supports stdout redirection, and handles queries with no results.
4 +
5 +## What It Tests
6 +
7 +| Test | Description |
8 +| --- | --- |
9 +| Known query | `search gmail` returns JSON array with "gmail" as first result |
10 +| With limit | `search gmail --limit 1` returns exactly 1 element |
11 +| Stdout redirection | `search gmail --limit 1 > out.json` captures JSON in the file |
12 +| No results | `search xyznonexistent_abc_12345` returns empty stdout |
13 +
14 +## Requirements
15 +
16 +- `COMPOSIO_API_KEY` (**required**) — Composio API key passed to the container
17 +
18 +## Running
19 +
20 +```bash
21 +pnpm test:e2e:cli
22 +```
ts/e2e-tests/cli/toolkits/search/e2e.test.ts new
+134
@@ -0,0 +1,134 @@
1 +/**
2 + * CLI `composio toolkits search` e2e test
3 + *
4 + * Verifies that the search subcommand returns matching toolkits as JSON in piped mode,
5 + * respects --limit, supports stdout redirection, and handles no-result queries.
6 + */
7 +
8 +import {
9 + e2e,
10 + sanitizeOutput,
11 + type E2ETestResult,
12 + type E2ETestResultWithFiles,
13 +} from '@e2e-tests/utils';
14 +import { TIMEOUTS } from '@e2e-tests/utils/const';
15 +import { describe, it, expect, beforeAll } from 'bun:test';
16 +
17 +declare module 'bun' {
18 + interface Env {
19 + COMPOSIO_API_KEY: string;
20 + }
21 +}
22 +
23 +e2e(import.meta.url, {
24 + versions: {
25 + cli: ['current'],
26 + },
27 + env: {
28 + COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
29 + },
30 + defineTests: ({ runCmd }) => {
31 + let validResult: E2ETestResult;
32 + let limitResult: E2ETestResult;
33 + let redirectResult: E2ETestResultWithFiles<'out.json'>;
34 + let noResultsResult: E2ETestResult;
35 +
36 + beforeAll(async () => {
37 + validResult = await runCmd('composio toolkits search gmail');
38 + limitResult = await runCmd('composio toolkits search gmail --limit 1');
39 + redirectResult = await runCmd({
40 + command: 'composio toolkits search gmail --limit 1 > out.json',
41 + files: ['out.json'],
42 + });
43 + noResultsResult = await runCmd('composio toolkits search xyznonexistent_abc_12345');
44 + }, TIMEOUTS.FIXTURE);
45 +
46 + describe('composio toolkits search gmail (known query)', () => {
47 + it('exits successfully', () => {
48 + expect(validResult.exitCode).toBe(0);
49 + });
50 +
51 + it('stderr is empty', () => {
52 + expect(validResult.stderr).toBe('');
53 + });
54 +
55 + it('stdout is a JSON array with at least 1 element', () => {
56 + const items = JSON.parse(sanitizeOutput(validResult.stdout));
57 + expect(Array.isArray(items)).toBe(true);
58 + expect(items.length).toBeGreaterThanOrEqual(1);
59 + });
60 +
61 + it('first element has slug "gmail"', () => {
62 + const items = JSON.parse(sanitizeOutput(validResult.stdout));
63 + expect(items[0].slug).toBe('gmail');
64 + });
65 +
66 + it('each element has the expected shape', () => {
67 + const items = JSON.parse(sanitizeOutput(validResult.stdout));
68 + for (const item of items) {
69 + expect(item).toHaveProperty('name');
70 + expect(item).toHaveProperty('slug');
71 + expect(item).toHaveProperty('tools_count');
72 + expect(item).toHaveProperty('triggers_count');
73 + expect(item).toHaveProperty('description');
74 + }
75 + });
76 + });
77 +
78 + describe('composio toolkits search gmail --limit 1 (with limit)', () => {
79 + it('exits successfully', () => {
80 + expect(limitResult.exitCode).toBe(0);
81 + });
82 +
83 + it('stderr is empty', () => {
84 + expect(limitResult.stderr).toBe('');
85 + });
86 +
87 + it('stdout is a JSON array with exactly 1 element', () => {
88 + const items = JSON.parse(sanitizeOutput(limitResult.stdout));
89 + expect(Array.isArray(items)).toBe(true);
90 + expect(items).toHaveLength(1);
91 + });
92 +
93 + it('the element has slug "gmail"', () => {
94 + const items = JSON.parse(sanitizeOutput(limitResult.stdout));
95 + expect(items[0].slug).toBe('gmail');
96 + });
97 + });
98 +
99 + describe('composio toolkits search gmail --limit 1 > out.json (stdout redirection)', () => {
100 + it('exits successfully', () => {
101 + expect(redirectResult.exitCode).toBe(0);
102 + });
103 +
104 + it('stdout is empty', () => {
105 + expect(redirectResult.stdout).toBe('');
106 + });
107 +
108 + it('stderr is empty', () => {
109 + expect(redirectResult.stderr).toBe('');
110 + });
111 +
112 + it('out.json contains a JSON array with slug "gmail"', () => {
113 + const items = JSON.parse(sanitizeOutput(redirectResult.files['out.json']));
114 + expect(Array.isArray(items)).toBe(true);
115 + expect(items).toHaveLength(1);
116 + expect(items[0].slug).toBe('gmail');
117 + });
118 + });
119 +
120 + describe('composio toolkits search xyznonexistent_abc_12345 (no results)', () => {
121 + it('exits successfully', () => {
122 + expect(noResultsResult.exitCode).toBe(0);
123 + });
124 +
125 + it('stderr is empty', () => {
126 + expect(noResultsResult.stderr).toBe('');
127 + });
128 +
129 + it('stdout is empty (no results)', () => {
130 + expect(sanitizeOutput(noResultsResult.stdout)).toBe('');
131 + });
132 + });
133 + },
134 +});
ts/e2e-tests/cli/toolkits/search/package.json new
+14
@@ -0,0 +1,14 @@
1 +{
2 + "name": "@e2e-tests/cli-toolkits-search",
3 + "version": "0.0.0",
4 + "private": true,
5 + "type": "module",
6 + "scripts": {
7 + "typecheck": "tsc --noEmit",
8 + "test:e2e": "bun test e2e.test.ts",
9 + "test:e2e:cli": "bun test e2e.test.ts"
10 + },
11 + "devDependencies": {
12 + "@e2e-tests/utils": "workspace:*"
13 + }
14 +}