Skip to content

SmooAI/testing

Repository files navigation

@smooai/testing — Report test results to Smoo AI

npm Smoo AI license

downloads TypeScript

Features  ·  Install  ·  Usage  ·  CLI  ·  Platform


Report test results to Smoo AI and manage your test program from the command line or in code. Pipe CTRF reports straight from CI, or drive runs, cases, environments, and deployments programmatically.

✨ Features

  • Report CTRF test results from any test runner, straight from CI
  • Manage test runs, cases, environments, and deployments
  • Use it as a CLI or as a typed TypeScript library
  • --json output on every command (auto-enabled when piped)
  • M2M auth via login or environment variables for CI/CD

📦 Install

npm install @smooai/testing
# or
pnpm add @smooai/testing

🚀 Usage

CLI: report test results

# Authenticate
npx @smooai/testing login \
  --client-id <M2M_CLIENT_ID> \
  --client-secret <M2M_CLIENT_SECRET> \
  --org-id <ORG_ID>

# Report CTRF test results
npx @smooai/testing runs report ctrf-report.json \
  --environment production \
  --name "PR #42 Tests"

Library: programmatic usage

import { SmooTestingClient } from '@smooai/testing';

const client = new SmooTestingClient({
    clientId: process.env.SMOOAI_CLIENT_ID,
    clientSecret: process.env.SMOOAI_CLIENT_SECRET,
    orgId: process.env.SMOOAI_ORG_ID,
});

// High-level: report CTRF file
const run = await client.report('ctrf-report.json', {
    name: 'My Test Run',
    environment: 'production',
});

// Or use individual methods
const runs = await client.listRuns({ status: 'failed' });
const envs = await client.listEnvironments();

📖 CLI commands

Authentication

smooai-testing login --client-id <id> --client-secret <secret> --org-id <id>
smooai-testing logout
smooai-testing status

Test runs

smooai-testing runs create --name "Run Name" [--environment prod] [--tool vitest]
smooai-testing runs list [--status passed] [--limit 10]
smooai-testing runs get <run-id>
smooai-testing runs update <run-id> --status completed
smooai-testing runs report <ctrf-file> [--name "Run"] [--environment prod]

Test cases

smooai-testing cases create --title "Test login flow" [--priority high] [--tags "auth,e2e"]
smooai-testing cases list [--tags auth] [--priority high]
smooai-testing cases get <case-id>
smooai-testing cases update <case-id> --title "Updated title"
smooai-testing cases delete <case-id>

Environments

smooai-testing envs create --name "production" [--base-url https://app.example.com]
smooai-testing envs list
smooai-testing envs get <env-id>
smooai-testing envs update <env-id> --name "staging"

Deployments

smooai-testing deployments create --name "v1.2.3" [--source github] [--ref main]
smooai-testing deployments list [--status success]
smooai-testing deployments get <deployment-id>
smooai-testing deployments update <deployment-id> --status success
smooai-testing deployments delete <deployment-id>

JSON output

All commands support --json for machine-readable output:

smooai-testing runs list --json | jq '.data[].id'

JSON mode is auto-enabled when output is piped (no TTY).

🤖 CI/CD usage

Set environment variables instead of using login:

export SMOOAI_CLIENT_ID=...
export SMOOAI_CLIENT_SECRET=...
export SMOOAI_ORG_ID=...
export SMOOAI_API_URL=https://api.production.smoo.ai
export SMOOAI_AUTH_URL=https://auth.production.smoo.ai/token

GitHub Actions example:

- name: Report test results
  run: npx @smooai/testing runs report ctrf-report.json --environment ci --name "${{ github.workflow }}"
  env:
      SMOOAI_CLIENT_ID: ${{ secrets.SMOOAI_CLIENT_ID }}
      SMOOAI_CLIENT_SECRET: ${{ secrets.SMOOAI_CLIENT_SECRET }}
      SMOOAI_ORG_ID: ${{ secrets.SMOOAI_ORG_ID }}

🔧 Development

pnpm install
pnpm build        # Build lib + CLI
pnpm test         # Run unit tests
pnpm typecheck    # TypeScript checks
pnpm lint         # Lint
pnpm format       # Format code
pnpm check-all    # All checks (CI parity)

🧩 Part of Smoo AI

@smooai/testing is built and open-sourced by Smoo AI — the AI-powered business platform with AI built into every product: CRM, customer support, campaigns, field service, observability, and developer tools.

📄 License

MIT


Built by Smoo AI — AI built into every product.

About

@smooai/testing — CLI and TypeScript library for the Smoo AI Testing API. Report CTRF test results, manage test runs, cases, environments, and deployments.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors