qase-javascript-commons 2.4.0 → 2.4.1

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 CHANGED
@@ -54,6 +54,7 @@ All configuration options are listed in the table below:
54
54
  | Qase test run description | `testops.run.description` | `QASE_TESTOPS_RUN_DESCRIPTION` | `<Framework name> automated run` | No | Any string |
55
55
  | Qase test run complete | `testops.run.complete` | `QASE_TESTOPS_RUN_COMPLETE` | `True` | | `True`, `False` |
56
56
  | Array of tags to be added to the test run | `testops.run.tags` | `QASE_TESTOPS_RUN_TAGS` | `[]` | No | Array of strings |
57
+ | External link to associate with test run (e.g., Jira ticket) | `testops.run.externalLink` | `QASE_TESTOPS_RUN_EXTERNAL_LINK` | undefined | No | JSON object with `type` (`jiraCloud` or `jiraServer`) and `link` (e.g., `PROJ-123`) |
57
58
  | Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | undefined | No | Any integer |
58
59
  | Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer |
59
60
  | Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` |
@@ -88,7 +89,11 @@ All configuration options are listed in the table below:
88
89
  "title": "Regress run",
89
90
  "description": "Regress run description",
90
91
  "complete": true,
91
- "tags": ["tag1", "tag2"]
92
+ "tags": ["tag1", "tag2"],
93
+ "externalLink": {
94
+ "type": "jiraCloud",
95
+ "link": "PROJ-123"
96
+ }
92
97
  },
93
98
  "defect": false,
94
99
  "project": "<project_code>",
@@ -111,3 +116,13 @@ All configuration options are listed in the table below:
111
116
  }
112
117
  }
113
118
  ```
119
+
120
+ ### Environment Variables Example:
121
+
122
+ ```bash
123
+ # Set external link for Jira Cloud
124
+ export QASE_TESTOPS_RUN_EXTERNAL_LINK='{"type":"jiraCloud","link":"PROJ-123"}'
125
+
126
+ # Set external link for Jira Server
127
+ export QASE_TESTOPS_RUN_EXTERNAL_LINK='{"type":"jiraServer","link":"PROJ-456"}'
128
+ ```
package/changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ # qase-javascript-commons@2.4.1
2
+
3
+ ## What's new
4
+
5
+ Added support for external links in the test run.
6
+
1
7
  # qase-javascript-commons@2.3.6
2
8
 
3
9
  ## What's new
@@ -74,6 +74,22 @@ class ClientV1 {
74
74
  throw new qase_error_1.QaseError('Failed to create test run');
75
75
  }
76
76
  this.logger.logDebug(`Test run created: ${JSON.stringify(data)}`);
77
+ if (this.config.run.externalLink && data.result.id) {
78
+ // Map our enum values to API enum values
79
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
80
+ const apiType = this.config.run.externalLink.type === 'jiraCloud'
81
+ ? qase_api_client_1.RunexternalIssuesTypeEnum.CLOUD
82
+ : qase_api_client_1.RunexternalIssuesTypeEnum.SERVER;
83
+ await this.runClient.runUpdateExternalIssue(this.config.project, {
84
+ type: apiType,
85
+ links: [
86
+ {
87
+ run_id: data.result.id,
88
+ external_issue: this.config.run.externalLink.link,
89
+ },
90
+ ],
91
+ });
92
+ }
77
93
  return data.result.id;
78
94
  }
79
95
  catch (error) {
@@ -1,5 +1,6 @@
1
1
  import { ModeEnum } from '../options';
2
2
  import { DriverEnum, FormatEnum } from '../writer';
3
+ import { ExternalLinkType } from '../models/config/TestOpsOptionsType';
3
4
  /**
4
5
  * @type {JSONSchemaType<ConfigType>}
5
6
  */
@@ -85,6 +86,20 @@ export declare const configValidationSchema: {
85
86
  };
86
87
  nullable: boolean;
87
88
  };
