Skip to content

Commit e1fe470

Browse files
Feat: Update ListTestCasesSchema to improve descriptions and remove unused fields
1 parent 8406f88 commit e1fe470

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

src/tools/testmanagement-utils/list-testcases.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import { formatAxiosError } from "../../lib/error";
1010
export const ListTestCasesSchema = z.object({
1111
project_identifier: z
1212
.string()
13-
.describe("Identifier of the project to fetch test cases from."),
13+
.describe(
14+
"Identifier of the project to fetch test cases from. Example: PR-12345",
15+
),
1416
folder_id: z
1517
.string()
1618
.optional()
@@ -25,19 +27,8 @@ export const ListTestCasesSchema = z.object({
2527
.string()
2628
.optional()
2729
.describe("Comma-separated list of priorities (e.g. critical,medium,low)."),
28-
status: z
29-
.string()
30-
.optional()
31-
.describe("Comma-separated list of statuses (e.g. draft,active)."),
32-
tags: z.string().optional().describe("Comma-separated list of tags."),
33-
owner: z.string().optional().describe("Owner email to filter by."),
30+
3431
p: z.number().optional().describe("Page number."),
35-
custom_fields: z
36-
.record(z.array(z.string()))
37-
.optional()
38-
.describe(
39-
"Map of custom field names to arrays of values, e.g. { estimate: ['10','20'], 'automation type': ['automated'] }",
40-
),
4132
});
4233

4334
export type ListTestCasesArgs = z.infer<typeof ListTestCasesSchema>;
@@ -54,15 +45,7 @@ export async function listTestCases(
5445
if (args.folder_id) params.append("folder_id", args.folder_id);
5546
if (args.case_type) params.append("case_type", args.case_type);
5647
if (args.priority) params.append("priority", args.priority);
57-
if (args.status) params.append("status", args.status);
58-
if (args.tags) params.append("tags", args.tags);
59-
if (args.owner) params.append("owner", args.owner);
6048
if (args.p !== undefined) params.append("p", args.p.toString());
61-
if (args.custom_fields) {
62-
for (const [field, values] of Object.entries(args.custom_fields)) {
63-
params.append(`custom_fields[${field}]`, values.join(","));
64-
}
65-
}
6649

6750
const url = `https://test-management.browserstack.com/api/v2/projects/${encodeURIComponent(
6851
args.project_identifier,
@@ -96,7 +79,7 @@ export async function listTestCases(
9679
const summary = test_cases
9780
.map(
9881
(tc: any) =>
99-
`• ${tc.identifier}: ${tc.title} [${tc.case_type} | ${tc.status} | ${tc.priority}]`,
82+
`• ${tc.identifier}: ${tc.title} [${tc.case_type} | ${tc.priority}]`,
10083
)
10184
.join("\n");
10285

tests/tools/testmanagement.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('listTestCases util', () => {
183183
expect.objectContaining({ auth: expect.any(Object) })
184184
);
185185
expect(result.content[0].text).toContain('Found 2 test case(s):');
186-
expect(result.content[0].text).toContain('TC-1: Test One [functional | active | high]');
186+
expect(result.content[0].text).toContain('TC-1: Test One [functional | high]');
187187
expect(result.content[1].text).toBe(JSON.stringify(mockCases, null, 2));
188188
});
189189

0 commit comments

Comments
 (0)