Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-tags-to-test-runs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smooai/testing': minor
---

Add tags support to test runs. Tags are flexible string arrays (e.g., `['e2e', 'brent-rager']`) for categorizing runs by type and scope. Added `--tags` CLI option to `create`, `report`, and `list` commands. Updated `SmooTestingClient.report()` to accept tags.
2 changes: 2 additions & 0 deletions src/cli/commands/runs/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface CreateOptions {
environmentId?: string;
deploymentId?: string;
tool?: string;
tags?: string;
runnerName?: string;
runnerUrl?: string;
}
Expand All @@ -24,6 +25,7 @@ export async function runCreate(options: CreateOptions): Promise<void> {
if (options.environmentId) body.environmentId = options.environmentId;
if (options.deploymentId) body.deploymentId = options.deploymentId;
if (options.tool) body.tool = options.tool;
if (options.tags) body.tags = options.tags.split(',').map((t: string) => t.trim());
if (options.runnerName) body.runnerName = options.runnerName;
if (options.runnerUrl) body.runnerUrl = options.runnerUrl;

Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/runs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function createRunsCommand(program: Command): Command {
.option('--environment-id <id>', 'Environment ID')
.option('--deployment-id <id>', 'Deployment ID')
.option('--tool <name>', 'Tool name (e.g., vitest, playwright)')
.option('--tags <tags>', 'Comma-separated tags (e.g., e2e,brent-rager)')
.option('--runner-name <name>', 'Runner name')
.option('--runner-url <url>', 'Runner URL')
.action(async (opts) => {
Expand All @@ -22,6 +23,7 @@ export function createRunsCommand(program: Command): Command {
.option('--status <status>', 'Filter by status')
.option('--environment-id <id>', 'Filter by environment ID')
.option('--tool <name>', 'Filter by tool')
.option('--tags <tags>', 'Filter by tags (comma-separated)')
.option('--limit <n>', 'Max results', '50')
.option('--offset <n>', 'Offset', '0')
.action(async (opts) => {
Expand Down Expand Up @@ -53,6 +55,7 @@ export function createRunsCommand(program: Command): Command {
.option('--environment <name>', 'Environment name')
.option('--deployment-id <id>', 'Deployment ID')
.option('--tool <name>', 'Override tool name from CTRF')
.option('--tags <tags>', 'Comma-separated tags (e.g., e2e,brent-rager)')
.option('--build-name <name>', 'Build name (e.g., git SHA)')
.option('--build-url <url>', 'Build URL (e.g., CI run link)')
.action(async (ctrfFile, opts) => {
Expand Down
2 changes: 2 additions & 0 deletions src/cli/commands/runs/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface ListOptions {
status?: string;
environmentId?: string;
tool?: string;
tags?: string;
limit?: string;
offset?: string;
}
Expand All @@ -21,6 +22,7 @@ export async function runList(options: ListOptions): Promise<void> {
status: options.status,
environmentId: options.environmentId,
tool: options.tool,
tags: options.tags,
limit: options.limit,
offset: options.offset,
});
Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/runs/report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface ReportOptions {
environment?: string;
deploymentId?: string;
tool?: string;
tags?: string;
buildName?: string;
buildUrl?: string;
}
Expand Down Expand Up @@ -45,6 +46,7 @@ export async function reportLogic(

if (options.environment) runBody.environment = options.environment;
if (options.deploymentId) runBody.deploymentId = options.deploymentId;
if (options.tags) runBody.tags = options.tags.split(',').map((t: string) => t.trim());

// Build URL from GitHub Actions context
if (options.buildUrl) {
Expand Down Expand Up @@ -112,6 +114,7 @@ function ReportUI({ ctrfFile, options }: { ctrfFile: string; options: ReportOpti
};
if (options.environment) runBody.environment = options.environment;
if (options.deploymentId) runBody.deploymentId = options.deploymentId;
if (options.tags) runBody.tags = options.tags.split(',').map((t: string) => t.trim());
if (options.buildUrl) {
runBody.buildUrl = options.buildUrl;
} else if (process.env.GITHUB_SERVER_URL && process.env.GITHUB_REPOSITORY && process.env.GITHUB_RUN_ID) {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export class SmooTestingClient {
environment?: string;
deploymentId?: string;
tool?: string;
tags?: string[];
buildName?: string;
buildUrl?: string;
},
Expand All @@ -227,6 +228,7 @@ export class SmooTestingClient {
environment: options?.environment,
deploymentId: options?.deploymentId,
tool: options?.tool ?? ctrf.results.tool?.name,
tags: options?.tags,
buildName: options?.buildName,
buildUrl: options?.buildUrl,
});
Expand Down
4 changes: 4 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface TestRun {
deploymentId: string | null;
name: string;
tool: string | null;
tags: string[] | null;
status: string;
summary: TestRunSummary | null;
durationMs: number | null;
Expand All @@ -51,6 +52,7 @@ export interface CreateTestRunInput {
environmentId?: string;
deploymentId?: string;
tool?: string;
tags?: string[];
buildName?: string;
buildUrl?: string;
runnerName?: string;
Expand All @@ -64,6 +66,7 @@ export interface UpdateTestRunInput {
completedAt?: string;
startedAt?: string;
tool?: string;
tags?: string[];
metadata?: Record<string, unknown>;
}

Expand All @@ -73,6 +76,7 @@ export interface ListTestRunsFilters {
status?: string;
environmentId?: string;
tool?: string;
tags?: string;
runnerName?: string;
startDate?: string;
endDate?: string;
Expand Down