89
+ externalLink: {
90
+ type: string;
91
+ nullable: boolean;
92
+ properties: {
93
+ type: {
94
+ type: string;
95
+ enum: ExternalLinkType[];
96
+ };
97
+ link: {
98
+ type: string;
99
+ };
100
+ };
101
+ required: string[];
102
+ };
88
103
  };
89
104
  };
90
105
  plan: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configValidationSchema = void 0;
4
4
  const options_1 = require("../options");
5
5
  const writer_1 = require("../writer");
6
+ const TestOpsOptionsType_1 = require("../models/config/TestOpsOptionsType");
6
7
  /**
7
8
  * @type {JSONSchemaType<ConfigType>}
8
9
  */
@@ -88,6 +89,20 @@ exports.configValidationSchema = {
88
89
  },
89
90
  nullable: true,
90
91
  },
92
+ externalLink: {
93
+ type: 'object',
94
+ nullable: true,
95
+ properties: {
96
+ type: {
97
+ type: 'string',
98
+ enum: [TestOpsOptionsType_1.ExternalLinkType.JIRA_CLOUD, TestOpsOptionsType_1.ExternalLinkType.JIRA_SERVER],
99
+ },
100
+ link: {
101
+ type: 'string',
102
+ },
103
+ },
104
+ required: ['type', 'link'],
105
+ },
91
106
  },
92
107
  },
