qase-javascript-commons 2.0.0-beta.10 → 2.0.0-beta.12

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/changelog.md CHANGED
@@ -1,3 +1,20 @@
1
+ # qase-javascript-commons@2.0.0-beta.12
2
+
3
+ ## What's new
4
+
5
+ Fixed an issue when the result has empty step action. Now the reporter will mark such steps as "Unnamed step" and will
6
+ log a warning message.
7
+
8
+ # qase-javascript-commons@2.0.0-beta.11
9
+
10
+ ## What's new
11
+
12
+ * The `useV2` option in the reporter's configuration will now enable using the experimental v2 API.
13
+ Before this fix, v1 API was used despite the configuration.
14
+
15
+ * Attachments from test steps will now be uploaded to Qase.
16
+ Before this fix, the reporter uploaded only the attachments made outside of any step scope.
17
+
1
18
  # qase-javascript-commons@2.0.0-beta.10
2
19
 
3
20
  ## What's new
package/dist/qase.js CHANGED
@@ -252,7 +252,7 @@ class QaseReporter {
252
252
  const { frameworkPackage, frameworkName, reporterName, environment, report = {}, testops = {}, } = options;
253
253
  switch (mode) {
254
254
  case options_1.ModeEnum.testops: {
255
- const { api: { token, headers, ...api } = {}, project, run: { title, description, ...run } = {}, plan = {}, batch = {}, uploadAttachments, } = testops;
255
+ const { api: { token, headers, ...api } = {}, project, run: { title, description, ...run } = {}, plan = {}, batch = {}, useV2, uploadAttachments, } = testops;
256
256
  if (!token) {
257
257
  throw new Error(`Either "testops.api.token" parameter or "${env_1.EnvApiEnum.token}" environment variable is required in "testops" mode`);
258
258
  }
@@ -277,6 +277,7 @@ class QaseReporter {
277
277
  },
278
278
  plan,
279
279
  batch,
280
+ useV2,
280
281
  }, apiClient, typeof environment === 'number' ? environment : undefined);
281
282
  }
282
283
  case options_1.ModeEnum.report: {
@@ -147,16 +147,19 @@ export declare class TestOpsReporter extends AbstractReporter {
147
147
  private getRelation;
148
148
  /**
149
149
  * @param {TestStepType[]} steps
150
+ * @param testTitle
150
151
  * @returns Promise<ResultStep[]>
151
152
  * @private
152
153
  */
153
154
  private transformSteps;
154
155
  /**
155
156
  * @param {TestStepType[]} steps
157
+ * @param testTitle
156
158
  * @returns Promise<TestStepResultCreate[]>
157
159
  * @private
158
160
  */
159
161
  private transformStepsV1;
162
+ private logEmptyStep;
160
163
  /**
161
164
  * @param {number} runId
162
165
  * @returns {Promise<void>}
@@ -146,7 +146,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
146
146
  */
147
147
  async transformTestResult(result) {
148
148
  const attachments = await this.uploadAttachments(result.attachments);
149
- const steps = await this.transformSteps(result.steps);
149
+ const steps = await this.transformSteps(result.steps, result.title);
150
150
  const model = {
151
151
  title: result.title,
152
152
  execution: this.getExecution(result.execution),
@@ -167,7 +167,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
167
167
  */
168
168
  async transformTestResultV1(result) {
169
169
  const attachments = await this.uploadAttachments(result.attachments);
170
- const steps = await this.transformStepsV1(result.steps);
170
+ const steps = await this.transformStepsV1(result.steps, result.title);
171
171
  const resultCreate = {
172
172
  attachments: attachments,
173
173
  comment: result.message,
@@ -231,25 +231,32 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
231
231
  }
232
232
  /**
233
233
  * @param {TestStepType[]} steps
234
+ * @param testTitle
234
235
  * @returns Promise<ResultStep[]>
235
236
  * @private
236
237
  */
237
- async transformSteps(steps) {
238
+ async transformSteps(steps, testTitle) {
238
239
  const resultsSteps = [];
239
240
  for (const step of steps) {
240
241
  const attachmentHashes = await this.uploadAttachments(step.attachments);
241
242
  const resultStep = {
242
243
  data: {
243
244
  action: '',
244
- attachments: attachmentHashes,
245
245
  },
246
246
  execution: {
247
247
  status: TestOpsReporter.stepStatusMap[step.execution.status],
248
+ attachments: attachmentHashes,
248
249
  },
249
250
  };
250
251
  if (step.step_type === models_1.StepType.TEXT) {
251
252
  if ('action' in step.data && resultStep.data != undefined) {
252
- resultStep.data.action = step.data.action;
253
+ if (step.data.action === '') {
254
+ this.logEmptyStep(testTitle);
255
+ resultStep.data.action = 'Unnamed step';
256
+ }
257
+ else {
258
+ resultStep.data.action = step.data.action;
259
+ }
253
260
  }
254
261
  }
255
262
  if (step.step_type === models_1.StepType.GHERKIN) {
@@ -258,7 +265,7 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
258
265
  }
259
266
  }
260
267
  if (step.steps.length > 0) {
261
- resultStep.steps = await this.transformSteps(step.steps);
268
+ resultStep.steps = await this.transformSteps(step.steps, testTitle);
262
269
  }
263
270
  resultsSteps.push(resultStep);
264
271
  }
@@ -266,10 +273,11 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
266
273
  }
267
274
  /**
268
275
  * @param {TestStepType[]} steps
276
+ * @param testTitle
269
277
  * @returns Promise<TestStepResultCreate[]>
270
278
  * @private
271
279
  */
272
- async transformStepsV1(steps) {
280
+ async transformStepsV1(steps, testTitle) {
273
281
  const resultsSteps = [];
274
282
  for (const step of steps) {
275
283
  const attachmentHashes = await this.uploadAttachments(step.attachments);
@@ -279,7 +287,13 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
279
287
  };
280
288
  if (step.step_type === models_1.StepType.TEXT) {
281
289
  if ('action' in step.data) {
282
- resultStep.action = step.data.action;
290
+ if (step.data.action === '') {
291
+ this.logEmptyStep(testTitle);
292
+ resultStep.action = 'Unnamed step';
293
+ }
294
+ else {
295
+ resultStep.action = step.data.action;
296
+ }
283
297
  }
284
298
  }
285
299
  if (step.step_type === models_1.StepType.GHERKIN) {
@@ -288,12 +302,15 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
288
302
  }
289
303
  }
290
304
  if (step.steps.length > 0) {
291
- resultStep.steps = await this.transformStepsV1(step.steps);
305
+ resultStep.steps = await this.transformStepsV1(step.steps, testTitle);
292
306
  }
293
307
  resultsSteps.push(resultStep);
294
308
  }
295
309
  return resultsSteps;
296
310
  }
311
+ logEmptyStep(testTitle) {
312
+ this.logger.log((0, chalk_1.default) `{magenta Test '${testTitle}' has empty action in step. The reporter will mark this step as unnamed step.}`);
313
+ }
297
314
  /**
298
315
  * @param {number} runId
299
316
  * @returns {Promise<void>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.0.0-beta.10",
3
+ "version": "2.0.0-beta.12",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",