@smartbear/mcp 0.36.0 → 0.37.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.
@@ -1,4 +1,4 @@
1
- const version = "0.36.0";
1
+ const version = "0.37.0";
2
2
  const config = { "mcpServerName": "SmartBear MCP Server" };
3
3
  const packageJson = {
4
4
  version,
@@ -5,6 +5,11 @@ const AUTO_RESOLVE_MODULES = [
5
5
  viewIdPath: "latestViews.TC.viewId",
6
6
  moduleName: "Test Cases"
7
7
  },
8
+ {
9
+ handler: QMetryToolsHandlers.FETCH_TEST_CASE_STEPS_WITH_UDF,
10
+ viewIdPath: "latestViews.TCS.viewId",
11
+ moduleName: "Test Case Steps"
12
+ },
8
13
  {
9
14
  handler: QMetryToolsHandlers.CREATE_TEST_CASE,
10
15
  folderIdPath: "rootFolders.TC.id",
@@ -0,0 +1,104 @@
1
+ const MONTH_ABBR = [
2
+ "Jan",
3
+ "Feb",
4
+ "Mar",
5
+ "Apr",
6
+ "May",
7
+ "Jun",
8
+ "Jul",
9
+ "Aug",
10
+ "Sep",
11
+ "Oct",
12
+ "Nov",
13
+ "Dec"
14
+ ];
15
+ function parseDateFlexible(dateStr, projectFormat) {
16
+ if (!dateStr || typeof dateStr !== "string") return null;
17
+ const s = dateStr.trim();
18
+ let m = s.match(/^(\d{4})-(\d{2})-(\d{2})$/);
19
+ if (m) return { year: +m[1], month: +m[2], day: +m[3] };
20
+ m = s.match(/^(\d{1,2})-([A-Za-z]{3})-(\d{4})$/);
21
+ if (m) {
22
+ const monthIdx = MONTH_ABBR.findIndex(
23
+ (mo) => mo.toLowerCase() === m[2].toLowerCase()
24
+ );
25
+ if (monthIdx >= 0) return { year: +m[3], month: monthIdx + 1, day: +m[1] };
26
+ }
27
+ m = s.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/);
28
+ if (m) {
29
+ const a = +m[1], b = +m[2], year = +m[3];
30
+ if (a > 12 && b <= 12) return { year, month: b, day: a };
31
+ if (b > 12 && a <= 12) return { year, month: a, day: b };
32
+ if (a >= 1 && a <= 31 && b >= 1 && b <= 12) {
33
+ if (projectFormat?.startsWith("MM")) return { year, month: a, day: b };
34
+ return { year, month: b, day: a };
35
+ }
36
+ if (b >= 1 && b <= 31 && a >= 1 && a <= 12)
37
+ return { year, month: a, day: b };
38
+ }
39
+ return null;
40
+ }
41
+ function formatDateToProjectFormat(parsed, uniqueValue) {
42
+ const yyyy = String(parsed.year).padStart(4, "0");
43
+ const MM = String(parsed.month).padStart(2, "0");
44
+ const dd = String(parsed.day).padStart(2, "0");
45
+ const MMM = MONTH_ABBR[parsed.month - 1] ?? "Jan";
46
+ switch (uniqueValue) {
47
+ case "yyyy-MM-dd":
48
+ return `${yyyy}-${MM}-${dd}`;
49
+ case "MM-dd-yyyy":
50
+ return `${MM}-${dd}-${yyyy}`;
51
+ case "dd-MM-yyyy":
52
+ return `${dd}-${MM}-${yyyy}`;
53
+ case "dd-MMM-yyyy":
54
+ return `${dd}-${MMM}-${yyyy}`;
55
+ default:
56
+ return `${yyyy}-${MM}-${dd}`;
57
+ }
58
+ }
59
+ function resolveProjectDateFormat(projectInfo) {
60
+ const formatId = projectInfo?.dateTimeFormatID;
61
+ const formats = projectInfo?.dateTimeFormatNew ?? [];
62
+ return formats.find((f) => f.id === formatId)?.unique_value ?? "yyyy-MM-dd";
63
+ }
64
+ function normalizeDateFieldsInArgs(a, datetimePickerFieldNames, targetFormat) {
65
+ if (a.udfFields && typeof a.udfFields === "object") {
66
+ for (const [key, val] of Object.entries(a.udfFields)) {
67
+ if (datetimePickerFieldNames.has(key) && typeof val === "string") {
68
+ const parsed = parseDateFlexible(val, targetFormat);
69
+ if (parsed)
70
+ a.udfFields[key] = formatDateToProjectFormat(parsed, targetFormat);
71
+ }
72
+ }
73
+ }
74
+ if (Array.isArray(a.steps)) {
75
+ for (const step of a.steps) {
76
+ if (step?.UDF && typeof step.UDF === "object") {
77
+ for (const [key, val] of Object.entries(step.UDF)) {
78
+ if (datetimePickerFieldNames.has(key) && typeof val === "string") {
79
+ const parsed = parseDateFlexible(val, targetFormat);
80
+ if (parsed)
81
+ step.UDF[key] = formatDateToProjectFormat(parsed, targetFormat);
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ function extractDatetimePickerFieldNames(layout) {
89
+ const names = /* @__PURE__ */ new Set();
90
+ for (const field of layout?.fields ?? []) {
91
+ if (field.fieldTypeName === "DATETIMEPICKER") names.add(field.name);
92
+ }
93
+ for (const field of layout?.stepFields ?? []) {
94
+ if (field.fieldTypeName === "DATETIMEPICKER") names.add(field.name);
95
+ }
96
+ return names;
97
+ }
98
+ export {
99
+ extractDatetimePickerFieldNames,
100
+ formatDateToProjectFormat,
101
+ normalizeDateFieldsInArgs,
102
+ parseDateFlexible,
103
+ resolveProjectDateFormat
104
+ };
@@ -1,12 +1,12 @@
1
1
  import { QMetryToolsHandlers } from "../config/constants.js";
2
2
  import { exportHtmlReport, executeGateReport, getGateConfiguration } from "./ai-agent.js";
3
3
  import { getAutomationStatus, importAutomationResults } from "./automation.js";
4
- import { fetchIssueExecutions, linkIssuesToTestcaseRun, fetchIssues, updateIssue, createIssue, fetchIssuesLinkedToTestCase } from "./issues.js";
4
+ import { fetchIssueExecutions, linkIssuesToTestcaseRun, fetchIssueDetails, fetchIssues, updateIssue, createIssue, fetchIssuesLinkedToTestCase } from "./issues.js";
5
5
  import { updateCycle, createCycle, createRelease, getPlatforms, getBuilds, getReleasesCycles, getProjectInfo, getProjects } from "./project.js";
6
6
  import { fetchRequirementsLinkedToTestCase, fetchRequirementDetails, fetchRequirements } from "./requirement.js";
7
- import { fetchTestCasesLinkedToRequirement, linkRequirementToTestCase, fetchTestCaseExecutions, fetchTestCaseSteps, fetchTestCaseVersionDetails, fetchTestCaseDetails, fetchTestCases, updateTestCase, createTestCases } from "./testcase.js";
8
- import { linkPlatformsToTestSuite, fetchLinkedIssuesByTestCaseRun, fetchTestCaseRunsByTestSuiteRun, bulkUpdateExecutionStatus, fetchExecutionsByTestSuite, fetchTestCasesByTestSuite, reqLinkedTestCasesToTestSuite, linkTestCasesToTestSuite, fetchTestSuitesForTestCase, fetchTestSuites, updateTestSuite, createTestSuites } from "./testsuite.js";
9
- import { fetchCascadeChildValues, fetchTestRunUdfValues, fetchTestRunUdfMetadata, bulkUpdateTestRunUdfs, fetchUdfModules, fetchUdfFieldTypes } from "./udf.js";
7
+ import { fetchTestCasesLinkedToRequirement, linkRequirementToTestCase, fetchTestCaseExecutions, fetchTestCaseStepsWithUdf, fetchTestCaseSteps, fetchTestCaseVersionDetails, fetchTestCaseDetails, fetchTestCases, updateTestCase, createTestCases } from "./testcase.js";
8
+ import { linkPlatformsToTestSuite, fetchLinkedIssuesByTestCaseRun, fetchTestCaseRunsByTestSuiteRun, bulkUpdateExecutionStatus, fetchExecutionsByTestSuite, fetchTestCasesByTestSuite, reqLinkedTestCasesToTestSuite, linkTestCasesToTestSuite, fetchTestSuitesForTestCase, fetchTestSuiteDetails, fetchTestSuites, updateTestSuite, createTestSuites } from "./testsuite.js";
9
+ import { fetchUdfLayout, fetchCascadeChildValues, fetchTestRunUdfValues, fetchTestRunUdfMetadata, bulkUpdateTestRunUdfs, fetchUdfModules, fetchUdfFieldTypes } from "./udf.js";
10
10
  const QMETRY_HANDLER_MAP = {
11
11
  [QMetryToolsHandlers.FETCH_PROJECTS]: getProjects,
12
12
  [QMetryToolsHandlers.SET_PROJECT_INFO]: getProjectInfo,
@@ -23,6 +23,7 @@ const QMETRY_HANDLER_MAP = {
23
23
  [QMetryToolsHandlers.FETCH_TEST_CASE_DETAILS]: fetchTestCaseDetails,
24
24
  [QMetryToolsHandlers.FETCH_TEST_CASE_VERSION_DETAILS]: fetchTestCaseVersionDetails,
25
25
  [QMetryToolsHandlers.FETCH_TEST_CASE_STEPS]: fetchTestCaseSteps,
26
+ [QMetryToolsHandlers.FETCH_TEST_CASE_STEPS_WITH_UDF]: fetchTestCaseStepsWithUdf,
26
27
  [QMetryToolsHandlers.FETCH_TEST_CASE_EXECUTIONS]: fetchTestCaseExecutions,
27
28
  [QMetryToolsHandlers.LINK_REQUIREMENT_TO_TESTCASE]: linkRequirementToTestCase,
28
29
  [QMetryToolsHandlers.FETCH_REQUIREMENTS]: fetchRequirements,
@@ -32,6 +33,7 @@ const QMETRY_HANDLER_MAP = {
32
33
  [QMetryToolsHandlers.CREATE_TEST_SUITE]: createTestSuites,
33
34
  [QMetryToolsHandlers.UPDATE_TEST_SUITE]: updateTestSuite,
34
35
  [QMetryToolsHandlers.FETCH_TEST_SUITES]: fetchTestSuites,
36
+ [QMetryToolsHandlers.FETCH_TEST_SUITE_DETAILS]: fetchTestSuiteDetails,
35
37
  [QMetryToolsHandlers.FETCH_TESTSUITES_FOR_TESTCASE]: fetchTestSuitesForTestCase,
36
38
  [QMetryToolsHandlers.LINK_TESTCASES_TO_TESTSUITE]: linkTestCasesToTestSuite,
37
39
  [QMetryToolsHandlers.REQUIREMENTS_LINKED_TESTCASES_TO_TESTSUITE]: reqLinkedTestCasesToTestSuite,
@@ -44,6 +46,7 @@ const QMETRY_HANDLER_MAP = {
44
46
  [QMetryToolsHandlers.CREATE_ISSUE]: createIssue,
45
47
  [QMetryToolsHandlers.UPDATE_ISSUE]: updateIssue,
46
48
  [QMetryToolsHandlers.FETCH_ISSUES]: fetchIssues,
49
+ [QMetryToolsHandlers.FETCH_ISSUE_DETAILS]: fetchIssueDetails,
47
50
  [QMetryToolsHandlers.LINK_ISSUES_TO_TESTCASE_RUN]: linkIssuesToTestcaseRun,
48
51
  [QMetryToolsHandlers.LINK_PLATFORMS_TO_TESTSUITE]: linkPlatformsToTestSuite,
49
52
  [QMetryToolsHandlers.IMPORT_AUTOMATION_RESULTS]: importAutomationResults,
@@ -57,7 +60,8 @@ const QMETRY_HANDLER_MAP = {
57
60
  [QMetryToolsHandlers.FETCH_CASCADE_CHILD_VALUES]: fetchCascadeChildValues,
58
61
  [QMetryToolsHandlers.FETCH_GATE_CONFIGURATION]: getGateConfiguration,
59
62
  [QMetryToolsHandlers.EXECUTE_GATE_REPORT]: executeGateReport,
60
- [QMetryToolsHandlers.EXPORT_HTML_REPORT]: exportHtmlReport
63
+ [QMetryToolsHandlers.EXPORT_HTML_REPORT]: exportHtmlReport,
64
+ [QMetryToolsHandlers.FETCH_UDF_LAYOUT]: fetchUdfLayout
61
65
  };
62
66
  export {
63
67
  QMETRY_HANDLER_MAP
@@ -1,15 +1,18 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
2
  import { DEFAULT_LINK_ISSUES_TO_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_ISSUES_PAYLOAD, DEFAULT_UPDATE_ISSUE_PAYLOAD, DEFAULT_CREATE_ISSUE_PAYLOAD, DEFAULT_FETCH_ISSUES_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_ISSUE_EXECUTIONS_PAYLOAD } from "../types/issues.js";
3
3
  import { qmetryRequest } from "./api/client-api.js";
4
+ import { fetchUdfLayout } from "./udf.js";
4
5
  import { resolveDefaults } from "./utils.js";
5
6
  async function createIssue(token, baseUrl, project, payload) {
6
7
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
7
8
  baseUrl,
8
9
  project
9
10
  );
11
+ const { udfFields, ...restPayload } = payload;
10
12
  const body = {
11
13
  ...DEFAULT_CREATE_ISSUE_PAYLOAD,
12
- ...payload
14
+ ...udfFields ?? {},
15
+ ...restPayload
13
16
  };
14
17
  if (typeof body.issueType !== "number") {
15
18
  throw new Error(
@@ -26,6 +29,50 @@ async function createIssue(token, baseUrl, project, payload) {
26
29
  "[createIssue] Missing or invalid required parameter: 'summary'."
27
30
  );
28
31
  }
32
+ try {
33
+ const layout = await fetchUdfLayout(
34
+ token,
35
+ resolvedBaseUrl,
36
+ resolvedProject,
37
+ {
38
+ entityType: "IS",
39
+ pageName: "ADD"
40
+ }
41
+ );
42
+ const systemFieldTypeMap = Object.fromEntries(
43
+ layout.systemFields.map((f) => [f.name, f.fieldTypeName])
44
+ );
45
+ const systemFieldNames = new Set(Object.keys(systemFieldTypeMap));
46
+ for (const [fieldName, defaultValue] of Object.entries(
47
+ layout.defaultValues
48
+ )) {
49
+ if (body[fieldName] !== void 0 && body[fieldName] !== null) continue;
50
+ if (systemFieldNames.has(fieldName) && systemFieldTypeMap[fieldName] === "MULTILOOKUPLIST" && typeof defaultValue === "number") {
51
+ body[fieldName] = [defaultValue];
52
+ } else {
53
+ body[fieldName] = defaultValue;
54
+ }
55
+ }
56
+ const missing = [];
57
+ const allMandatory = [
58
+ ...layout.systemFields.filter((f) => f.isMandatory),
59
+ ...layout.fields.filter((f) => f.isMandatory)
60
+ ];
61
+ for (const field of allMandatory) {
62
+ const val = body[field.name];
63
+ const absent = val === void 0 || val === null || val === "" || Array.isArray(val) && val.length === 0;
64
+ if (absent) {
65
+ missing.push(field.label ?? field.name);
66
+ }
67
+ }
68
+ if (missing.length > 0) {
69
+ throw new Error(
70
+ `[createIssue] Missing mandatory fields: ${missing.join(", ")}. Provide values for these fields before creating the issue.`
71
+ );
72
+ }
73
+ } catch (err) {
74
+ if (err?.message?.startsWith("[createIssue]")) throw err;
75
+ }
29
76
  return qmetryRequest({
30
77
  method: "POST",
31
78
  path: QMETRY_PATHS.ISSUES.CREATE_UPDATE_ISSUE,
@@ -40,9 +87,11 @@ async function updateIssue(token, baseUrl, project, payload) {
40
87
  baseUrl,
41
88
  project
42
89
  );
90
+ const { udfFields, ...restPayload } = payload;
43
91
  const body = {
44
92
  ...DEFAULT_UPDATE_ISSUE_PAYLOAD,
45
- ...payload
93
+ ...udfFields ?? {},
94
+ ...restPayload
46
95
  };
47
96
  if (typeof body.DefectId !== "number") {
48
97
  throw new Error(
@@ -140,6 +189,7 @@ async function fetchIssueExecutions(token, baseUrl, project, payload) {
140
189
  };
141
190
  }
142
191
  let fieldDefs = {};
192
+ let lookupOptions = {};
143
193
  try {
144
194
  const meta = await qmetryRequest({
145
195
  method: "POST",
@@ -154,6 +204,7 @@ async function fetchIssueExecutions(token, baseUrl, project, payload) {
154
204
  }
155
205
  });
156
206
  fieldDefs = meta.qmUDF?.TCR ?? {};
207
+ lookupOptions = meta.qmUDFList ?? {};
157
208
  } catch {
158
209
  }
159
210
  const hasMetadata = Object.keys(fieldDefs).length > 0;
@@ -161,10 +212,14 @@ async function fetchIssueExecutions(token, baseUrl, project, payload) {
161
212
  const enrichedData = rows.map((row) => {
162
213
  let rawUdfs = {};
163
214
  if (row.udfjson) {
164
- try {
165
- rawUdfs = JSON.parse(row.udfjson);
166
- } catch {
167
- rawUdfs = {};
215
+ if (typeof row.udfjson === "string") {
216
+ try {
217
+ rawUdfs = JSON.parse(row.udfjson);
218
+ } catch {
219
+ rawUdfs = {};
220
+ }
221
+ } else {
222
+ rawUdfs = row.udfjson;
168
223
  }
169
224
  }
170
225
  let testRunUdfs;
@@ -181,12 +236,43 @@ async function fetchIssueExecutions(token, baseUrl, project, payload) {
181
236
  return `&${entity};`;
182
237
  }).replace(/\s+/g, " ").trim();
183
238
  }
239
+ const listName = def.qmListName;
240
+ const options = listName ? lookupOptions[listName] ?? [] : [];
241
+ let valueResolved = false;
242
+ if (options.length > 0) {
243
+ if (typeof value === "string") {
244
+ const match = options.find((o) => o.uniqueLabel === value);
245
+ if (match) {
246
+ value = match.name;
247
+ valueResolved = true;
248
+ }
249
+ } else if (Array.isArray(value)) {
250
+ let allResolved = true;
251
+ value = value.map((v) => {
252
+ const match = options.find((o) => o.uniqueLabel === v);
253
+ if (!match) allResolved = false;
254
+ return match ? match.name : v;
255
+ });
256
+ valueResolved = allResolved;
257
+ } else {
258
+ valueResolved = true;
259
+ }
260
+ }
261
+ const isLookupField = [
262
+ "LOOKUPLIST",
263
+ "MULTILOOKUPLIST",
264
+ "CASCADINGLIST"
265
+ ].includes(def.fieldTypeName ?? "");
184
266
  return {
185
267
  name: def.name,
186
268
  label: def.fieldLabel,
187
269
  fieldID: def.projectUserFieldID,
188
270
  fieldType: def.fieldTypeName,
189
- value
271
+ value,
272
+ ...isLookupField && !valueResolved && value !== null ? {
273
+ _rawValue: true,
274
+ _note: "Lookup options unavailable — value is raw internal ID."
275
+ } : {}
190
276
  };
191
277
  });
192
278
  } else {
@@ -243,8 +329,39 @@ async function linkIssuesToTestcaseRun(token, baseUrl, project, payload) {
243
329
  body
244
330
  });
245
331
  }
332
+ async function fetchIssueDetails(token, baseUrl, project, payload) {
333
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
334
+ baseUrl,
335
+ project
336
+ );
337
+ if (typeof payload.defectId !== "number" || payload.defectId <= 0) {
338
+ throw new Error(
339
+ "[fetchIssueDetails] Missing or invalid required parameter: 'defectId'."
340
+ );
341
+ }
342
+ const url = QMETRY_PATHS.ISSUES.GET_ISSUE_DETAIL + payload.defectId;
343
+ const extraHeaders = {
344
+ action: "detail",
345
+ screenname: "ISSUE"
346
+ };
347
+ if (typeof payload.scopeId === "number") {
348
+ extraHeaders["scope"] = String(payload.scopeId);
349
+ }
350
+ if (typeof payload.orgCode === "string") {
351
+ extraHeaders["orgcode"] = payload.orgCode;
352
+ }
353
+ return qmetryRequest({
354
+ method: "GET",
355
+ path: url,
356
+ token,
357
+ project: resolvedProject,
358
+ baseUrl: resolvedBaseUrl,
359
+ extraHeaders
360
+ });
361
+ }
246
362
  export {
247
363
  createIssue,
364
+ fetchIssueDetails,
248
365
  fetchIssueExecutions,
249
366
  fetchIssues,
250
367
  fetchIssuesLinkedToTestCase,
@@ -7,9 +7,11 @@ async function createTestCases(token, baseUrl, project, payload) {
7
7
  baseUrl,
8
8
  project
9
9
  );
10
+ const { udfFields, ...restPayload } = payload;
10
11
  const body = {
11
12
  ...DEFAULT_CREATE_TESTCASES_PAYLOAD,
12
- ...payload
13
+ ...udfFields ?? {},
14
+ ...restPayload
13
15
  };
14
16
  if (typeof body.tcFolderID !== "string") {
15
17
  throw new Error(
@@ -35,9 +37,11 @@ async function updateTestCase(token, baseUrl, project, payload) {
35
37
  baseUrl,
36
38
  project
37
39
  );
40
+ const { udfFields, ...restPayload } = payload;
38
41
  const body = {
39
42
  ...DEFAULT_UPDATE_TESTCASES_PAYLOAD,
40
- ...payload
43
+ ...udfFields ?? {},
44
+ ...restPayload
41
45
  };
42
46
  if (typeof body.tcID !== "number") {
43
47
  throw new Error(
@@ -160,6 +164,35 @@ async function fetchTestCaseSteps(token, baseUrl, project, payload) {
160
164
  body
161
165
  });
162
166
  }
167
+ async function fetchTestCaseStepsWithUdf(token, baseUrl, project, payload) {
168
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
169
+ baseUrl,
170
+ project
171
+ );
172
+ if (typeof payload.tcID !== "number") {
173
+ throw new Error(
174
+ "[fetchTestCaseStepsWithUdf] Missing or invalid required parameter: 'tcID'."
175
+ );
176
+ }
177
+ const body = {
178
+ tcID: String(payload.tcID),
179
+ limit: payload.limit ?? 30,
180
+ start: payload.start ?? 0,
181
+ page: payload.page ?? 1,
182
+ version: payload.version ?? 1,
183
+ gridName: payload.gridName ?? "TCSTEPLIST",
184
+ ...payload.viewId !== void 0 ? { viewId: payload.viewId } : {}
185
+ };
186
+ return qmetryRequest({
187
+ method: "POST",
188
+ path: QMETRY_PATHS.TESTCASE.GET_TC_STEPS_WITH_UDF,
189
+ token,
190
+ project: resolvedProject,
191
+ baseUrl: resolvedBaseUrl,
192
+ body,
193
+ extraHeaders: { action: "fetch-steps", screenname: "EXECUTION RUN" }
194
+ });
195
+ }
163
196
  async function fetchTestCasesLinkedToRequirement(token, baseUrl, project, payload) {
164
197
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
165
198
  baseUrl,
@@ -325,6 +358,7 @@ export {
325
358
  fetchTestCaseDetails,
326
359
  fetchTestCaseExecutions,
327
360
  fetchTestCaseSteps,
361
+ fetchTestCaseStepsWithUdf,
328
362
  fetchTestCaseVersionDetails,
329
363
  fetchTestCases,
330
364
  fetchTestCasesLinkedToRequirement,
@@ -7,9 +7,11 @@ async function createTestSuites(token, baseUrl, project, payload) {
7
7
  baseUrl,
8
8
  project
9
9
  );
10
+ const { udfFields, ...restPayload } = payload;
10
11
  const body = {
11
12
  ...DEFAULT_CREATE_TESTSUITE_PAYLOAD,
12
- ...payload
13
+ ...udfFields ?? {},
14
+ ...restPayload
13
15
  };
14
16
  if (typeof body.parentFolderId !== "string") {
15
17
  throw new Error(
@@ -35,9 +37,11 @@ async function updateTestSuite(token, baseUrl, project, payload) {
35
37
  baseUrl,
36
38
  project
37
39
  );
40
+ const { udfFields, ...restPayload } = payload;
38
41
  const body = {
39
42
  ...DEFAULT_UPDATE_TESTSUITE_PAYLOAD,
40
- ...payload
43
+ ...udfFields ?? {},
44
+ ...restPayload
41
45
  };
42
46
  if (typeof body.id !== "number") {
43
47
  throw new Error(
@@ -343,6 +347,26 @@ async function bulkUpdateExecutionStatus(token, baseUrl, project, payload) {
343
347
  body
344
348
  });
345
349
  }
350
+ async function fetchTestSuiteDetails(token, baseUrl, project, payload) {
351
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
352
+ baseUrl,
353
+ project
354
+ );
355
+ if (typeof payload.id !== "number" || payload.id <= 0) {
356
+ throw new Error(
357
+ "[fetchTestSuiteDetails] Missing or invalid required parameter: 'id'."
358
+ );
359
+ }
360
+ return qmetryRequest({
361
+ method: "POST",
362
+ path: QMETRY_PATHS.TESTSUITE.GET_TS_DETAIL,
363
+ token,
364
+ project: resolvedProject,
365
+ baseUrl: resolvedBaseUrl,
366
+ body: { scope: payload.scope ?? "project", id: payload.id },
367
+ extraHeaders: { action: "detail-tab", screenname: "TESTSUITE" }
368
+ });
369
+ }
346
370
  export {
347
371
  bulkUpdateExecutionStatus,
348
372
  createTestSuites,
@@ -350,6 +374,7 @@ export {
350
374
  fetchLinkedIssuesByTestCaseRun,
351
375
  fetchTestCaseRunsByTestSuiteRun,
352
376
  fetchTestCasesByTestSuite,
377
+ fetchTestSuiteDetails,
353
378
  fetchTestSuites,
354
379
  fetchTestSuitesForTestCase,
355
380
  linkPlatformsToTestSuite,