93
108
  plan: {
@@ -32,7 +32,8 @@ export declare enum EnvRunEnum {
32
32
  title = "QASE_TESTOPS_RUN_TITLE",
33
33
  description = "QASE_TESTOPS_RUN_DESCRIPTION",
34
34
  complete = "QASE_TESTOPS_RUN_COMPLETE",
35
- tags = "QASE_TESTOPS_RUN_TAGS"
35
+ tags = "QASE_TESTOPS_RUN_TAGS",
36
+ externalLink = "QASE_TESTOPS_RUN_EXTERNAL_LINK"
36
37
  }
37
38
  /**
38
39
  * @enum {string}
@@ -40,6 +40,7 @@ var EnvRunEnum;
40
40
  EnvRunEnum["description"] = "QASE_TESTOPS_RUN_DESCRIPTION";
41
41
  EnvRunEnum["complete"] = "QASE_TESTOPS_RUN_COMPLETE";
42
42
  EnvRunEnum["tags"] = "QASE_TESTOPS_RUN_TAGS";
43
+ EnvRunEnum["externalLink"] = "QASE_TESTOPS_RUN_EXTERNAL_LINK";
43
44
  })(EnvRunEnum || (exports.EnvRunEnum = EnvRunEnum = {}));
44
45
  /**
45
46
  * @enum {string}
@@ -26,6 +26,25 @@ const envToConfig = (env) => ({
26
26
  description: env[env_enum_1.EnvRunEnum.description],
27
27
  complete: env[env_enum_1.EnvRunEnum.complete],
28
28
  tags: env[env_enum_1.EnvRunEnum.tags]?.split(',').map(tag => tag.trim()) ?? [],
29
+ externalLink: env[env_enum_1.EnvRunEnum.externalLink] ? (() => {
30
+ try {
31
+ const externalLinkValue = env[env_enum_1.EnvRunEnum.externalLink];
32
+ if (!externalLinkValue)
33
+ return undefined;
34
+ const parsed = JSON.parse(externalLinkValue);
35
+ // Validate that type is a valid ExternalLinkType value
36
+ if (parsed.type !== 'jiraCloud' && parsed.type !== 'jiraServer') {
37
+ return undefined;
38
+ }
39
+ return {
40
+ type: parsed.type,
41
+ link: parsed.link,
42
+ };
43
+ }
44
+ catch {
45
+ return undefined;
46
+ }
47
+ })() : undefined,
29
48
  },
30
49
  plan: {
31
50
  id: env[env_enum_1.EnvPlanEnum.id],
@@ -18,6 +18,7 @@ export interface EnvType {
18
18
  [EnvRunEnum.description]?: string;
19
19
  [EnvRunEnum.complete]?: boolean;
20
20
  [EnvRunEnum.tags]?: string;
21
+ [EnvRunEnum.externalLink]?: string;
21
22
  [EnvPlanEnum.id]?: number;
22
23
  [EnvBatchEnum.size]?: number;
23
24
  [EnvConfigurationsEnum.values]?: string;
@@ -76,6 +76,10 @@ exports.envValidationSchema = {
76
76
  type: 'string',
77
77
  nullable: true,
78
78
  },
79
+ [env_enum_1.EnvRunEnum.externalLink]: {
80
+ type: 'string',
81
+ nullable: true,
82
+ },
79
83
  [env_enum_1.EnvPlanEnum.id]: {
80
84
  type: 'number',
81
85
  nullable: true,
@@ -16,12 +16,21 @@ export interface TestOpsConfigurationValueType {
16
16
  name: string;
17
17
  value: string;
18
18
  }
19
+ export declare enum ExternalLinkType {
20
+ JIRA_CLOUD = "jiraCloud",
21
+ JIRA_SERVER = "jiraServer"
22
+ }
23
+ export interface TestOpsExternalLinkType {
24
+ type: ExternalLinkType;
25
+ link: string;
26
+ }
19
27
  export interface TestOpsRunType {
20
28
  id?: number | undefined;
21
29
  title?: string;
22
30
  description?: string;
23
31
  complete?: boolean | undefined;
24
32
  tags?: string[] | undefined;
33
+ externalLink?: TestOpsExternalLinkType | undefined;
25
34
  }
26
35
  export interface TestOpsPlanType {
27
36
  id?: number | undefined;
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExternalLinkType = void 0;
4
+ var ExternalLinkType;
5
+ (function (ExternalLinkType) {
6
+ ExternalLinkType["JIRA_CLOUD"] = "jiraCloud";
7
+ ExternalLinkType["JIRA_SERVER"] = "jiraServer";
8
+ })(ExternalLinkType || (exports.ExternalLinkType = ExternalLinkType = {}));
@@ -6,3 +6,4 @@ export { Attachment } from './attachment';
6
6
  export { Report } from './report';
7
7
  export { CompoundError } from './error';
8
8
  export { ConfigurationGroup, ConfigurationItem, ConfigurationGroupResponse } from './configuration';
9
+ export { ExternalLinkType, TestOpsOptionsType, TestOpsApiType, TestOpsRunType, TestOpsPlanType, TestOpsBatchType, TestOpsConfigurationType, TestOpsConfigurationValueType, TestOpsExternalLinkType } from './config/TestOpsOptionsType';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompoundError = exports.StepStatusEnum = exports.StepType = exports.TestStepType = exports.TestStatusEnum = exports.TestExecution = exports.TestResultType = void 0;
3
+ exports.ExternalLinkType = exports.CompoundError = exports.StepStatusEnum = exports.StepType = exports.TestStepType = exports.TestStatusEnum = exports.TestExecution = exports.TestResultType = void 0;
4
4
  var test_result_1 = require("./test-result");
5
5
  Object.defineProperty(exports, "TestResultType", { enumerable: true, get: function () { return test_result_1.TestResultType; } });
6
6
  var test_execution_1 = require("./test-execution");
@@ -13,3 +13,5 @@ var step_execution_1 = require("./step-execution");
13
13
  Object.defineProperty(exports, "StepStatusEnum", { enumerable: true, get: function () { return step_execution_1.StepStatusEnum; } });
14
14
  var error_1 = require("./error");
15
15
  Object.defineProperty(exports, "CompoundError", { enumerable: true, get: function () { return error_1.CompoundError; } });
16
+ var TestOpsOptionsType_1 = require("./config/TestOpsOptionsType");
17
+ Object.defineProperty(exports, "ExternalLinkType", { enumerable: true, get: function () { return TestOpsOptionsType_1.ExternalLinkType; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",