@smartbear/mcp 0.30.0 → 0.31.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/dist/bearq/client.js +2 -6
- package/dist/bearq/tool/tasks/delete-test-cases.js +53 -0
- package/dist/package.json.js +1 -1
- package/dist/swagger/client/functional-testing-api.js +5 -9
- package/package.json +1 -1
- package/dist/bearq/tool/tasks/refine-all-draft-tests.js +0 -28
- package/dist/bearq/tool/tasks/refine-test-cases.js +0 -31
- package/dist/bearq/tool/tasks/refine-tests-in-functional-areas.js +0 -35
package/dist/bearq/client.js
CHANGED
|
@@ -5,12 +5,10 @@ import { ToolError } from "../common/tools.js";
|
|
|
5
5
|
import { DEFAULT_API_BASE_URL, AUTHORIZATION_HEADER } from "./config/constants.js";
|
|
6
6
|
import { ListEnvironments } from "./tool/environments/list-environments.js";
|
|
7
7
|
import { ChatWithQaLead } from "./tool/tasks/chat-with-qa-lead.js";
|
|
8
|
+
import { DeleteTestCases } from "./tool/tasks/delete-test-cases.js";
|
|
8
9
|
import { ExpandApplicationModel } from "./tool/tasks/expand-application-model.js";
|
|
9
10
|
import { GetTask } from "./tool/tasks/get-task.js";
|
|
10
11
|
import { GetTaskStatus } from "./tool/tasks/get-task-status.js";
|
|
11
|
-
import { RefineAllDraftTests } from "./tool/tasks/refine-all-draft-tests.js";
|
|
12
|
-
import { RefineTestCases } from "./tool/tasks/refine-test-cases.js";
|
|
13
|
-
import { RefineTestsInFunctionalAreas } from "./tool/tasks/refine-tests-in-functional-areas.js";
|
|
14
12
|
import { RunRegressionTests } from "./tool/tasks/run-regression-tests.js";
|
|
15
13
|
import { RunTestCases } from "./tool/tasks/run-test-cases.js";
|
|
16
14
|
import { RunTestsInFunctionalAreas } from "./tool/tasks/run-tests-in-functional-areas.js";
|
|
@@ -62,9 +60,7 @@ class BearQClient {
|
|
|
62
60
|
new RunRegressionTests(this),
|
|
63
61
|
new RunTestCases(this),
|
|
64
62
|
new RunTestsInFunctionalAreas(this),
|
|
65
|
-
new
|
|
66
|
-
new RefineTestsInFunctionalAreas(this),
|
|
67
|
-
new RefineAllDraftTests(this),
|
|
63
|
+
new DeleteTestCases(this),
|
|
68
64
|
new ExpandApplicationModel(this),
|
|
69
65
|
new ChatWithQaLead(this),
|
|
70
66
|
new GetTask(this),
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Tool } from "../../../common/tools.js";
|
|
3
|
+
const inputSchema = z.object({
|
|
4
|
+
testCaseIds: z.array(z.number().int().positive()).min(1).describe("IDs of BearQ test cases to delete.")
|
|
5
|
+
});
|
|
6
|
+
class DeleteTestCases extends Tool {
|
|
7
|
+
specification = {
|
|
8
|
+
title: "Delete Test Cases",
|
|
9
|
+
toolset: "Tasks",
|
|
10
|
+
summary: "Deletes specific BearQ test cases by ID. Deletion is reversible — tests are archived and can be restored. Works on any unprotected test; protected tests are rejected.",
|
|
11
|
+
inputSchema,
|
|
12
|
+
readOnly: false,
|
|
13
|
+
destructive: true
|
|
14
|
+
};
|
|
15
|
+
handle = async (args) => {
|
|
16
|
+
const { testCaseIds } = inputSchema.parse(args);
|
|
17
|
+
const deleted = [];
|
|
18
|
+
const failed = [];
|
|
19
|
+
await Promise.all(
|
|
20
|
+
testCaseIds.map(async (testCaseId) => {
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(
|
|
23
|
+
`${this.client.getBaseUrl()}/test-cases/${testCaseId}`,
|
|
24
|
+
{
|
|
25
|
+
method: "DELETE",
|
|
26
|
+
headers: this.client.getHeaders()
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
if (res.ok) {
|
|
30
|
+
deleted.push(testCaseId);
|
|
31
|
+
} else {
|
|
32
|
+
failed.push({
|
|
33
|
+
testCaseId,
|
|
34
|
+
error: `${res.status} ${res.statusText}`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
} catch (e) {
|
|
38
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
39
|
+
failed.push({
|
|
40
|
+
testCaseId,
|
|
41
|
+
error: msg.length > 200 ? `${msg.slice(0, 200)}…` : msg
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: "text", text: JSON.stringify({ deleted, failed }) }]
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
DeleteTestCases
|
|
53
|
+
};
|
package/dist/package.json.js
CHANGED
|
@@ -120,10 +120,11 @@ class FunctionalTestingAPI {
|
|
|
120
120
|
...data,
|
|
121
121
|
executions: {
|
|
122
122
|
data: data.executions.data.map(
|
|
123
|
-
({ executionId, status, isFinished }) => ({
|
|
123
|
+
({ executionId, status, isFinished, url }) => ({
|
|
124
124
|
executionId,
|
|
125
125
|
status,
|
|
126
|
-
isFinished
|
|
126
|
+
isFinished,
|
|
127
|
+
url
|
|
127
128
|
})
|
|
128
129
|
)
|
|
129
130
|
}
|
|
@@ -181,7 +182,7 @@ class FunctionalTestingAPI {
|
|
|
181
182
|
},
|
|
182
183
|
errorMessageFor("run suite")
|
|
183
184
|
);
|
|
184
|
-
return
|
|
185
|
+
return response.json();
|
|
185
186
|
}
|
|
186
187
|
async getSuiteExecution(args) {
|
|
187
188
|
if (!args.suiteId) throw new ToolError("suiteId argument is required");
|
|
@@ -196,7 +197,7 @@ class FunctionalTestingAPI {
|
|
|
196
197
|
},
|
|
197
198
|
errorMessageFor("get suite execution status")
|
|
198
199
|
);
|
|
199
|
-
const data = await
|
|
200
|
+
const data = await response.json();
|
|
200
201
|
const testsData = data.tests?.data;
|
|
201
202
|
if (Array.isArray(testsData)) {
|
|
202
203
|
for (const test of testsData) {
|
|
@@ -230,11 +231,6 @@ class FunctionalTestingAPI {
|
|
|
230
231
|
);
|
|
231
232
|
return response.json();
|
|
232
233
|
}
|
|
233
|
-
async withoutField(field, response) {
|
|
234
|
-
const data = await response.json();
|
|
235
|
-
delete data[field];
|
|
236
|
-
return data;
|
|
237
|
-
}
|
|
238
234
|
}
|
|
239
235
|
function handleStatus(messages, defaultMessage) {
|
|
240
236
|
return (response) => messages.get(response.status) || defaultMessage(response);
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({});
|
|
4
|
-
class RefineAllDraftTests extends Tool {
|
|
5
|
-
specification = {
|
|
6
|
-
title: "Refine All Draft Tests",
|
|
7
|
-
toolset: "Tasks",
|
|
8
|
-
summary: "Refines every draft test case in the workspace. Use to push an entire draft backlog forward; may take multiple passes before all drafts are ready to be promoted to regression tests.",
|
|
9
|
-
inputSchema
|
|
10
|
-
};
|
|
11
|
-
handle = async (_args) => {
|
|
12
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
13
|
-
method: "POST",
|
|
14
|
-
headers: this.client.getHeaders(),
|
|
15
|
-
body: JSON.stringify({ agent: "tester", mode: "refine" })
|
|
16
|
-
});
|
|
17
|
-
if (!res.ok)
|
|
18
|
-
throw new ToolError(
|
|
19
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
20
|
-
);
|
|
21
|
-
return {
|
|
22
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
RefineAllDraftTests
|
|
28
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({
|
|
4
|
-
testCaseIds: z.array(z.number().int().positive()).min(1).describe("IDs of BearQ draft test cases to refine.")
|
|
5
|
-
});
|
|
6
|
-
class RefineTestCases extends Tool {
|
|
7
|
-
specification = {
|
|
8
|
-
title: "Refine Test Cases",
|
|
9
|
-
toolset: "Tasks",
|
|
10
|
-
summary: "Refines specific BearQ draft test cases — improves their steps so they can eventually be promoted to regression tests. Use when a draft is incomplete or has drifted from its intent.",
|
|
11
|
-
inputSchema
|
|
12
|
-
};
|
|
13
|
-
handle = async (args) => {
|
|
14
|
-
const { testCaseIds } = inputSchema.parse(args);
|
|
15
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
16
|
-
method: "POST",
|
|
17
|
-
headers: this.client.getHeaders(),
|
|
18
|
-
body: JSON.stringify({ agent: "tester", mode: "refine", testCaseIds })
|
|
19
|
-
});
|
|
20
|
-
if (!res.ok)
|
|
21
|
-
throw new ToolError(
|
|
22
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
23
|
-
);
|
|
24
|
-
return {
|
|
25
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
RefineTestCases
|
|
31
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({
|
|
4
|
-
functionalAreas: z.array(z.union([z.number().int().positive(), z.string().min(1)])).min(1).describe("Functional areas to target, by ID or name.")
|
|
5
|
-
});
|
|
6
|
-
class RefineTestsInFunctionalAreas extends Tool {
|
|
7
|
-
specification = {
|
|
8
|
-
title: "Refine Tests in Functional Areas",
|
|
9
|
-
toolset: "Tasks",
|
|
10
|
-
summary: "Refines every draft test case tagged with one or more functional areas. Functional areas can be given by ID or name. May take multiple passes before drafts are ready to be promoted to regression tests.",
|
|
11
|
-
inputSchema
|
|
12
|
-
};
|
|
13
|
-
handle = async (args) => {
|
|
14
|
-
const { functionalAreas } = inputSchema.parse(args);
|
|
15
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
16
|
-
method: "POST",
|
|
17
|
-
headers: this.client.getHeaders(),
|
|
18
|
-
body: JSON.stringify({
|
|
19
|
-
agent: "tester",
|
|
20
|
-
mode: "refine",
|
|
21
|
-
functionalAreas
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
if (!res.ok)
|
|
25
|
-
throw new ToolError(
|
|
26
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
27
|
-
);
|
|
28
|
-
return {
|
|
29
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
RefineTestsInFunctionalAreas
|
|
35
|
-
};
|