xray-mcp 1.2.3 → 1.2.4

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.
Files changed (2) hide show
  1. package/dist/xray-client.js +28 -28
  2. package/package.json +1 -1
@@ -111,55 +111,55 @@ export class XrayClient {
111
111
  * Create a new test case using GraphQL mutation
112
112
  */
113
113
  async createTestCase(testCase) {
114
- const mutation = `
115
- mutation CreateTest($jira: JSON!, $testType: String) {
116
- createTest(jira: $jira, testType: $testType) {
117
- test {
114
+ // Step 1: Create the test without testType
115
+ const createMutation = `
116
+ mutation CreateTest($testIssueFields: CreateTestInput!) {
117
+ createTest(testIssueFields: $testIssueFields) {
118
+ testIssue {
118
119
  issueId
119
- jira(fields: ["key"])
120
+ key
120
121
  }
121
122
  warnings
122
123
  }
123
124
  }
124
125
  `;
125
- const jiraFields = {
126
- fields: {
127
- project: {
128
- key: testCase.projectKey
129
- },
130
- summary: testCase.summary,
131
- issuetype: {
132
- name: 'Test'
133
- }
134
- }
126
+ const testIssueFields = {
127
+ projectKey: testCase.projectKey,
128
+ summary: testCase.summary
135
129
  };
136
130
  if (testCase.description) {
137
- jiraFields.fields.description = testCase.description;
131
+ testIssueFields.description = testCase.description;
138
132
  }
139
133
  if (testCase.labels && testCase.labels.length > 0) {
140
- jiraFields.fields.labels = testCase.labels;
134
+ testIssueFields.labels = testCase.labels;
141
135
  }
142
136
  if (testCase.priority) {
143
- jiraFields.fields.priority = { name: testCase.priority };
137
+ testIssueFields.priority = testCase.priority;
144
138
  }
145
- const variables = {
146
- jira: jiraFields
147
- };
139
+ const createResult = await this.graphqlRequest(createMutation, { testIssueFields });
140
+ const issueId = createResult.createTest.testIssue.issueId;
141
+ const issueKey = createResult.createTest.testIssue.key;
142
+ // Step 2: Update test type if specified
148
143
  if (testCase.testType) {
149
144
  // Map "Manual" to "Unstructured" for ADO migration compatibility
150
- // add_manual_test_steps only works with Unstructured test type
151
145
  let xrayTestType = testCase.testType;
152
146
  if (testCase.testType === 'Manual') {
153
147
  xrayTestType = 'Unstructured';
154
148
  }
155
- // Pass as plain string, not object
156
- variables.testType = xrayTestType;
149
+ const updateTypeMutation = `
150
+ mutation UpdateTestType($issueId: String!, $testType: UpdateTestTypeInput!) {
151
+ updateTestType(issueId: $issueId, testType: $testType)
152
+ }
153
+ `;
154
+ await this.graphqlRequest(updateTypeMutation, {
155
+ issueId,
156
+ testType: { name: xrayTestType }
157
+ });
157
158
  }
158
- const result = await this.graphqlRequest(mutation, variables);
159
159
  return {
160
- id: result.createTest.test.issueId,
161
- key: result.createTest.test.jira.key,
162
- self: `https://your-jira-instance.atlassian.net/browse/${result.createTest.test.jira.key}`
160
+ id: issueId,
161
+ key: issueKey,
162
+ self: `https://your-jira-instance.atlassian.net/browse/${issueKey}`
163
163
  };
164
164
  }
165
165
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xray-mcp",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {