@smartbear/mcp 0.38.0 → 0.40.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/package.json.js +1 -1
- package/dist/pactflow/client/admin-api.js +491 -0
- package/dist/pactflow/client/ai-api.js +139 -0
- package/dist/pactflow/client/contract-api.js +366 -0
- package/dist/pactflow/client/environment-api.js +156 -0
- package/dist/pactflow/client/http-client.js +47 -0
- package/dist/pactflow/client/pacticipant-api.js +288 -0
- package/dist/pactflow/client/webhook-api.js +113 -0
- package/dist/pactflow/client.js +29 -1967
- package/dist/qmetry/client/auto-resolve.js +7 -0
- package/dist/qmetry/client/handlers.js +5 -2
- package/dist/qmetry/client/issues.js +8 -1
- package/dist/qmetry/client/project.js +103 -2
- package/dist/qmetry/client/requirement.js +99 -3
- package/dist/qmetry/client/testcase.js +51 -2
- package/dist/qmetry/client/testsuite.js +7 -1
- package/dist/qmetry/client/tools/issue-tools.js +1 -15
- package/dist/qmetry/client/tools/project-tools.js +2 -2
- package/dist/qmetry/client/tools/requirement-tools.js +124 -11
- package/dist/qmetry/client/tools/testcase-tools.js +116 -56
- package/dist/qmetry/client/tools/testsuite-tools.js +1 -19
- package/dist/qmetry/client/tools/udf-tools.js +15 -4
- package/dist/qmetry/client/udf.js +2 -2
- package/dist/qmetry/client.js +19 -11
- package/dist/qmetry/config/constants.js +3 -0
- package/dist/qmetry/config/rest-endpoints.js +4 -2
- package/dist/qmetry/types/ai-agent.js +8 -4
- package/dist/qmetry/types/common.js +69 -43
- package/dist/qmetry/types/requirements.js +7 -1
- package/dist/qmetry/types/testcase.js +2 -1
- package/dist/qmetry/types/udf.js +5 -12
- package/dist/swagger/client/api.js +29 -4
- package/dist/swagger/client/functional-testing-api.js +56 -27
- package/dist/swagger/client/functional-testing-tools.js +5 -5
- package/dist/swagger/client/functional-testing-types.js +75 -9
- package/dist/swagger/client/functional-testing-url-utils.js +110 -0
- package/dist/swagger/client/registry-types.js +2 -2
- package/dist/swagger/client/tools.js +2 -2
- package/dist/zephyr/client.js +2 -0
- package/dist/zephyr/common/rest-api-schemas.js +345 -4
- package/dist/zephyr/tool/folder/get-folders.js +69 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QMetryToolsHandlers } from "../../config/constants.js";
|
|
2
|
-
import { CreateTestCaseArgsSchema, UpdateTestCaseArgsSchema, TestCaseListArgsSchema, TestCaseDetailsArgsSchema, TestCaseVersionDetailsArgsSchema, TestCaseStepsArgsSchema, TestCaseExecutionsArgsSchema, TestCaseStepsWithUdfArgsSchema } from "../../types/common.js";
|
|
2
|
+
import { CreateTestCaseArgsSchema, UpdateTestCaseArgsSchema, TestCaseListArgsSchema, TestCaseDetailsArgsSchema, TestCaseVersionDetailsArgsSchema, TestCaseStepsArgsSchema, TestCaseExecutionsArgsSchema, TestCaseStepsWithUdfArgsSchema, LinkTestcaseToIssuesArgsSchema } from "../../types/common.js";
|
|
3
3
|
const TESTCASE_TOOLS = [
|
|
4
4
|
{
|
|
5
5
|
title: "Create Test Case",
|
|
@@ -7,7 +7,7 @@ const TESTCASE_TOOLS = [
|
|
|
7
7
|
summary: "Create a new test case in QMetry with steps, metadata, and release/cycle mapping.",
|
|
8
8
|
handler: QMetryToolsHandlers.CREATE_TEST_CASE,
|
|
9
9
|
inputSchema: CreateTestCaseArgsSchema,
|
|
10
|
-
purpose: "REQUIRED WORKFLOW: Before calling this tool, ALWAYS call 'Fetch UDF Layout' (entityType='TC', pageName='ADD') first. That call reveals mandatory UDF fields, system field requirements, and default values to auto-apply. Skipping it causes CO.MANDATORY_FIELDS_MISSING errors. Allows users to create a new test case in QMetry,
|
|
10
|
+
purpose: "REQUIRED WORKFLOW: Before calling this tool, ALWAYS call 'Fetch UDF Layout' (entityType='TC', pageName='ADD') first. That call reveals mandatory UDF fields, system field requirements, and default values to auto-apply. Skipping it causes CO.MANDATORY_FIELDS_MISSING errors. Allows users to create a new test case in QMetry, including steps, custom fields, and release/cycle mapping. Supports all major test case fields and step-level UDFs. For fields like priority, owner, component, etc., fetch their valid values using the project info tool. If tcFolderID is not provided, it will be auto-resolved to the root test case folder using project info.\n\nSTEPS RULE (CRITICAL — apply before every create call):\nInclude 'steps' in the payload UNLESS the user explicitly says not to create steps.\n - SCENARIO 1: User explicitly provides steps → use them as given.\n - SCENARIO 2: User has NOT mentioned steps (and did not say to skip them) → generate meaningful steps from the test case name, description, and context. Use your knowledge to infer logical test steps.\n - SCENARIO 3: User explicitly says NOT to create steps (e.g. 'no steps', 'without steps', 'skip steps') → set skipSteps: true and omit the 'steps' field entirely.\n - NEVER send steps: [] (empty array) — either send at least 1 valid step object or omit steps entirely with skipSteps: true.\nSTEP DEFAULT VALUES: After generating or parsing steps, check 'stepDefaultValues' from Fetch UDF Layout.\n For each step field that has a default value in stepDefaultValues AND the user has not explicitly provided a value for that field in the step: send the default value.\n Do NOT ask the user — auto-apply defaults silently.",
|
|
11
11
|
useCases: [
|
|
12
12
|
"Create a basic test case with just a name and folder",
|
|
13
13
|
"Add detailed steps with custom fields (UDFs) to a test case",
|
|
@@ -20,23 +20,38 @@ const TESTCASE_TOOLS = [
|
|
|
20
20
|
],
|
|
21
21
|
examples: [
|
|
22
22
|
{
|
|
23
|
-
description: "MOST COMMON:
|
|
23
|
+
description: "MOST COMMON: User provides only a name — steps are auto-generated from context.",
|
|
24
24
|
parameters: {
|
|
25
|
-
name: "Login Test Case"
|
|
25
|
+
name: "Login Test Case",
|
|
26
|
+
steps: [
|
|
27
|
+
{ orderId: 1, description: "Navigate to the login page" },
|
|
28
|
+
{ orderId: 2, description: "Enter valid username and password" },
|
|
29
|
+
{ orderId: 3, description: "Click the Login button" },
|
|
30
|
+
{
|
|
31
|
+
orderId: 4,
|
|
32
|
+
description: "Verify successful login and dashboard is shown"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
26
35
|
},
|
|
27
|
-
expectedOutput: "Test case created
|
|
36
|
+
expectedOutput: "Test case created with auto-generated steps inferred from the test case name 'Login Test Case'."
|
|
28
37
|
},
|
|
29
38
|
{
|
|
30
|
-
description: "Create test case with metadata only —
|
|
39
|
+
description: "Create test case with metadata only — steps auto-generated from context",
|
|
31
40
|
parameters: {
|
|
32
41
|
tcFolderID: "102653",
|
|
33
42
|
name: "Login Test Case",
|
|
34
43
|
priority: 2025268,
|
|
35
44
|
testCaseState: 2025271,
|
|
36
45
|
estimatedTime: 3600,
|
|
37
|
-
description: "Verifies login flow"
|
|
46
|
+
description: "Verifies login flow",
|
|
47
|
+
steps: [
|
|
48
|
+
{ orderId: 1, description: "Navigate to the login page" },
|
|
49
|
+
{ orderId: 2, description: "Enter valid credentials" },
|
|
50
|
+
{ orderId: 3, description: "Submit the login form" },
|
|
51
|
+
{ orderId: 4, description: "Verify redirection to the home page" }
|
|
52
|
+
]
|
|
38
53
|
},
|
|
39
|
-
expectedOutput: "Test case created with metadata
|
|
54
|
+
expectedOutput: "Test case created with metadata and auto-generated steps based on description 'Verifies login flow'."
|
|
40
55
|
},
|
|
41
56
|
{
|
|
42
57
|
description: "SCENARIO 1: User explicitly asked for steps — 'create test case with step 1 - Go to login page, step 2 - enter credentials'",
|
|
@@ -93,51 +108,79 @@ const TESTCASE_TOOLS = [
|
|
|
93
108
|
expectedOutput: "Test case created with steps because user explicitly requested steps. All metadata populated."
|
|
94
109
|
},
|
|
95
110
|
{
|
|
96
|
-
description: "SCENARIO
|
|
111
|
+
description: "SCENARIO 3: User explicitly says no steps — 'create a test case without any steps'",
|
|
112
|
+
parameters: {
|
|
113
|
+
name: "Login Test Case",
|
|
114
|
+
skipSteps: true
|
|
115
|
+
},
|
|
116
|
+
expectedOutput: "Test case created with no steps because user explicitly asked to skip them."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
description: "User provides name only — steps auto-generated from test case name context",
|
|
97
120
|
parameters: {
|
|
98
|
-
name: "
|
|
121
|
+
name: "Password Reset Test Case",
|
|
99
122
|
steps: [
|
|
123
|
+
{ orderId: 1, description: "Navigate to the login page" },
|
|
124
|
+
{ orderId: 2, description: "Click on 'Forgot Password' link" },
|
|
100
125
|
{
|
|
101
|
-
orderId:
|
|
102
|
-
description: "
|
|
126
|
+
orderId: 3,
|
|
127
|
+
description: "Enter registered email address and submit the reset form"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
orderId: 4,
|
|
131
|
+
description: "Click reset link from email and set a new password"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
orderId: 5,
|
|
135
|
+
description: "Verify login succeeds with the new password"
|
|
103
136
|
}
|
|
104
137
|
]
|
|
105
138
|
},
|
|
106
|
-
expectedOutput: "Test case created with
|
|
139
|
+
expectedOutput: "Test case created with 5 auto-generated steps inferred from the name 'Password Reset Test Case'. No user-provided steps — LLM generated them from context."
|
|
107
140
|
}
|
|
108
141
|
],
|
|
109
142
|
hints: [
|
|
110
143
|
"╔══════════════════════════════════════════════════════════════════════════════╗",
|
|
111
|
-
"║ STEPS
|
|
144
|
+
"║ STEPS RULE — INCLUDE STEPS UNLESS USER EXPLICITLY ASKS TO SKIP THEM ║",
|
|
112
145
|
"╚══════════════════════════════════════════════════════════════════════════════╝",
|
|
113
146
|
"",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
147
|
+
"Include 'steps' in the payload unless the user explicitly says NOT to create steps.",
|
|
148
|
+
"NEVER send steps: [] (empty array) — either send at least 1 valid step object or omit steps with skipSteps: true.",
|
|
116
149
|
"",
|
|
117
|
-
"
|
|
150
|
+
"HOW TO POPULATE STEPS:",
|
|
118
151
|
"",
|
|
119
|
-
" SCENARIO 1 — User explicitly
|
|
152
|
+
" SCENARIO 1 — User explicitly provides steps in their prompt.",
|
|
120
153
|
" Trigger phrases: 'with steps', 'step 1 -', 'add steps', 'include steps', 'following steps', 'these steps'.",
|
|
121
154
|
" Action: Parse the user's step text into { orderId, description, inputData?, expectedOutcome? } objects.",
|
|
122
155
|
" Example: 'create test case, step 1 - open browser, step 2 - click login'",
|
|
123
156
|
" → steps: [{ orderId: 1, description: 'open browser' }, { orderId: 2, description: 'click login' }]",
|
|
124
157
|
"",
|
|
125
|
-
" SCENARIO 2 —
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"",
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"",
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
158
|
+
" SCENARIO 2 — User does NOT mention steps at all.",
|
|
159
|
+
" Action: Generate meaningful steps based on the test case name, description, and all other context provided.",
|
|
160
|
+
" Use your knowledge of the feature/flow being tested to infer logical, realistic test steps.",
|
|
161
|
+
" Always include 2-5 steps that make sense for the test case.",
|
|
162
|
+
" Example: name='Login Test Case' → steps: [{orderId:1, description:'Navigate to login page'}, {orderId:2, description:'Enter credentials'}, {orderId:3, description:'Submit form'}, {orderId:4, description:'Verify login success'}]",
|
|
163
|
+
"",
|
|
164
|
+
" SCENARIO 3 — User explicitly says NOT to create steps.",
|
|
165
|
+
" Trigger phrases: 'no steps', 'without steps', 'skip steps', 'don\\'t add steps', 'without any steps'.",
|
|
166
|
+
" Action: Set skipSteps: true and omit the 'steps' field entirely from the payload.",
|
|
167
|
+
" Example: 'create test case Login Test Case without steps' → { name: 'Login Test Case', skipSteps: true }",
|
|
168
|
+
"",
|
|
169
|
+
"STEP DEFAULT VALUES — apply after step generation (scenarios 1 and 2 only):",
|
|
170
|
+
" After building the steps array (from user input OR auto-generated), check 'stepDefaultValues' from Fetch UDF Layout.",
|
|
171
|
+
" stepDefaultValues shape: { fieldName: defaultValue } — e.g. { 'lookup19': 5232630 }",
|
|
172
|
+
" For EACH step, for EACH key in stepDefaultValues:",
|
|
173
|
+
" IF the user has NOT explicitly specified a value for that field in the step → set it to the default value.",
|
|
174
|
+
" This applies to step UDF fields (step.UDF) that have defaults configured.",
|
|
175
|
+
" Auto-apply silently — do NOT ask the user.",
|
|
176
|
+
" Example: stepDefaultValues = { status: 5232630 } → every step's UDF.status = 5232630 unless user gave a different value.",
|
|
177
|
+
"",
|
|
178
|
+
"DECISION TABLE:",
|
|
179
|
+
" | Situation | Action |",
|
|
180
|
+
" |------------------------------------|-----------------------------------------------------------------------------|",
|
|
181
|
+
" | User provided steps | Use steps from user's prompt; fill step UDF defaults from stepDefaultValues |",
|
|
182
|
+
" | User did not mention steps | Auto-generate steps from context; fill step UDF defaults from stepDefaultValues |",
|
|
183
|
+
" | User explicitly said NO steps | Set skipSteps: true, omit 'steps' field entirely |",
|
|
141
184
|
"",
|
|
142
185
|
"╚══════════════════════════════════════════════════════════════════════════════╝",
|
|
143
186
|
"",
|
|
@@ -187,13 +230,13 @@ const TESTCASE_TOOLS = [
|
|
|
187
230
|
" Skipping this sweep = missing fields in the created record = user-visible data loss.",
|
|
188
231
|
"╚══════════════════════════════════════════════════════════════════════════╝",
|
|
189
232
|
"",
|
|
190
|
-
"TEST CASE STEPS
|
|
233
|
+
"TEST CASE STEPS — always required (see STEPS RULE above):",
|
|
191
234
|
" stepSystemFields: built-in step fields { name, label, fieldTypeName, isMandatory }",
|
|
192
235
|
" stepFields: step-level UDF fields { name, label, fieldTypeName, isMandatory, listName? }",
|
|
193
|
-
"
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"
|
|
236
|
+
" Mandatory stepFields UDFs (isMandatory=true) must be filled in step.UDF — use stepDefaultValues for defaults, else a placeholder value.",
|
|
237
|
+
" STEP DEFAULT VALUES: use 'stepDefaultValues' object from Fetch UDF Layout — same auto-fill logic as defaultValues.",
|
|
238
|
+
" For EACH key in stepDefaultValues: if user has NOT explicitly provided a value for that step field → auto-apply the default silently.",
|
|
239
|
+
" This applies to all steps (both user-provided and auto-generated).",
|
|
197
240
|
"",
|
|
198
241
|
"DECISION MATRIX:",
|
|
199
242
|
" | isMandatory | Has default | Action |",
|
|
@@ -251,7 +294,7 @@ const TESTCASE_TOOLS = [
|
|
|
251
294
|
"If the user provides a testing type name, fetch project info, find the matching type in customListObjs.testingType[index].name, and use its ID in the payload as testingType. If the name is not found, skip the testingType field (it is not required) and show a user-friendly message: 'Test case created without testing type, as given testing type is not available in the current project.'",
|
|
252
295
|
`Example: If user says 'Create test case with title "High priority test case" and set priority to "Blocker"', first call project info, map 'Blocker' to its ID, and use that ID for the priority field in the create payload. If user says 'set priority to "Urgent"' and 'Urgent' is not found, skip the priority field and show: 'Test case created without priority, as given priority is not available in the current project.'`,
|
|
253
296
|
"tcFolderID is required; use the root folder ID from project info or a specific folder.",
|
|
254
|
-
"STEPS:
|
|
297
|
+
"STEPS: ALWAYS include steps in the payload. If user did not provide steps, auto-generate them from the test case name and context. See STEPS RULE at top of hints.",
|
|
255
298
|
"If the user provides a prompt like 'create test case with steps as step 1 - Go to login page, step 2 - give credential, step 3 - go to test case page, step 4 - create test case', LLM should parse each step and convert it into the steps payload array, mapping each step to an object with orderId, description, and optionally inputData and expectedOutcome.",
|
|
256
299
|
"Example mapping: 'step 1 - Go to login page' → { orderId: 1, description: 'Go to login page' }.",
|
|
257
300
|
"LLM should increment orderId for each step, use the step text as description, and optionally infer inputData/expectedOutcome if provided in the prompt.",
|
|
@@ -975,22 +1018,6 @@ const TESTCASE_TOOLS = [
|
|
|
975
1018
|
parameters: { projectKey: "UT" },
|
|
976
1019
|
expectedOutput: "List of test cases from UT project using UT's specific TC viewId"
|
|
977
1020
|
},
|
|
978
|
-
{
|
|
979
|
-
description: "Get test cases with manual viewId (skip auto-resolution)",
|
|
980
|
-
parameters: { projectKey: "MAC", viewId: 167136, folderPath: "" },
|
|
981
|
-
// This is an example viewId, must be resolved per project Test Case ViewId
|
|
982
|
-
expectedOutput: "Test cases using manually specified viewId 167136"
|
|
983
|
-
},
|
|
984
|
-
{
|
|
985
|
-
description: "List test cases from specific project (ex: project key can be anything (VT, UT, PROJ1, TEST9)",
|
|
986
|
-
parameters: {
|
|
987
|
-
projectKey: "use specific given project key",
|
|
988
|
-
viewId: "fetch specific project given projectKey Test Case ViewId",
|
|
989
|
-
// This is an example viewId, must be resolved per project Test Case ViewId
|
|
990
|
-
folderPath: ""
|
|
991
|
-
},
|
|
992
|
-
expectedOutput: "Test cases using manually specified viewId 167136 or projectKey"
|
|
993
|
-
},
|
|
994
1021
|
{
|
|
995
1022
|
description: "Get test cases by release/cycle filter",
|
|
996
1023
|
parameters: {
|
|
@@ -1388,6 +1415,39 @@ const TESTCASE_TOOLS = [
|
|
|
1388
1415
|
outputDescription: "JSON object with data array (steps with UDF values), filterTemplate (UDF field definitions), columns (visible/hidden column config), total count, and viewId",
|
|
1389
1416
|
readOnly: true,
|
|
1390
1417
|
idempotent: true
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
title: "Link Test Case to Issues",
|
|
1421
|
+
toolset: "Test Cases",
|
|
1422
|
+
summary: "Link one or more defects/issues to a test case by entityKey and issue IDs.",
|
|
1423
|
+
handler: QMetryToolsHandlers.LINK_TESTCASE_TO_ISSUES,
|
|
1424
|
+
inputSchema: LinkTestcaseToIssuesArgsSchema,
|
|
1425
|
+
purpose: "Link defects or issues to a test case using the test case entityKey and an array of numeric issue IDs. This tool enables traceability and defect coverage mapping between issues and test cases.",
|
|
1426
|
+
useCases: [
|
|
1427
|
+
"Link defects/issues to a test case for traceability",
|
|
1428
|
+
"Bulk link multiple issues to a single test case",
|
|
1429
|
+
"Automate defect coverage mapping"
|
|
1430
|
+
],
|
|
1431
|
+
examples: [
|
|
1432
|
+
{
|
|
1433
|
+
description: "Link issues to test case 8d7b-TC-63",
|
|
1434
|
+
parameters: {
|
|
1435
|
+
tcID: "8d7b-TC-63",
|
|
1436
|
+
dfIDs: [2039, 2038, 2037, 1528]
|
|
1437
|
+
},
|
|
1438
|
+
expectedOutput: "Issues linked to test case 8d7b-TC-63 successfully."
|
|
1439
|
+
}
|
|
1440
|
+
],
|
|
1441
|
+
hints: [
|
|
1442
|
+
"To get the tcID, call the 'Fetch Test Cases' tool and use data[<index>].entityKey.",
|
|
1443
|
+
"dfIDs must be an array of numeric issue/defect IDs — resolve them using the 'Fetch Defects or Issues' tool.",
|
|
1444
|
+
"If the user provides a test case entityKey (e.g., 8d7b-TC-63), use it directly as tcID.",
|
|
1445
|
+
"CRITICAL: the parameter name is 'tcID' — do NOT use 'testCaseId' or 'tcId'.",
|
|
1446
|
+
"CRITICAL: the parameter name is 'dfIDs' — do NOT use 'issueIds' or 'defectIds'."
|
|
1447
|
+
],
|
|
1448
|
+
outputDescription: "JSON object with success status and linkage details.",
|
|
1449
|
+
readOnly: false,
|
|
1450
|
+
idempotent: false
|
|
1391
1451
|
}
|
|
1392
1452
|
];
|
|
1393
1453
|
export {
|
|
@@ -287,24 +287,6 @@ const TESTSUITE_TOOLS = [
|
|
|
287
287
|
parameters: { projectKey: "UT" },
|
|
288
288
|
expectedOutput: "List of test suites from UT project using UT's specific TS viewId"
|
|
289
289
|
},
|
|
290
|
-
{
|
|
291
|
-
description: "Get test suites with manual viewId (skip auto-resolution)",
|
|
292
|
-
parameters: { projectKey: "MAC", viewId: 103097, folderPath: "" },
|
|
293
|
-
// This is an example viewId, must be resolved per project TS viewId
|
|
294
|
-
expectedOutput: "Test suites using manually specified viewId 103097"
|
|
295
|
-
// This is an example viewId, must be resolved per project TS viewId
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
description: "List test suites from specific project (ex: project key can be anything (VT, UT, PROJ1, TEST9)",
|
|
299
|
-
parameters: {
|
|
300
|
-
projectKey: "use specific given project key",
|
|
301
|
-
viewId: "fetch specific project given projectKey Test Suite ViewId",
|
|
302
|
-
// auto-resolved
|
|
303
|
-
folderPath: ""
|
|
304
|
-
},
|
|
305
|
-
expectedOutput: "Test suites using manually specified viewId 103097 or projectKey"
|
|
306
|
-
// This is an example viewId, must be resolved per project TS viewId
|
|
307
|
-
},
|
|
308
290
|
{
|
|
309
291
|
description: "Get test suites by release/cycle filter",
|
|
310
292
|
parameters: {
|
|
@@ -457,7 +439,7 @@ const TESTSUITE_TOOLS = [
|
|
|
457
439
|
// This is an example viewId, must be resolved per project TSFS viewId
|
|
458
440
|
"4. Manual viewId only needed if you want to override the automatic resolution",
|
|
459
441
|
"WORKFLOW: System automatically handles project info if tsFolderID or viewId is not provided",
|
|
460
|
-
"PROJECT INFO STRUCTURE:
|
|
442
|
+
"PROJECT INFO STRUCTURE: rootFolders.TS.id contains the root test suite folder ID",
|
|
461
443
|
"PROJECT INFO STRUCTURE: latestViews.TSFS.viewId contains the test suite folder view ID",
|
|
462
444
|
"For sub-folders: Use specific folder IDs if you know them, or call folder listing APIs",
|
|
463
445
|
"FILTER CAPABILITIES: Same as other QMetry list operations",
|
|
@@ -4,17 +4,18 @@ const UDF_TOOLS = [
|
|
|
4
4
|
{
|
|
5
5
|
title: "Fetch UDF Layout",
|
|
6
6
|
toolset: "UDF",
|
|
7
|
-
summary: "Fetch UDF (User Defined Field) definitions for Test Case, Test Suite, or
|
|
7
|
+
summary: "Fetch UDF (User Defined Field) definitions for Test Case, Test Suite, Issue, or Requirement entities. Returns field names, types, fieldIDs, and lookup option IDs. Call this BEFORE creating or updating an entity with UDF values.",
|
|
8
8
|
handler: QMetryToolsHandlers.FETCH_UDF_LAYOUT,
|
|
9
9
|
inputSchema: FetchUdfLayoutArgsSchema,
|
|
10
|
-
purpose: "Discovers the UDF fields configured for a given entity type (TC/TS/IS) in the current QMetry project. For 'ADD' (create): returns field names, types, and list option IDs — no fieldID needed. For 'DETAIL' (update): returns fieldID (projectUserFieldID) required in the UDF update wrapper. Also returns step UDF definitions for Test Cases (stepFields). The 'listOptions' map provides valid IDs for LOOKUPLIST, MULTILOOKUPLIST, and CASCADINGLIST fields. For CASCADINGLIST child options, also call 'Fetch Cascade Child Values' after selecting a parent.",
|
|
10
|
+
purpose: "Discovers the UDF fields configured for a given entity type (TC/TS/IS/RQ) in the current QMetry project. For 'ADD' (create): returns field names, types, and list option IDs — no fieldID needed. For 'DETAIL' (update): returns fieldID (projectUserFieldID) required in the UDF update wrapper. Also returns step UDF definitions for Test Cases (stepFields). The 'listOptions' map provides valid IDs for LOOKUPLIST, MULTILOOKUPLIST, and CASCADINGLIST fields. For CASCADINGLIST child options, also call 'Fetch Cascade Child Values' after selecting a parent.",
|
|
11
11
|
useCases: [
|
|
12
12
|
"Discover UDF fields before creating a Test Case with custom fields",
|
|
13
13
|
"Get fieldIDs before updating a Test Suite's UDF values",
|
|
14
14
|
"Find valid dropdown option IDs for a LOOKUPLIST UDF before setting a value",
|
|
15
15
|
"Identify mandatory UDF fields before creating an Issue",
|
|
16
16
|
"List all step-level UDF fields available for Test Case steps",
|
|
17
|
-
"Get CASCADINGLIST parent option IDs before fetching child values"
|
|
17
|
+
"Get CASCADINGLIST parent option IDs before fetching child values",
|
|
18
|
+
"Discover UDF fields before creating or updating a Requirement"
|
|
18
19
|
],
|
|
19
20
|
examples: [
|
|
20
21
|
{
|
|
@@ -31,10 +32,20 @@ const UDF_TOOLS = [
|
|
|
31
32
|
description: "Get UDF field definitions for creating an Issue",
|
|
32
33
|
parameters: { entityType: "IS", pageName: "ADD" },
|
|
33
34
|
expectedOutput: "{ fields: [{ name: 'TCR_STR', label: 'String Field', fieldTypeName: 'STRING', fieldID: null }, ...], listOptions: {} }"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
description: "Get UDF field definitions for creating a Requirement",
|
|
38
|
+
parameters: { entityType: "RQ", pageName: "ADD" },
|
|
39
|
+
expectedOutput: "{ fields: [{ name: 'rq_custom_field', label: 'Custom Field', fieldTypeName: 'STRING', fieldID: null, isMandatory: false }, ...], listOptions: {} }"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
description: "Get UDF fieldIDs for updating a Requirement",
|
|
43
|
+
parameters: { entityType: "RQ", pageName: "DETAIL" },
|
|
44
|
+
expectedOutput: "{ fields: [{ name: 'rq_dropdown_field', label: 'Dropdown', fieldTypeName: 'LOOKUPLIST', fieldID: 3002, isMandatory: false, listName: 'myListKey' }, ...], listOptions: { myListKey: [{ id: 101, name: 'Option A' }] } }"
|
|
34
45
|
}
|
|
35
46
|
],
|
|
36
47
|
hints: [
|
|
37
|
-
"CALL THIS TOOL FIRST: Before creating or updating TC/TS/IS entities, always call this tool
|
|
48
|
+
"CALL THIS TOOL FIRST: Before creating or updating TC/TS/IS/RQ entities with UDF values, always call this tool to discover field names, types, and valid option IDs.",
|
|
38
49
|
"pageName='ADD': Use before CREATE operations — returns field names + types + list options. fieldID is null (not needed on create).",
|
|
39
50
|
"pageName='DETAIL': Use before UPDATE operations — returns fieldID (projectUserFieldID) required in the UDF wrapper.",
|
|
40
51
|
"WORKFLOW FOR CREATE with UDFs:",
|
|
@@ -260,9 +260,9 @@ async function fetchUdfLayout(token, baseUrl, project, payload) {
|
|
|
260
260
|
baseUrl,
|
|
261
261
|
project
|
|
262
262
|
);
|
|
263
|
-
if (!payload.entityType || !["TC", "TS", "IS"].includes(payload.entityType)) {
|
|
263
|
+
if (!payload.entityType || !["TC", "TS", "IS", "RQ"].includes(payload.entityType)) {
|
|
264
264
|
throw new Error(
|
|
265
|
-
"[fetchUdfLayout] Missing or invalid required parameter: 'entityType'. Must be 'TC', 'TS', or '
|
|
265
|
+
"[fetchUdfLayout] Missing or invalid required parameter: 'entityType'. Must be 'TC', 'TS', 'IS', or 'RQ'."
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
const pageName = payload.pageName ?? "ADD";
|
package/dist/qmetry/client.js
CHANGED
|
@@ -8,7 +8,7 @@ import { TOOLS } from "./client/tools/index.js";
|
|
|
8
8
|
import { fetchUdfLayout } from "./client/udf.js";
|
|
9
9
|
import { QMETRY_DEFAULTS, QMetryToolsHandlers } from "./config/constants.js";
|
|
10
10
|
const ConfigurationSchema = zod__default.object({
|
|
11
|
-
api_key: zod__default.string().
|
|
11
|
+
api_key: zod__default.string().describe(
|
|
12
12
|
"QMetry API key for authentication (not required when using OAuth)"
|
|
13
13
|
),
|
|
14
14
|
base_url: zod__default.string().url().optional().describe(
|
|
@@ -42,7 +42,7 @@ class QmetryClient {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
getToken() {
|
|
45
|
-
|
|
45
|
+
const contextToken = getRequestHeader("Authorization");
|
|
46
46
|
if (contextToken) {
|
|
47
47
|
const token = Array.isArray(contextToken) ? contextToken[0] : contextToken;
|
|
48
48
|
if (token.startsWith("Bearer ")) {
|
|
@@ -50,13 +50,6 @@ class QmetryClient {
|
|
|
50
50
|
}
|
|
51
51
|
return token;
|
|
52
52
|
}
|
|
53
|
-
contextToken = getRequestHeader("Qmetry-Token") || getRequestHeader("apikey");
|
|
54
|
-
if (Array.isArray(contextToken)) {
|
|
55
|
-
contextToken = contextToken[0];
|
|
56
|
-
}
|
|
57
|
-
if (contextToken) {
|
|
58
|
-
return contextToken;
|
|
59
|
-
}
|
|
60
53
|
if (!this.token) throw new Error("Client not configured");
|
|
61
54
|
return this.token;
|
|
62
55
|
}
|
|
@@ -70,7 +63,7 @@ class QmetryClient {
|
|
|
70
63
|
}
|
|
71
64
|
async registerTools(register, _getInput) {
|
|
72
65
|
const resolveContext = (args) => ({
|
|
73
|
-
baseUrl:
|
|
66
|
+
baseUrl: this.endpoint,
|
|
74
67
|
projectKey: args.projectKey ?? this.projectApiKey
|
|
75
68
|
});
|
|
76
69
|
const handleAsync = async (fn) => {
|
|
@@ -215,6 +208,19 @@ class QmetryClient {
|
|
|
215
208
|
]
|
|
216
209
|
};
|
|
217
210
|
}
|
|
211
|
+
const stepDefaults = layout.stepDefaultValues ?? {};
|
|
212
|
+
if (Array.isArray(a.steps) && Object.keys(stepDefaults).length > 0) {
|
|
213
|
+
for (const step of a.steps) {
|
|
214
|
+
if (!step.UDF) step.UDF = {};
|
|
215
|
+
for (const [fieldName, defVal] of Object.entries(
|
|
216
|
+
stepDefaults
|
|
217
|
+
)) {
|
|
218
|
+
if (!(fieldName in step.UDF)) {
|
|
219
|
+
step.UDF[fieldName] = defVal;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
218
224
|
} catch {
|
|
219
225
|
}
|
|
220
226
|
}
|
|
@@ -333,7 +339,9 @@ class QmetryClient {
|
|
|
333
339
|
[QMetryToolsHandlers.UPDATE_TEST_CASE]: "TC",
|
|
334
340
|
[QMetryToolsHandlers.UPDATE_TEST_SUITE]: "TS",
|
|
335
341
|
[QMetryToolsHandlers.CREATE_ISSUE]: "IS",
|
|
336
|
-
[QMetryToolsHandlers.UPDATE_ISSUE]: "IS"
|
|
342
|
+
[QMetryToolsHandlers.UPDATE_ISSUE]: "IS",
|
|
343
|
+
[QMetryToolsHandlers.CREATE_REQUIREMENT]: "RQ",
|
|
344
|
+
[QMetryToolsHandlers.UPDATE_REQUIREMENT]: "RQ"
|
|
337
345
|
};
|
|
338
346
|
const entityTypeForDate = UDF_DATE_PREFLIGHT_ENTITY_MAP[tool.handler];
|
|
339
347
|
if (entityTypeForDate) {
|
|
@@ -70,6 +70,9 @@ const QMetryToolsHandlers = {
|
|
|
70
70
|
FETCH_TEST_CASE_STEPS_WITH_UDF: "getTestCaseStepsWithUdf",
|
|
71
71
|
FETCH_TEST_CASE_EXECUTIONS: "getTestCaseExecutions",
|
|
72
72
|
LINK_REQUIREMENT_TO_TESTCASE: "linkRequirementToTestCase",
|
|
73
|
+
LINK_TESTCASE_TO_ISSUES: "linkTestcaseToIssues",
|
|
74
|
+
CREATE_REQUIREMENT: "createRequirement",
|
|
75
|
+
UPDATE_REQUIREMENT: "updateRequirement",
|
|
73
76
|
FETCH_REQUIREMENTS: "getRequirements",
|
|
74
77
|
FETCH_REQUIREMENT_DETAILS: "getRequirementDetails",
|
|
75
78
|
FETCH_TESTCASES_LINKED_TO_REQUIREMENT: "getTestCasesLinkedToRequirement",
|
|
@@ -18,12 +18,14 @@ const QMETRY_PATHS = {
|
|
|
18
18
|
GET_TC_EXECUTIONS: "/rest/testcases/execution",
|
|
19
19
|
GET_TC_LINKED_TO_RQ: "/rest/testcases/list/forRQ",
|
|
20
20
|
CREATE_UPDATE_TC: "/rest/testcases",
|
|
21
|
-
LINKED_RQ_TO_TC: "/rest/testcases/link/requirements"
|
|
21
|
+
LINKED_RQ_TO_TC: "/rest/testcases/link/requirements",
|
|
22
|
+
LINK_ISSUES_TO_TC: "/rest/testcases/link/issues"
|
|
22
23
|
},
|
|
23
24
|
REQUIREMENT: {
|
|
24
25
|
GET_RQ_LIST: "/rest/requirements/list/viewColumns",
|
|
25
26
|
GET_RQ_DETAILS: "/rest/requirements/detail/data",
|
|
26
|
-
GET_RQ_LINKED_TO_TC: "/rest/requirements/list/forTC"
|
|
27
|
+
GET_RQ_LINKED_TO_TC: "/rest/requirements/list/forTC",
|
|
28
|
+
CREATE_UPDATE_RQ: "/rest/requirements"
|
|
27
29
|
},
|
|
28
30
|
TESTSUITE: {
|
|
29
31
|
CREATE_UPDATE_TS: "/rest/testsuites",
|
|
@@ -2,7 +2,6 @@ import { z } from "zod";
|
|
|
2
2
|
import { CommonFields } from "./common.js";
|
|
3
3
|
const GetGateConfigurationArgsSchema = z.object({
|
|
4
4
|
projectKey: CommonFields.projectKeyOptional,
|
|
5
|
-
baseUrl: CommonFields.baseUrl,
|
|
6
5
|
projectId: z.coerce.number().describe(
|
|
7
6
|
"Numeric project ID for which to fetch the quality gate configuration. This is the internal numeric identifier, not the project key."
|
|
8
7
|
),
|
|
@@ -12,7 +11,6 @@ const GetGateConfigurationArgsSchema = z.object({
|
|
|
12
11
|
});
|
|
13
12
|
const ExecuteGateReportArgsSchema = z.object({
|
|
14
13
|
projectKey: CommonFields.projectKeyOptional,
|
|
15
|
-
baseUrl: CommonFields.baseUrl,
|
|
16
14
|
reportName: z.string().describe("Report name identifier (e.g. 'RR' for Release Readiness)."),
|
|
17
15
|
gateIdentifier: z.string().describe("Gate identifier to execute the report against (e.g. 'GATE1')."),
|
|
18
16
|
projectId: z.coerce.number().describe("Numeric project ID for the report scope."),
|
|
@@ -27,9 +25,15 @@ const ExecuteGateReportArgsSchema = z.object({
|
|
|
27
25
|
});
|
|
28
26
|
const ExportHtmlReportArgsSchema = z.object({
|
|
29
27
|
projectKey: CommonFields.projectKeyOptional,
|
|
30
|
-
baseUrl: CommonFields.baseUrl,
|
|
31
28
|
htmlContent: z.string().describe("HTML content to be exported as a report."),
|
|
32
|
-
fileName: z.string().
|
|
29
|
+
fileName: z.string().max(255).regex(
|
|
30
|
+
/^[a-zA-Z0-9._-]+$/,
|
|
31
|
+
"fileName may only contain letters, digits, '.', '_' and '-' - path separators are not allowed."
|
|
32
|
+
).refine((value) => !value.includes(".."), {
|
|
33
|
+
message: "fileName must not contain '..' sequences."
|
|
34
|
+
}).describe(
|
|
35
|
+
"Name for the exported report file (without extension). Letters, digits, '.', '_' and '-' only - no path separators or '..' sequences."
|
|
36
|
+
)
|
|
33
37
|
});
|
|
34
38
|
export {
|
|
35
39
|
ExecuteGateReportArgsSchema,
|