@smartbear/mcp 0.9.0 → 0.10.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 +29 -4
- package/dist/api-hub/client/api.js +188 -0
- package/dist/api-hub/client/configuration.js +5 -0
- package/dist/api-hub/client/index.js +1 -0
- package/dist/api-hub/client/portal-types.js +126 -0
- package/dist/api-hub/client/tools.js +72 -15
- package/dist/api-hub/client/user-management-types.js +24 -0
- package/dist/api-hub/client.js +31 -0
- package/dist/bugsnag/client.js +4 -4
- package/dist/collaborator/client.js +364 -0
- package/dist/common/server.js +48 -20
- package/dist/index.js +9 -1
- package/dist/pactflow/client/tools.js +4 -4
- package/dist/qmetry/client/auto-resolve.js +22 -0
- package/dist/qmetry/client/handlers.js +18 -4
- package/dist/qmetry/client/issues.js +98 -1
- package/dist/qmetry/client/project.js +18 -1
- package/dist/qmetry/client/testcase.js +79 -1
- package/dist/qmetry/client/testsuite.js +156 -1
- package/dist/qmetry/client/tools/index.js +17 -0
- package/dist/qmetry/client/tools/issue-tools.js +545 -0
- package/dist/qmetry/client/tools/project-tools.js +348 -0
- package/dist/qmetry/client/tools/requirement-tools.js +530 -0
- package/dist/qmetry/client/tools/testcase-tools.js +526 -0
- package/dist/qmetry/client/tools/testsuite-tools.js +772 -0
- package/dist/qmetry/client/tools/types.js +1 -0
- package/dist/qmetry/client.js +9 -2
- package/dist/qmetry/config/constants.js +14 -0
- package/dist/qmetry/config/rest-endpoints.js +10 -0
- package/dist/qmetry/types/common.js +287 -2
- package/dist/qmetry/types/issues.js +11 -1
- package/dist/qmetry/types/project.js +7 -0
- package/dist/qmetry/types/testcase.js +6 -0
- package/dist/qmetry/types/testsuite.js +19 -1
- package/dist/zephyr/client.js +7 -1
- package/dist/zephyr/common/api-client.js +8 -0
- package/dist/zephyr/common/rest-api-schemas.js +5173 -0
- package/dist/zephyr/tool/project/get-project.js +39 -0
- package/dist/zephyr/tool/project/get-projects.js +7 -13
- package/dist/zephyr/tool/test-cycle/get-test-cycles.js +72 -0
- package/package.json +1 -1
- package/dist/qmetry/client/tools.js +0 -1673
- package/dist/zephyr/common/types.js +0 -35
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
import { QMetryToolsHandlers } from "../config/constants.js";
|
|
2
|
-
import { fetchIssuesLinkedToTestCase } from "./issues.js";
|
|
3
|
-
import { getBuilds, getPlatforms, getProjectInfo, getReleasesCycles, } from "./project.js";
|
|
2
|
+
import { createIssue, fetchIssues, fetchIssuesLinkedToTestCase, linkIssuesToTestcaseRun, updateIssue, } from "./issues.js";
|
|
3
|
+
import { getBuilds, getPlatforms, getProjectInfo, getProjects, getReleasesCycles, } from "./project.js";
|
|
4
4
|
import { fetchRequirementDetails, fetchRequirements, fetchRequirementsLinkedToTestCase, } from "./requirement.js";
|
|
5
|
-
import { fetchTestCaseDetails, fetchTestCaseExecutions, fetchTestCaseSteps, fetchTestCases, fetchTestCasesLinkedToRequirement, fetchTestCaseVersionDetails, } from "./testcase.js";
|
|
6
|
-
import { fetchExecutionsByTestSuite, fetchLinkedIssuesByTestCaseRun, fetchTestCaseRunsByTestSuiteRun, fetchTestCasesByTestSuite, fetchTestSuitesForTestCase, } from "./testsuite.js";
|
|
5
|
+
import { createTestCases, fetchTestCaseDetails, fetchTestCaseExecutions, fetchTestCaseSteps, fetchTestCases, fetchTestCasesLinkedToRequirement, fetchTestCaseVersionDetails, linkRequirementToTestCase, updateTestCase, } from "./testcase.js";
|
|
6
|
+
import { createTestSuites, fetchExecutionsByTestSuite, fetchLinkedIssuesByTestCaseRun, fetchTestCaseRunsByTestSuiteRun, fetchTestCasesByTestSuite, fetchTestSuites, fetchTestSuitesForTestCase, linkPlatformsToTestSuite, linkTestCasesToTestSuite, reqLinkedTestCasesToTestSuite, updateTestSuite, } from "./testsuite.js";
|
|
7
7
|
export const QMETRY_HANDLER_MAP = {
|
|
8
|
+
[QMetryToolsHandlers.FETCH_PROJECTS]: getProjects,
|
|
8
9
|
[QMetryToolsHandlers.SET_PROJECT_INFO]: getProjectInfo,
|
|
9
10
|
[QMetryToolsHandlers.FETCH_PROJECT_INFO]: getProjectInfo,
|
|
10
11
|
[QMetryToolsHandlers.FETCH_RELEASES_CYCLES]: getReleasesCycles,
|
|
11
12
|
[QMetryToolsHandlers.FETCH_BUILDS]: getBuilds,
|
|
12
13
|
[QMetryToolsHandlers.FETCH_PLATFORMS]: getPlatforms,
|
|
14
|
+
[QMetryToolsHandlers.CREATE_TEST_CASE]: createTestCases,
|
|
15
|
+
[QMetryToolsHandlers.UPDATE_TEST_CASE]: updateTestCase,
|
|
13
16
|
[QMetryToolsHandlers.FETCH_TEST_CASES]: fetchTestCases,
|
|
14
17
|
[QMetryToolsHandlers.FETCH_TEST_CASE_DETAILS]: fetchTestCaseDetails,
|
|
15
18
|
[QMetryToolsHandlers.FETCH_TEST_CASE_VERSION_DETAILS]: fetchTestCaseVersionDetails,
|
|
16
19
|
[QMetryToolsHandlers.FETCH_TEST_CASE_STEPS]: fetchTestCaseSteps,
|
|
17
20
|
[QMetryToolsHandlers.FETCH_TEST_CASE_EXECUTIONS]: fetchTestCaseExecutions,
|
|
21
|
+
[QMetryToolsHandlers.LINK_REQUIREMENT_TO_TESTCASE]: linkRequirementToTestCase,
|
|
18
22
|
[QMetryToolsHandlers.FETCH_REQUIREMENTS]: fetchRequirements,
|
|
19
23
|
[QMetryToolsHandlers.FETCH_REQUIREMENT_DETAILS]: fetchRequirementDetails,
|
|
20
24
|
[QMetryToolsHandlers.FETCH_TESTCASES_LINKED_TO_REQUIREMENT]: fetchTestCasesLinkedToRequirement,
|
|
21
25
|
[QMetryToolsHandlers.FETCH_REQUIREMENTS_LINKED_TO_TESTCASE]: fetchRequirementsLinkedToTestCase,
|
|
26
|
+
[QMetryToolsHandlers.CREATE_TEST_SUITE]: createTestSuites,
|
|
27
|
+
[QMetryToolsHandlers.UPDATE_TEST_SUITE]: updateTestSuite,
|
|
28
|
+
[QMetryToolsHandlers.FETCH_TEST_SUITES]: fetchTestSuites,
|
|
22
29
|
[QMetryToolsHandlers.FETCH_TESTSUITES_FOR_TESTCASE]: fetchTestSuitesForTestCase,
|
|
30
|
+
[QMetryToolsHandlers.LINK_TESTCASES_TO_TESTSUITE]: linkTestCasesToTestSuite,
|
|
31
|
+
[QMetryToolsHandlers.REQUIREMENTS_LINKED_TESTCASES_TO_TESTSUITE]: reqLinkedTestCasesToTestSuite,
|
|
23
32
|
[QMetryToolsHandlers.FETCH_TESTCASES_BY_TESTSUITE]: fetchTestCasesByTestSuite,
|
|
24
33
|
[QMetryToolsHandlers.FETCH_EXECUTIONS_BY_TESTSUITE]: fetchExecutionsByTestSuite,
|
|
25
34
|
[QMetryToolsHandlers.FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN]: fetchTestCaseRunsByTestSuiteRun,
|
|
26
35
|
[QMetryToolsHandlers.FETCH_LINKED_ISSUES_BY_TESTCASE_RUN]: fetchLinkedIssuesByTestCaseRun,
|
|
27
36
|
[QMetryToolsHandlers.FETCH_ISSUES_LINKED_TO_TESTCASE]: fetchIssuesLinkedToTestCase,
|
|
37
|
+
[QMetryToolsHandlers.CREATE_ISSUE]: createIssue,
|
|
38
|
+
[QMetryToolsHandlers.UPDATE_ISSUE]: updateIssue,
|
|
39
|
+
[QMetryToolsHandlers.FETCH_ISSUES]: fetchIssues,
|
|
40
|
+
[QMetryToolsHandlers.LINK_ISSUES_TO_TESTCASE_RUN]: linkIssuesToTestcaseRun,
|
|
41
|
+
[QMetryToolsHandlers.LINK_PLATFORMS_TO_TESTSUITE]: linkPlatformsToTestSuite,
|
|
28
42
|
};
|
|
@@ -1,7 +1,79 @@
|
|
|
1
1
|
import { QMETRY_PATHS } from "../config/rest-endpoints.js";
|
|
2
|
-
import { DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD, } from "../types/issues.js";
|
|
2
|
+
import { DEFAULT_CREATE_ISSUE_PAYLOAD, DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_ISSUES_PAYLOAD, DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD, DEFAULT_UPDATE_ISSUE_PAYLOAD, } from "../types/issues.js";
|
|
3
3
|
import { qmetryRequest } from "./api/client-api.js";
|
|
4
4
|
import { resolveDefaults } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create Defect/Issue.
|
|
7
|
+
* @throws If `issueType` or `issuePriority` or `summary` are missing/invalid.
|
|
8
|
+
*/
|
|
9
|
+
export async function createIssue(token, baseUrl, project, payload) {
|
|
10
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
11
|
+
const body = {
|
|
12
|
+
...DEFAULT_CREATE_ISSUE_PAYLOAD,
|
|
13
|
+
...payload,
|
|
14
|
+
};
|
|
15
|
+
if (typeof body.issueType !== "number") {
|
|
16
|
+
throw new Error("[createIssue] Missing or invalid required parameter: 'issueType'.");
|
|
17
|
+
}
|
|
18
|
+
if (typeof body.issuePriority !== "number") {
|
|
19
|
+
throw new Error("[createIssue] Missing or invalid required parameter: 'issuePriority'.");
|
|
20
|
+
}
|
|
21
|
+
if (typeof body.summary !== "string") {
|
|
22
|
+
throw new Error("[createIssue] Missing or invalid required parameter: 'summary'.");
|
|
23
|
+
}
|
|
24
|
+
return qmetryRequest({
|
|
25
|
+
method: "POST",
|
|
26
|
+
path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
|
|
27
|
+
token,
|
|
28
|
+
project: resolvedProject,
|
|
29
|
+
baseUrl: resolvedBaseUrl,
|
|
30
|
+
body,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Update Defect/Issue.
|
|
35
|
+
* @throws If `DefectId` is missing/invalid.
|
|
36
|
+
*/
|
|
37
|
+
export async function updateIssue(token, baseUrl, project, payload) {
|
|
38
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
39
|
+
const body = {
|
|
40
|
+
...DEFAULT_UPDATE_ISSUE_PAYLOAD,
|
|
41
|
+
...payload,
|
|
42
|
+
};
|
|
43
|
+
if (typeof body.DefectId !== "number") {
|
|
44
|
+
throw new Error("[updateIssue] Missing or invalid required parameter: 'DefectId'.");
|
|
45
|
+
}
|
|
46
|
+
return qmetryRequest({
|
|
47
|
+
method: "PUT",
|
|
48
|
+
path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
|
|
49
|
+
token,
|
|
50
|
+
project: resolvedProject,
|
|
51
|
+
baseUrl: resolvedBaseUrl,
|
|
52
|
+
body,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Fetches a list of test suites.
|
|
57
|
+
* @throws If `viewId` or `folderPath` are missing/invalid.
|
|
58
|
+
*/
|
|
59
|
+
export async function fetchIssues(token, baseUrl, project, payload) {
|
|
60
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
61
|
+
const body = {
|
|
62
|
+
...DEFAULT_FETCH_ISSUES_PAYLOAD,
|
|
63
|
+
...payload,
|
|
64
|
+
};
|
|
65
|
+
if (typeof body.viewId !== "number") {
|
|
66
|
+
throw new Error("[fetchIssues] Missing or invalid required parameter: 'viewId'.");
|
|
67
|
+
}
|
|
68
|
+
return qmetryRequest({
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: QMETRY_PATHS.ISSUES.GET_ISSUES_LIST,
|
|
71
|
+
token,
|
|
72
|
+
project: resolvedProject,
|
|
73
|
+
baseUrl: resolvedBaseUrl,
|
|
74
|
+
body,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
5
77
|
/**
|
|
6
78
|
* Fetches issues linked to a specific test case.
|
|
7
79
|
* @throws If `tcID` is missing/invalid.
|
|
@@ -24,3 +96,28 @@ export async function fetchIssuesLinkedToTestCase(token, baseUrl, project, paylo
|
|
|
24
96
|
body,
|
|
25
97
|
});
|
|
26
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Link Issues to Testcase Run.
|
|
101
|
+
* @throws If issueIds or tcrId are missing/invalid.
|
|
102
|
+
*/
|
|
103
|
+
export async function linkIssuesToTestcaseRun(token, baseUrl, project, payload) {
|
|
104
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
105
|
+
const body = {
|
|
106
|
+
...DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD,
|
|
107
|
+
...payload,
|
|
108
|
+
};
|
|
109
|
+
if (!Array.isArray(body.issueIds) || body.issueIds.length === 0) {
|
|
110
|
+
throw new Error("[linkIssuesToTestcaseRun] Missing or invalid required parameter: 'issueIds'.");
|
|
111
|
+
}
|
|
112
|
+
if (typeof body.tcrId !== "number") {
|
|
113
|
+
throw new Error("[linkIssuesToTestcaseRun] Missing or invalid required parameter: 'tcrId'.");
|
|
114
|
+
}
|
|
115
|
+
return qmetryRequest({
|
|
116
|
+
method: "PUT",
|
|
117
|
+
path: QMETRY_PATHS.ISSUES.LINK_ISSUES_TO_TESTCASE_RUN,
|
|
118
|
+
token,
|
|
119
|
+
project: resolvedProject,
|
|
120
|
+
baseUrl: resolvedBaseUrl,
|
|
121
|
+
body,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QMETRY_DEFAULTS } from "../config/constants.js";
|
|
2
2
|
import { QMETRY_PATHS } from "../config/rest-endpoints.js";
|
|
3
|
-
import { DEFAULT_FETCH_BUILD_PAYLOAD, DEFAULT_FETCH_PLATFORMS_PAYLOAD, } from "../types/project.js";
|
|
3
|
+
import { DEFAULT_FETCH_BUILD_PAYLOAD, DEFAULT_FETCH_PLATFORMS_PAYLOAD, DEFAULT_FETCH_PROJECTS_PAYLOAD, } from "../types/project.js";
|
|
4
4
|
import { qmetryRequest } from "./api/client-api.js";
|
|
5
5
|
/**
|
|
6
6
|
* Retrieves project information from QMetry
|
|
@@ -26,6 +26,23 @@ export async function getProjectInfo(token, baseUrl, project) {
|
|
|
26
26
|
project: project || QMETRY_DEFAULTS.PROJECT_KEY,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Fetches a List of projects.
|
|
31
|
+
*/
|
|
32
|
+
export async function getProjects(token, baseUrl, project, payload) {
|
|
33
|
+
const body = {
|
|
34
|
+
...DEFAULT_FETCH_PROJECTS_PAYLOAD,
|
|
35
|
+
...payload,
|
|
36
|
+
};
|
|
37
|
+
return qmetryRequest({
|
|
38
|
+
method: "POST",
|
|
39
|
+
path: QMETRY_PATHS.PROJECT.GET_PROJECTS,
|
|
40
|
+
token,
|
|
41
|
+
baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
|
|
42
|
+
project: project || QMETRY_DEFAULTS.PROJECT_KEY,
|
|
43
|
+
body,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
29
46
|
export async function getReleasesCycles(token, baseUrl, project, payload = {}) {
|
|
30
47
|
let showArchiveValue;
|
|
31
48
|
if (payload.showArchive !== undefined) {
|
|
@@ -1,7 +1,57 @@
|
|
|
1
1
|
import { QMETRY_PATHS } from "../config/rest-endpoints.js";
|
|
2
|
-
import { DEFAULT_FETCH_TESTCASE_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASE_EXECUTIONS_PAYLOAD, DEFAULT_FETCH_TESTCASE_STEPS_PAYLOAD, DEFAULT_FETCH_TESTCASE_VERSION_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASES_LINKED_TO_REQUIREMENT_PAYLOAD, DEFAULT_FETCH_TESTCASES_PAYLOAD, } from "../types/testcase.js";
|
|
2
|
+
import { DEFAULT_CREATE_TESTCASES_PAYLOAD, DEFAULT_FETCH_TESTCASE_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASE_EXECUTIONS_PAYLOAD, DEFAULT_FETCH_TESTCASE_STEPS_PAYLOAD, DEFAULT_FETCH_TESTCASE_VERSION_DETAILS_PAYLOAD, DEFAULT_FETCH_TESTCASES_LINKED_TO_REQUIREMENT_PAYLOAD, DEFAULT_FETCH_TESTCASES_PAYLOAD, DEFAULT_LINKED_REQUIREMENT_TO_TESTCASE_PAYLOAD, DEFAULT_UPDATE_TESTCASES_PAYLOAD, } from "../types/testcase.js";
|
|
3
3
|
import { qmetryRequest } from "./api/client-api.js";
|
|
4
4
|
import { resolveDefaults } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create test cases.
|
|
7
|
+
* @throws If `tcFolderID` or `name` are missing/invalid.
|
|
8
|
+
*/
|
|
9
|
+
export async function createTestCases(token, baseUrl, project, payload) {
|
|
10
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
11
|
+
const body = {
|
|
12
|
+
...DEFAULT_CREATE_TESTCASES_PAYLOAD,
|
|
13
|
+
...payload,
|
|
14
|
+
};
|
|
15
|
+
if (typeof body.tcFolderID !== "string") {
|
|
16
|
+
throw new Error("[createTestCases] Missing or invalid required parameter: 'tcFolderID'.");
|
|
17
|
+
}
|
|
18
|
+
if (typeof body.name !== "string") {
|
|
19
|
+
throw new Error("[createTestCases] Missing or invalid required parameter: 'name'.");
|
|
20
|
+
}
|
|
21
|
+
return qmetryRequest({
|
|
22
|
+
method: "POST",
|
|
23
|
+
path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
|
|
24
|
+
token,
|
|
25
|
+
project: resolvedProject,
|
|
26
|
+
baseUrl: resolvedBaseUrl,
|
|
27
|
+
body,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Update test cases.
|
|
32
|
+
* @throws If `tcID` or `tcVersionID` are missing/invalid.
|
|
33
|
+
*/
|
|
34
|
+
export async function updateTestCase(token, baseUrl, project, payload) {
|
|
35
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
36
|
+
const body = {
|
|
37
|
+
...DEFAULT_UPDATE_TESTCASES_PAYLOAD,
|
|
38
|
+
...payload,
|
|
39
|
+
};
|
|
40
|
+
if (typeof body.tcID !== "number") {
|
|
41
|
+
throw new Error("[updateTestCase] Missing or invalid required parameter: 'tcID'.");
|
|
42
|
+
}
|
|
43
|
+
if (typeof body.tcVersionID !== "number") {
|
|
44
|
+
throw new Error("[updateTestCase] Missing or invalid required parameter: 'tcVersionID'.");
|
|
45
|
+
}
|
|
46
|
+
return qmetryRequest({
|
|
47
|
+
method: "PUT",
|
|
48
|
+
path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
|
|
49
|
+
token,
|
|
50
|
+
project: resolvedProject,
|
|
51
|
+
baseUrl: resolvedBaseUrl,
|
|
52
|
+
body,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
5
55
|
/**
|
|
6
56
|
* Fetches a list of test cases.
|
|
7
57
|
* @throws If `viewId` or `folderPath` are missing/invalid.
|
|
@@ -140,3 +190,31 @@ export async function fetchTestCaseExecutions(token, baseUrl, project, payload)
|
|
|
140
190
|
body,
|
|
141
191
|
});
|
|
142
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Links a requirement to a test case.
|
|
195
|
+
* @throws If `tcID` or `tcVersionID` or `rqVersionIds` are missing/invalid.
|
|
196
|
+
*/
|
|
197
|
+
export async function linkRequirementToTestCase(token, baseUrl, project, payload) {
|
|
198
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
199
|
+
const body = {
|
|
200
|
+
...DEFAULT_LINKED_REQUIREMENT_TO_TESTCASE_PAYLOAD,
|
|
201
|
+
...payload,
|
|
202
|
+
};
|
|
203
|
+
if (typeof body.tcID !== "string") {
|
|
204
|
+
throw new Error("[linkRequirementToTestCase] Missing or invalid required parameter: 'tcID'.");
|
|
205
|
+
}
|
|
206
|
+
if (typeof body.tcVersionId !== "number") {
|
|
207
|
+
throw new Error("[linkRequirementToTestCase] Missing or invalid required parameter: 'tcVersionId'.");
|
|
208
|
+
}
|
|
209
|
+
if (typeof body.rqVersionIds !== "string") {
|
|
210
|
+
throw new Error("[linkRequirementToTestCase] Missing or invalid required parameter: 'rqVersionIds'.");
|
|
211
|
+
}
|
|
212
|
+
return qmetryRequest({
|
|
213
|
+
method: "PUT",
|
|
214
|
+
path: QMETRY_PATHS.TESTCASE.LINKED_RQ_TO_TC,
|
|
215
|
+
token,
|
|
216
|
+
project: resolvedProject,
|
|
217
|
+
baseUrl: resolvedBaseUrl,
|
|
218
|
+
body,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
@@ -1,7 +1,85 @@
|
|
|
1
1
|
import { QMETRY_PATHS } from "../config/rest-endpoints.js";
|
|
2
|
-
import { DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD, } from "../types/testsuite.js";
|
|
2
|
+
import { DEFAULT_CREATE_TESTSUITE_PAYLOAD, DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_PAYLOAD, DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD, DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_UPDATE_TESTSUITE_PAYLOAD, } from "../types/testsuite.js";
|
|
3
3
|
import { qmetryRequest } from "./api/client-api.js";
|
|
4
4
|
import { resolveDefaults } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create test suites.
|
|
7
|
+
* @throws If `parentFolderId` or `name` are missing/invalid.
|
|
8
|
+
*/
|
|
9
|
+
export async function createTestSuites(token, baseUrl, project, payload) {
|
|
10
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
11
|
+
const body = {
|
|
12
|
+
...DEFAULT_CREATE_TESTSUITE_PAYLOAD,
|
|
13
|
+
...payload,
|
|
14
|
+
};
|
|
15
|
+
if (typeof body.parentFolderId !== "string") {
|
|
16
|
+
throw new Error("[createTestSuites] Missing or invalid required parameter: 'parentFolderId'.");
|
|
17
|
+
}
|
|
18
|
+
if (typeof body.name !== "string") {
|
|
19
|
+
throw new Error("[createTestSuites] Missing or invalid required parameter: 'name'.");
|
|
20
|
+
}
|
|
21
|
+
return qmetryRequest({
|
|
22
|
+
method: "POST",
|
|
23
|
+
path: QMETRY_PATHS.TESTSUITE.CREATE_UPDATE_TS,
|
|
24
|
+
token,
|
|
25
|
+
project: resolvedProject,
|
|
26
|
+
baseUrl: resolvedBaseUrl,
|
|
27
|
+
body,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Update test suites.
|
|
32
|
+
* @throws If `id` or `entityKey` or `TsFolderID` are missing/invalid.
|
|
33
|
+
*/
|
|
34
|
+
export async function updateTestSuite(token, baseUrl, project, payload) {
|
|
35
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
36
|
+
const body = {
|
|
37
|
+
...DEFAULT_UPDATE_TESTSUITE_PAYLOAD,
|
|
38
|
+
...payload,
|
|
39
|
+
};
|
|
40
|
+
if (typeof body.id !== "number") {
|
|
41
|
+
throw new Error("[updateTestSuite] Missing or invalid required parameter: 'id'.");
|
|
42
|
+
}
|
|
43
|
+
if (typeof body.entityKey !== "string") {
|
|
44
|
+
throw new Error("[updateTestSuite] Missing or invalid required parameter: 'entityKey'.");
|
|
45
|
+
}
|
|
46
|
+
if (typeof body.TsFolderID !== "number") {
|
|
47
|
+
throw new Error("[updateTestSuite] Missing or invalid required parameter: 'TsFolderID'.");
|
|
48
|
+
}
|
|
49
|
+
return qmetryRequest({
|
|
50
|
+
method: "PUT",
|
|
51
|
+
path: QMETRY_PATHS.TESTSUITE.CREATE_UPDATE_TS,
|
|
52
|
+
token,
|
|
53
|
+
project: resolvedProject,
|
|
54
|
+
baseUrl: resolvedBaseUrl,
|
|
55
|
+
body,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Fetches a list of test suites.
|
|
60
|
+
* @throws If `viewId` or `folderPath` are missing/invalid.
|
|
61
|
+
*/
|
|
62
|
+
export async function fetchTestSuites(token, baseUrl, project, payload) {
|
|
63
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
64
|
+
const body = {
|
|
65
|
+
...DEFAULT_FETCH_TESTSUITES_PAYLOAD,
|
|
66
|
+
...payload,
|
|
67
|
+
};
|
|
68
|
+
if (typeof body.viewId !== "number") {
|
|
69
|
+
throw new Error("[fetchTestSuites] Missing or invalid required parameter: 'viewId'.");
|
|
70
|
+
}
|
|
71
|
+
if (typeof body.folderPath !== "string") {
|
|
72
|
+
throw new Error("[fetchTestSuites] Missing or invalid required parameter: 'folderPath'.");
|
|
73
|
+
}
|
|
74
|
+
return qmetryRequest({
|
|
75
|
+
method: "POST",
|
|
76
|
+
path: QMETRY_PATHS.TESTSUITE.GET_TS_LIST,
|
|
77
|
+
token,
|
|
78
|
+
project: resolvedProject,
|
|
79
|
+
baseUrl: resolvedBaseUrl,
|
|
80
|
+
body,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
5
83
|
/**
|
|
6
84
|
* Fetches test suites to link with test case.
|
|
7
85
|
* @throws If `tsFolderID` is missing/invalid.
|
|
@@ -115,3 +193,80 @@ export async function fetchLinkedIssuesByTestCaseRun(token, baseUrl, project, pa
|
|
|
115
193
|
body,
|
|
116
194
|
});
|
|
117
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Link test cases to a test suite.
|
|
198
|
+
* @throws If `tcID` or `tcVersionID` are missing/invalid.
|
|
199
|
+
*/
|
|
200
|
+
export async function linkTestCasesToTestSuite(token, baseUrl, project, payload) {
|
|
201
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
202
|
+
const body = {
|
|
203
|
+
...DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD,
|
|
204
|
+
...payload,
|
|
205
|
+
};
|
|
206
|
+
if (typeof body.tsID !== "number") {
|
|
207
|
+
throw new Error("[linkTestCasesToTestSuite] Missing or invalid required parameter: 'tsID'.");
|
|
208
|
+
}
|
|
209
|
+
if (!body.tcvdIDs) {
|
|
210
|
+
throw new Error("[linkTestCasesToTestSuite] 'tcvdIDs' must be provided.");
|
|
211
|
+
}
|
|
212
|
+
return qmetryRequest({
|
|
213
|
+
method: "PUT",
|
|
214
|
+
path: QMETRY_PATHS.TESTSUITE.LINKED_TESTCASES_TO_TESTSUITE,
|
|
215
|
+
token,
|
|
216
|
+
project: resolvedProject,
|
|
217
|
+
baseUrl: resolvedBaseUrl,
|
|
218
|
+
body,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Requirements Linked test cases to a test suite.
|
|
223
|
+
* @throws If `tcID` or `rqVersionIds` are missing/invalid.
|
|
224
|
+
*/
|
|
225
|
+
export async function reqLinkedTestCasesToTestSuite(token, baseUrl, project, payload) {
|
|
226
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
227
|
+
const body = {
|
|
228
|
+
...DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD,
|
|
229
|
+
...payload,
|
|
230
|
+
};
|
|
231
|
+
if (typeof body.tsID !== "number") {
|
|
232
|
+
throw new Error("[reqLinkedTestCasesToTestSuite] Missing or invalid required parameter: 'tsID'.");
|
|
233
|
+
}
|
|
234
|
+
if (!body.tcvdIDs) {
|
|
235
|
+
throw new Error("[reqLinkedTestCasesToTestSuite] 'tcvdIDs' must be provided.");
|
|
236
|
+
}
|
|
237
|
+
return qmetryRequest({
|
|
238
|
+
method: "PUT",
|
|
239
|
+
path: QMETRY_PATHS.TESTSUITE.LINKED_TESTCASES_TO_TESTSUITE,
|
|
240
|
+
token,
|
|
241
|
+
project: resolvedProject,
|
|
242
|
+
baseUrl: resolvedBaseUrl,
|
|
243
|
+
body,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Link platforms to a test suite.
|
|
248
|
+
* @throws If `qmTsId` or `qmPlatformId` are missing/invalid.
|
|
249
|
+
*/
|
|
250
|
+
export async function linkPlatformsToTestSuite(token, baseUrl, project, payload) {
|
|
251
|
+
const { resolvedBaseUrl, resolvedProject } = resolveDefaults(baseUrl, project);
|
|
252
|
+
const body = {
|
|
253
|
+
...DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD,
|
|
254
|
+
...payload,
|
|
255
|
+
};
|
|
256
|
+
if (typeof body.qmTsId !== "number") {
|
|
257
|
+
throw new Error("[linkPlatformsToTestSuite] Missing or invalid required parameter: 'qmTsId'.");
|
|
258
|
+
}
|
|
259
|
+
if (!body.qmPlatformId ||
|
|
260
|
+
typeof body.qmPlatformId !== "string" ||
|
|
261
|
+
body.qmPlatformId.trim().length === 0) {
|
|
262
|
+
throw new Error("[linkPlatformsToTestSuite] Missing or invalid required parameter: 'qmPlatformId'. It must be a non-empty comma-separated string of Platform IDs.");
|
|
263
|
+
}
|
|
264
|
+
return qmetryRequest({
|
|
265
|
+
method: "PUT",
|
|
266
|
+
path: QMETRY_PATHS.TESTSUITE.LINK_PLATFORMS_TO_TESTSUITE,
|
|
267
|
+
token,
|
|
268
|
+
project: resolvedProject,
|
|
269
|
+
baseUrl: resolvedBaseUrl,
|
|
270
|
+
body,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { ISSUE_TOOLS } from "./issue-tools.js";
|
|
2
|
+
export { PROJECT_TOOLS } from "./project-tools.js";
|
|
3
|
+
export { REQUIREMENT_TOOLS } from "./requirement-tools.js";
|
|
4
|
+
export { TESTCASE_TOOLS } from "./testcase-tools.js";
|
|
5
|
+
export { TESTSUITE_TOOLS } from "./testsuite-tools.js";
|
|
6
|
+
import { ISSUE_TOOLS } from "./issue-tools.js";
|
|
7
|
+
import { PROJECT_TOOLS } from "./project-tools.js";
|
|
8
|
+
import { REQUIREMENT_TOOLS } from "./requirement-tools.js";
|
|
9
|
+
import { TESTCASE_TOOLS } from "./testcase-tools.js";
|
|
10
|
+
import { TESTSUITE_TOOLS } from "./testsuite-tools.js";
|
|
11
|
+
export const TOOLS = [
|
|
12
|
+
...PROJECT_TOOLS,
|
|
13
|
+
...TESTCASE_TOOLS,
|
|
14
|
+
...REQUIREMENT_TOOLS,
|
|
15
|
+
...TESTSUITE_TOOLS,
|
|
16
|
+
...ISSUE_TOOLS,
|
|
17
|
+
];
|