wdio-qase-reporter 1.1.4 → 1.2.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/README.md CHANGED
@@ -83,6 +83,12 @@ A test run will be performed and available at:
83
83
  https://app.qase.io/run/QASE_PROJECT_CODE
84
84
  ```
85
85
 
86
+ ### Multi-Project Support
87
+
88
+ Qase WebdriverIO Reporter supports sending test results to multiple Qase projects simultaneously. You can specify different test case IDs for each project using `qase.projects(mapping, name)`.
89
+
90
+ For detailed information, configuration, and examples, see the [Multi-Project Support Guide](docs/MULTI_PROJECT.md).
91
+
86
92
  ## Configuration
87
93
 
88
94
  Qase WebDriverIO reporter can be configured in multiple ways:
package/changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ # qase-wdio@1.2.0
2
+
3
+ ## What's new
4
+
5
+ - Added support for multi-project support.
6
+
1
7
  # qase-wdio@1.1.4
2
8
 
3
9
  ## What's new
package/dist/hooks.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.afterRunHook = exports.beforeRunHook = void 0;
3
+ exports.beforeRunHook = beforeRunHook;
4
+ exports.afterRunHook = afterRunHook;
4
5
  const qase_javascript_commons_1 = require("qase-javascript-commons");
5
6
  async function beforeRunHook() {
6
7
  const configLoader = new qase_javascript_commons_1.ConfigLoader();
@@ -15,7 +16,6 @@ async function beforeRunHook() {
15
16
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call
16
17
  await reporter.startTestRunAsync();
17
18
  }
18
- exports.beforeRunHook = beforeRunHook;
19
19
  async function afterRunHook() {
20
20
  const configLoader = new qase_javascript_commons_1.ConfigLoader();
21
21
  const config = configLoader.load();
@@ -28,4 +28,3 @@ async function afterRunHook() {
28
28
  });
29
29
  await reporter.complete();
30
30
  }
31
- exports.afterRunHook = afterRunHook;
@@ -62,12 +62,6 @@ export default class WDIOQaseReporter extends WDIOReporter {
62
62
  private parseTag;
63
63
  /**
64
64
  * @param {string} title
65
- * @returns {number[]}
66
- * @private
67
- */
68
- private static extractQaseIdsFromTitle;
69
- /**
70
- * @param {string} title
71
65
  * @returns {string}
72
66
  * @private
73
67
  */
package/dist/reporter.js CHANGED
@@ -234,11 +234,16 @@ class WDIOQaseReporter extends reporter_1.default {
234
234
  null : err.message === undefined ?
235
235
  null : err.message;
236
236
  testResult.signature = (0, qase_javascript_commons_1.generateSignature)(Array.isArray(testResult.testops_id) ? testResult.testops_id : testResult.testops_id ? [testResult.testops_id] : null, [...this.storage.suites, testResult.title], testResult.params);
237
- const ids = WDIOQaseReporter.extractQaseIdsFromTitle(testResult.title);
238
- if (ids.length > 0) {
239
- testResult.testops_id = ids;
237
+ const parsed = (0, qase_javascript_commons_1.parseProjectMappingFromTitle)(testResult.title);
238
+ const hasProjectMapping = Object.keys(parsed.projectMapping).length > 0;
239
+ if (hasProjectMapping) {
240
+ testResult.testops_project_mapping = parsed.projectMapping;
241
+ testResult.testops_id = null;
240
242
  }
241
- testResult.title = this.removeQaseIdsFromTitle(testResult.title);
243
+ else if (parsed.legacyIds.length > 0) {
244
+ testResult.testops_id = parsed.legacyIds.length === 1 ? parsed.legacyIds[0] : parsed.legacyIds;
245
+ }
246
+ testResult.title = parsed.cleanedTitle || this.removeQaseIdsFromTitle(testResult.title);
242
247
  await this.reporter.addTestResult(testResult);
243
248
  }
244
249
  onBeforeCommand(command) {
@@ -464,15 +469,6 @@ class WDIOQaseReporter extends reporter_1.default {
464
469
  }
465
470
  /**
466
471
  * @param {string} title
467
- * @returns {number[]}
468
- * @private
469
- */
470
- static extractQaseIdsFromTitle(title) {
471
- const [, ids] = title.match(WDIOQaseReporter.qaseIdRegExp) ?? [];
472
- return ids ? ids.split(',').map((id) => Number(id)) : [];
473
- }
474
- /**
475
- * @param {string} title
476
472
  * @returns {string}
477
473
  * @private
478
474
  */
package/dist/wdio.d.ts CHANGED
@@ -14,122 +14,21 @@ import { StepFunction } from 'qase-javascript-commons';
14
14
  */
15
15
  export declare const qase: {
16
16
  (qaseId: number | string | number[] | string[], name: string): string;
17
- /**
18
- * Set IDs for the test case.
19
- * Deprecated: Use qase(qaseId, name) instead.
20
- *
21
- * @param value
22
- * @returns {string}
23
- * @example
24
- * describe('suite', () => {
25
- * it('should work', () => {
26
- * qase.id(1);
27
- * // test code
28
- * });
29
- * });
30
- */
17
+ projects(mapping: ProjectMapping, name: string): string;
31
18
  id(value: number | number[]): undefined;
32
- /**
33
- * Set a title for the test case
34
- * @param {string} value
35
- * @example
36
- * describe('suite', () => {
37
- * it('should work', () => {
38
- * qase.title("Title");
39
- * // test code
40
- * });
41
- * });
42
- */
43
19
  title(value: string): undefined;
44
- /**
45
- * Set parameters for the test case
46
- * @param {Record<string, string>} values
47
- * @example
48
- * describe('suite', () => {
49
- * it('should work', () => {
50
- * qase.parameters({ param1: 'value1', param2: 'value2' });
51
- * // test code
52
- * });
53
- * });
54
- */
55
20
  parameters(values: Record<string, string>): undefined;
56
- /**
57
- * Set group parameters for the test case
58
- * @param {Record<string, string>} values
59
- * @example
60
- * describe('suite', () => {
61
- * it('should work', () => {
62
- * qase.groupParameters({ param1: 'value1', param2: 'value2' });
63
- * // test code
64
- * });
65
- * });
66
- */
67
21
  groupParameters(values: Record<string, string>): undefined;
68
- /**
69
- * Set fields for the test case
70
- * @param {Record<string, string>} values
71
- * @example
72
- * describe('suite', () => {
73
- * it('should work', () => {
74
- * qase.fields({ field1: 'value1', field2: 'value2' });
75
- * // test code
76
- * });
77
- * });
78
- */
79
22
  fields(values: Record<string, string>): undefined;
80
- /**
81
- * Set suite for the test case
82
- * @param {string} value
83
- * @example
84
- * describe('suite', () => {
85
- * it('should work', () => {
86
- * qase.suite('Suite');
87
- * // test code
88
- * });
89
- * });
90
- */
91
23
  suite(value: string): undefined;
92
- /**
93
- * Set ignore for the test case
94
- * @example
95
- * describe('suite', () => {
96
- * it('should work', () => {
97
- * qase.ignore();
98
- * // test code
99
- * });
100
- * });
101
- */
102
24
  ignore(): undefined;
103
- /**
104
- * Set attachment for the test case
105
- * @param {object} attach
106
- * @example
107
- * describe('suite', () => {
108
- * it('should work', () => {
109
- * qase.attach({ name: 'attachment', type: 'text/plain', content: 'attachment content' });
110
- * // test code
111
- * });
112
- * });
113
- */
114
25
  attach(attach: {
115
26
  name?: string;
116
27
  type?: string;
117
28
  content?: string;
118
29
  paths?: string[];
119
30
  }): undefined;
120
- /**
121
- * Set step for the test case
122
- * @param {string} name
123
- * @param {StepFunction} body
124
- * @example
125
- * describe('suite', () => {
126
- * it('should work', () => {
127
- * qase.step('step', async () => {
128
- * // step code
129
- * });
130
- * // test code
131
- * });
132
- * });
133
- */
134
31
  step(name: string, body: StepFunction): Promise<undefined>;
135
32
  };
33
+ /** Project code → test case IDs for multi-project (testops_multi) mode. */
34
+ export type ProjectMapping = Record<string, number[]>;
package/dist/wdio.js CHANGED
@@ -46,6 +46,15 @@ const qase = (qaseId, name) => {
46
46
  return newName;
47
47
  };
48
48
  exports.qase = qase;
49
+ /**
50
+ * Build test name with multi-project markers (for testops_multi mode).
51
+ * @param mapping — e.g. { PROJ1: [1, 2], PROJ2: [3] }
52
+ * @param name — test title
53
+ * @example it(qase.projects({ PROJ1: [100], PROJ2: [200] }, 'Login flow'), () => { ... });
54
+ */
55
+ exports.qase.projects = (mapping, name) => {
56
+ return (0, qase_javascript_commons_1.formatTitleWithProjectMapping)(name, mapping);
57
+ };
49
58
  /**
50
59
  * Set IDs for the test case.
51
60
  * Deprecated: Use qase(qaseId, name) instead.
@@ -0,0 +1,53 @@
1
+ # Multi-Project Support in WebdriverIO (WDIO)
2
+
3
+ Qase WDIO Reporter supports sending test results to multiple Qase projects simultaneously. This feature allows you to report the same test execution to different projects with different test case IDs, which is useful when:
4
+
5
+ * You need to report the same test to different projects
6
+ * Different projects track the same functionality with different test case IDs
7
+ * You want to maintain separate test runs for different environments or teams
8
+
9
+ ## Configuration
10
+
11
+ For detailed configuration options, refer to the [qase-javascript-commons README](../../qase-javascript-commons/README.md#multi-project-support).
12
+
13
+ ### Basic Multi-Project Configuration
14
+
15
+ Set `mode` to `testops_multi` in your WDIO config (e.g. in `wdio.conf.js` or `qase.config.json`) and add the `testops_multi` section with `default_project` and `projects`.
16
+
17
+ ## Using `qase.projects(mapping, name)`
18
+
19
+ Use `qase.projects(mapping, name)` to set the test title with multi-project markers. Use the returned string as the test name:
20
+
21
+ ```javascript
22
+ const { qase } = require('wdio-qase-reporter');
23
+
24
+ // Single project
25
+ it(qase(1, 'should work'), async () => { ... });
26
+
27
+ // Multi-project
28
+ it(qase.projects({ PROJ1: [100], PROJ2: [200] }, 'Login flow'), async () => { ... });
29
+
30
+ // Multiple IDs per project
31
+ it(qase.projects({ PROJ1: [10, 11], PROJ2: [20] }, 'Checkout'), async () => { ... });
32
+ ```
33
+
34
+ Project codes (e.g. `PROJ1`, `PROJ2`) must match `testops_multi.projects[].code` in your config.
35
+
36
+ ## Tests Without Project Mapping
37
+
38
+ Tests that do not use `qase.projects()` and have no `(Qase PROJ: ids)` in the title are sent to the `default_project`. If they use `qase(id, name)` (single-project), that ID is used for the default project.
39
+
40
+ ## Important Notes
41
+
42
+ 1. **Project codes must match**: Codes in `qase.projects({ PROJ1: [1], ... })` must match `testops_multi.projects[].code`.
43
+ 2. **Mode**: Set `mode` to `testops_multi` in WDIO reporter config.
44
+ 3. **Title format**: The helper produces a title like `Name (Qase PROJ1: 1,2) (Qase PROJ2: 3)` so the reporter can parse the mapping.
45
+
46
+ ## Examples
47
+
48
+ See the [multi-project WDIO example](../../examples/multiProject/wdio/) for a complete runnable setup.
49
+
50
+ ## Troubleshooting
51
+
52
+ * Verify `mode` is `testops_multi` and project codes in `qase.projects()` match the config.
53
+ * Ensure the test name is the string returned by `qase.projects(mapping, name)` (or an equivalent title with markers).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-qase-reporter",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "Qase WebDriverIO Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "sideEffects": false,
@@ -32,12 +32,12 @@
32
32
  "author": "Qase Team <support@qase.io>",
33
33
  "license": "Apache-2.0",
34
34
  "dependencies": {
35
- "qase-javascript-commons": "~2.4.2",
35
+ "qase-javascript-commons": "~2.5.0",
36
36
  "uuid": "^9.0.1",
37
- "@types/node": "^20.1.0",
38
- "@wdio/reporter": "^8.39.0",
39
- "@wdio/types": "^8.39.0",
40
- "csv-stringify": "^6.0.4",
41
- "strip-ansi": "^7.1.0"
37
+ "@types/node": "^20.19.25",
38
+ "@wdio/reporter": "^8.43.0",
39
+ "@wdio/types": "^8.41.0",
40
+ "csv-stringify": "^6.6.0",
41
+ "strip-ansi": "^7.1.2"
42
42
  }
43
43
  }
@@ -2,7 +2,9 @@
2
2
  "extends": "./tsconfig.json",
3
3
 
4
4
  "compilerOptions": {
5
- "noEmit": false
5
+ "noEmit": false,
6
+ "skipLibCheck": true,
7
+ "types": []
6
8
  },
7
9
 
8
10
  "include": ["./src/**/*.ts"]