@smooai/testing 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,150 @@
1
+ # @smooai/testing
2
+
3
+ Smoo AI Testing SDK — CLI and library for interacting with the Smoo AI Testing API.
4
+
5
+ Report test results, manage test runs, cases, environments, and deployments.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @smooai/testing
11
+ # or
12
+ pnpm add @smooai/testing
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ### CLI: Report test results
18
+
19
+ ```bash
20
+ # Authenticate
21
+ npx @smooai/testing login \
22
+ --client-id <M2M_CLIENT_ID> \
23
+ --client-secret <M2M_CLIENT_SECRET> \
24
+ --org-id <ORG_ID>
25
+
26
+ # Report CTRF test results
27
+ npx @smooai/testing runs report ctrf-report.json \
28
+ --environment production \
29
+ --name "PR #42 Tests"
30
+ ```
31
+
32
+ ### Library: Programmatic usage
33
+
34
+ ```typescript
35
+ import { SmooTestingClient } from '@smooai/testing';
36
+
37
+ const client = new SmooTestingClient({
38
+ clientId: process.env.SMOOAI_CLIENT_ID,
39
+ clientSecret: process.env.SMOOAI_CLIENT_SECRET,
40
+ orgId: process.env.SMOOAI_ORG_ID,
41
+ });
42
+
43
+ // High-level: report CTRF file
44
+ const run = await client.report('ctrf-report.json', {
45
+ name: 'My Test Run',
46
+ environment: 'production',
47
+ });
48
+
49
+ // Or use individual methods
50
+ const runs = await client.listRuns({ status: 'failed' });
51
+ const envs = await client.listEnvironments();
52
+ ```
53
+
54
+ ## CLI Commands
55
+
56
+ ### Authentication
57
+
58
+ ```bash
59
+ smooai-testing login --client-id <id> --client-secret <secret> --org-id <id>
60
+ smooai-testing logout
61
+ smooai-testing status
62
+ ```
63
+
64
+ ### Test Runs
65
+
66
+ ```bash
67
+ smooai-testing runs create --name "Run Name" [--environment prod] [--tool vitest]
68
+ smooai-testing runs list [--status passed] [--limit 10]
69
+ smooai-testing runs get <run-id>
70
+ smooai-testing runs update <run-id> --status completed
71
+ smooai-testing runs report <ctrf-file> [--name "Run"] [--environment prod]
72
+ ```
73
+
74
+ ### Test Cases
75
+
76
+ ```bash
77
+ smooai-testing cases create --title "Test login flow" [--priority high] [--tags "auth,e2e"]
78
+ smooai-testing cases list [--tags auth] [--priority high]
79
+ smooai-testing cases get <case-id>
80
+ smooai-testing cases update <case-id> --title "Updated title"
81
+ smooai-testing cases delete <case-id>
82
+ ```
83
+
84
+ ### Environments
85
+
86
+ ```bash
87
+ smooai-testing envs create --name "production" [--base-url https://app.example.com]
88
+ smooai-testing envs list
89
+ smooai-testing envs get <env-id>
90
+ smooai-testing envs update <env-id> --name "staging"
91
+ ```
92
+
93
+ ### Deployments
94
+
95
+ ```bash
96
+ smooai-testing deployments create --name "v1.2.3" [--source github] [--ref main]
97
+ smooai-testing deployments list [--status success]
98
+ smooai-testing deployments get <deployment-id>
99
+ smooai-testing deployments update <deployment-id> --status success
100
+ smooai-testing deployments delete <deployment-id>
101
+ ```
102
+
103
+ ## JSON Output
104
+
105
+ All commands support `--json` for machine-readable output:
106
+
107
+ ```bash
108
+ smooai-testing runs list --json | jq '.data[].id'
109
+ ```
110
+
111
+ JSON mode is auto-enabled when output is piped (no TTY).
112
+
113
+ ## CI/CD Usage
114
+
115
+ Set environment variables instead of using `login`:
116
+
117
+ ```bash
118
+ export SMOOAI_CLIENT_ID=...
119
+ export SMOOAI_CLIENT_SECRET=...
120
+ export SMOOAI_ORG_ID=...
121
+ export SMOOAI_API_URL=https://api.production.smoo.ai
122
+ export SMOOAI_AUTH_URL=https://auth.production.smoo.ai/token
123
+ ```
124
+
125
+ GitHub Actions example:
126
+
127
+ ```yaml
128
+ - name: Report test results
129
+ run: npx @smooai/testing runs report ctrf-report.json --environment ci --name "${{ github.workflow }}"
130
+ env:
131
+ SMOOAI_CLIENT_ID: ${{ secrets.SMOOAI_CLIENT_ID }}
132
+ SMOOAI_CLIENT_SECRET: ${{ secrets.SMOOAI_CLIENT_SECRET }}
133
+ SMOOAI_ORG_ID: ${{ secrets.SMOOAI_ORG_ID }}
134
+ ```
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ pnpm install
140
+ pnpm build # Build lib + CLI
141
+ pnpm test # Run unit tests
142
+ pnpm typecheck # TypeScript checks
143
+ pnpm lint # Lint
144
+ pnpm format # Format code
145
+ pnpm check-all # All checks (CI parity)
146
+ ```
147
+
148
+ ## License
149
+
150
+ MIT