qase-javascript-commons 2.3.1 → 2.3.3

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
@@ -53,9 +53,11 @@ All configuration options are listed in the table below:
53
53
  | Qase test run title | `testops.run.title` | `QASE_TESTOPS_RUN_TITLE` | `Automated run <Current date and time>` | No | Any string |
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
+ | Array of tags to be added to the test run | `testops.run.tags` | `QASE_TESTOPS_RUN_TAGS` | `[]` | No | Array of strings |
56
57
  | Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | undefined | No | Any integer |
57
58
  | Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer |
58
59
  | Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` |
60
+ | Enable/disable attachment uploads | `testops.uploadAttachments` | `QASE_TESTOPS_UPLOAD_ATTACHMENTS` | `true` | No | `True`, `False` |
59
61
 
60
62
  ### Example `qase.config.json` config:
61
63
 
@@ -83,7 +85,8 @@ All configuration options are listed in the table below:
83
85
  "run": {
84
86
  "title": "Regress run",
85
87
  "description": "Regress run description",
86
- "complete": true
88
+ "complete": true,
89
+ "tags": ["tag1", "tag2"]
87
90
  },
88
91
  "defect": false,
89
92
  "project": "<project_code>",
package/changelog.md CHANGED
@@ -1,3 +1,15 @@
1
+ # qase-javascript-commons@2.3.3
2
+
3
+ ## What's new
4
+
5
+ Added support for tags in the test run.
6
+
7
+ # qase-javascript-commons@2.3.2
8
+
9
+ ## What's new
10
+
11
+ Fixed an issue with attachments content type.
12
+
1
13
  # qase-javascript-commons@2.3.0
2
14
 
3
15
  ## What's new
@@ -119,7 +119,7 @@ class ClientV1 {
119
119
  return {
120
120
  name: attachment.file_name,
121
121
  value: typeof attachment.content === 'string'
122
- ? Buffer.from(attachment.content)
122
+ ? Buffer.from(attachment.content, attachment.content.match(/^[A-Za-z0-9+/=]+$/) ? 'base64' : undefined)
123
123
  : attachment.content,
124
124
  };
125
125
  }
@@ -136,6 +136,7 @@ class ClientV1 {
136
136
  is_autotest: true,
137
137
  cases: [],
138
138
  start_time: (0, dateUtils_1.getStartTime)(),
139
+ tags: this.config.run.tags ?? [],
139
140
  };
140
141
  if (environmentId !== undefined) {
141
142
  runObject.environment_id = environmentId;
@@ -75,6 +75,7 @@ class ClientV2 extends clientV1_1.ClientV1 {
75
75
  message: result.message,
76
76
  fields: result.fields,
77
77
  defect: this.config.defect ?? false,
78
+ signature: result.signature,
78
79
  };
79
80
  this.logger.logDebug(`Transformed result: ${JSON.stringify(model)}`);
80
81
  return model;
@@ -81,6 +81,13 @@ exports.configValidationSchema = {
81
81
  type: 'boolean',
82
82
  nullable: true,
83
83
  },
84
+ tags: {
85
+ type: 'array',
86
+ items: {
87
+ type: 'string',
88
+ },
89
+ nullable: true,
90
+ },
84
91
  },
85
92
  },
86
93
  plan: {
@@ -31,7 +31,8 @@ export declare enum EnvRunEnum {
31
31
  id = "QASE_TESTOPS_RUN_ID",
32
32
  title = "QASE_TESTOPS_RUN_TITLE",
33
33
  description = "QASE_TESTOPS_RUN_DESCRIPTION",
34
- complete = "QASE_TESTOPS_RUN_COMPLETE"
34
+ complete = "QASE_TESTOPS_RUN_COMPLETE",
35
+ tags = "QASE_TESTOPS_RUN_TAGS"
35
36
  }
36
37
  /**
37
38
  * @enum {string}
@@ -39,6 +39,7 @@ var EnvRunEnum;
39
39
  EnvRunEnum["title"] = "QASE_TESTOPS_RUN_TITLE";
40
40
  EnvRunEnum["description"] = "QASE_TESTOPS_RUN_DESCRIPTION";
41
41
  EnvRunEnum["complete"] = "QASE_TESTOPS_RUN_COMPLETE";
42
+ EnvRunEnum["tags"] = "QASE_TESTOPS_RUN_TAGS";
42
43
  })(EnvRunEnum || (exports.EnvRunEnum = EnvRunEnum = {}));
43
44
  /**
44
45
  * @enum {string}
@@ -25,6 +25,7 @@ const envToConfig = (env) => ({
25
25
  title: env[env_enum_1.EnvRunEnum.title],
26
26
  description: env[env_enum_1.EnvRunEnum.description],
27
27
  complete: env[env_enum_1.EnvRunEnum.complete],
28
+ tags: env[env_enum_1.EnvRunEnum.tags],
28
29
  },
29
30
  plan: {
30
31
  id: env[env_enum_1.EnvPlanEnum.id],
@@ -17,6 +17,7 @@ export interface EnvType {
17
17
  [EnvRunEnum.title]?: string;
18
18
  [EnvRunEnum.description]?: string;
19
19
  [EnvRunEnum.complete]?: boolean;
20
+ [EnvRunEnum.tags]?: string[];
20
21
  [EnvPlanEnum.id]?: number;
21
22
  [EnvBatchEnum.size]?: number;
22
23
  [EnvLocalEnum.path]?: string;
@@ -72,6 +72,13 @@ exports.envValidationSchema = {
72
72
  type: 'boolean',
73
73
  nullable: true,
74
74
  },
75
+ [env_enum_1.EnvRunEnum.tags]: {
76
+ type: 'array',
77
+ items: {
78
+ type: 'string',
79
+ },
80
+ nullable: true,
81
+ },
75
82
  [env_enum_1.EnvPlanEnum.id]: {
76
83
  type: 'number',
77
84
  nullable: true,
package/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './reporters';
8
8
  export * from './writer';
9
9
  export * from './utils/get-package-version';
10
10
  export * from './utils/mimeTypes';
11
+ export * from './utils/signature';
11
12
  export * from './steps/step';
package/dist/index.js CHANGED
@@ -24,4 +24,5 @@ __exportStar(require("./reporters"), exports);
24
24
  __exportStar(require("./writer"), exports);
25
25
  __exportStar(require("./utils/get-package-version"), exports);
26
26
  __exportStar(require("./utils/mimeTypes"), exports);
27
+ __exportStar(require("./utils/signature"), exports);
27
28
  __exportStar(require("./steps/step"), exports);
@@ -12,6 +12,7 @@ export interface TestOpsRunType {
12
12
  title?: string;
13
13
  description?: string;
14
14
  complete?: boolean | undefined;
15
+ tags?: string[] | undefined;
15
16
  }
16
17
  export interface TestOpsPlanType {
17
18
  id?: number | undefined;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generates a signature string from testops IDs, suites and parameters
3
+ * @param testopsIds - Array of testops IDs or null
4
+ * @param suites - Array of suite names
5
+ * @param parameters - Map of parameter names to values
6
+ * @returns Formatted signature string
7
+ */
8
+ export declare const generateSignature: (testopsIds: number[] | null, suites: string[], parameters: Record<string, string>) => string;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateSignature = void 0;
4
+ /**
5
+ * Generates a signature string from testops IDs, suites and parameters
6
+ * @param testopsIds - Array of testops IDs or null
7
+ * @param suites - Array of suite names
8
+ * @param parameters - Map of parameter names to values
9
+ * @returns Formatted signature string
10
+ */
11
+ const generateSignature = (testopsIds, suites, parameters) => {
12
+ const parts = [];
13
+ if (testopsIds && testopsIds.length > 0) {
14
+ parts.push(testopsIds.join('-'));
15
+ }
16
+ if (suites.length > 0) {
17
+ const processedSuites = suites
18
+ .map(suite => suite.trim())
19
+ .flatMap(suite => suite.split('::'))
20
+ .map(suite => suite.trim())
21
+ .flatMap(suite => suite.split('\t'))
22
+ .map(suite => suite.trim())
23
+ .map(suite => suite.replace(/\s+/g, '_'))
24
+ .map(suite => suite.toLowerCase())
25
+ .filter(suite => suite.length > 0);
26
+ parts.push(processedSuites.join('::'));
27
+ }
28
+ const paramsString = Object.entries(parameters)
29
+ .map(([key, value]) => `{'${key.toLowerCase()}':'${value.toLowerCase()}'}`)
30
+ .join('::');
31
+ if (paramsString) {
32
+ parts.push(paramsString);
33
+ }
34
+ return parts.join('::');
35
+ };
36
+ exports.generateSignature = generateSignature;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qase-javascript-commons",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Qase JS Reporters",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,6 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "ajv": "^8.12.0",
28
+ "async-mutex": "~0.5.0",
28
29
  "chalk": "^4.1.2",
29
30
  "env-schema": "^5.2.0",
30
31
  "form-data": "^4.0.0",
@@ -35,8 +36,7 @@
35
36
  "qase-api-client": "~1.0.1",
36
37
  "qase-api-v2-client": "~1.0.1",
37
38
  "strip-ansi": "^6.0.1",
38
- "uuid": "^9.0.0",
39
- "async-mutex": "~0.5.0"
39
+ "uuid": "^9.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@jest/globals": "^29.5.0",