wdio-qase-reporter 1.0.0-beta.3 → 1.0.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
@@ -111,7 +111,7 @@ Example `qase.config.json` config:
111
111
  }
112
112
  ```
113
113
 
114
- Also, you need to configure the reporter using the `wdio.conf.ts` file:
114
+ Also, you need to configure the reporter using the `wdio.conf.ts` or `wdio.conf.js` files:
115
115
 
116
116
  ```ts
117
117
  // wdio.conf.ts
@@ -140,7 +140,34 @@ export const config: Options.Testrunner = {
140
140
  };
141
141
  ```
142
142
 
143
- Additional options of the reporter in the `wdio.conf.ts` file:
143
+ ```javascript
144
+ // wdio.conf.js
145
+ const WDIOQaseReporter = require('wdio-qase-reporter').default;
146
+ const {beforeRunHook, afterRunHook} = require('wdio-qase-reporter');
147
+
148
+
149
+ exports.config = {
150
+ reporters: [[WDIOQaseReporter, {
151
+ disableWebdriverStepsReporting: true,
152
+ disableWebdriverScreenshotsReporting: true,
153
+ useCucumber: false,
154
+ }]],
155
+
156
+ // ...
157
+ // =====
158
+ // Hooks
159
+ // =====
160
+ onPrepare: async function() {
161
+ await beforeRunHook();
162
+ },
163
+ onComplete: async function() {
164
+ await afterRunHook();
165
+ },
166
+ // ... other options
167
+ };
168
+ ```
169
+
170
+ Additional options of the reporter in the `wdio.conf.ts` or `wdio.conf.js` files:
144
171
 
145
172
  - `disableWebdriverStepsReporting` - optional parameter(`false` by default), in order to log only custom steps to the reporter.
146
173
  - `disableWebdriverScreenshotsReporting` - optional parameter(`false` by default), in order to not attach screenshots to the reporter.
package/changelog.md CHANGED
@@ -1,3 +1,14 @@
1
+ # qase-wdio@1.0.0-beta.4
2
+
3
+ ## What's new
4
+
5
+ Fix an issue with attaching the screenshot to the test case. Now, the reporter will correctly handle the screenshots and
6
+ will attach them to the test case in the Qase TMS.
7
+
8
+ ```log
9
+ The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
10
+ ```
11
+
1
12
  # qase-wdio@1.0.0-beta.3
2
13
 
3
14
  ## What's new
package/dist/options.js CHANGED
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QaseReporterOptions = void 0;
4
4
  class QaseReporterOptions {
5
+ useCucumber;
6
+ disableWebdriverStepsReporting;
7
+ disableWebdriverScreenshotsReporting;
5
8
  constructor() {
6
9
  this.useCucumber = false;
7
10
  this.disableWebdriverStepsReporting = false;
package/dist/reporter.js CHANGED
@@ -12,6 +12,28 @@ const utils_1 = require("./utils");
12
12
  const path_1 = __importDefault(require("path"));
13
13
  const events_1 = require("./events");
14
14
  class WDIOQaseReporter extends reporter_1.default {
15
+ /**
16
+ * @type {Record<string, TestStatusEnum>}
17
+ */
18
+ static statusMap = {
19
+ 'passed': qase_javascript_commons_1.TestStatusEnum.passed,
20
+ 'failed': qase_javascript_commons_1.TestStatusEnum.failed,
21
+ 'skipped': qase_javascript_commons_1.TestStatusEnum.skipped,
22
+ 'pending': qase_javascript_commons_1.TestStatusEnum.skipped,
23
+ };
24
+ /**
25
+ * @type {ReporterInterface}
26
+ * @private
27
+ */
28
+ reporter;
29
+ storage;
30
+ /**
31
+ * @type {boolean}
32
+ * @private
33
+ */
34
+ isSync;
35
+ _options;
36
+ _isMultiremote;
15
37
  constructor(options) {
16
38
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
17
39
  super(options);
@@ -214,11 +236,11 @@ class WDIOQaseReporter extends reporter_1.default {
214
236
  }
215
237
  onAfterCommand(command) {
216
238
  const { disableWebdriverStepsReporting, disableWebdriverScreenshotsReporting } = this._options;
217
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
218
- const commandResult = command.result || undefined;
239
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
240
+ const commandResult = command.result.value || undefined;
219
241
  const isScreenshot = (0, utils_1.isScreenshotCommand)(command);
220
242
  if (!disableWebdriverScreenshotsReporting && isScreenshot && commandResult) {
221
- this.attachFile('Screenshot', Buffer.from(commandResult, 'base64'), 'image/png');
243
+ this.attachFile('Screenshot.png', Buffer.from(commandResult, 'base64'), 'image/png');
222
244
  }
223
245
  if (disableWebdriverStepsReporting || this._isMultiremote || !this.storage.getCurrentStep()) {
224
246
  return;
@@ -365,6 +387,7 @@ class WDIOQaseReporter extends reporter_1.default {
365
387
  data: {
366
388
  action: title,
367
389
  expected_result: null,
390
+ data: null,
368
391
  },
369
392
  parent_id: this.storage.getLastItem()?.id ?? null,
370
393
  execution: {
@@ -396,7 +419,6 @@ class WDIOQaseReporter extends reporter_1.default {
396
419
  mime_type: contentType,
397
420
  content: content,
398
421
  };
399
- console.log('attachFile:', attach);
400
422
  this.storage.getLastItem()?.attachments.push(attach);
401
423
  }
402
424
  _endStep(status = qase_javascript_commons_1.TestStatusEnum.passed) {
@@ -418,13 +440,4 @@ class WDIOQaseReporter extends reporter_1.default {
418
440
  return { key, value };
419
441
  }
420
442
  }
421
- /**
422
- * @type {Record<string, TestStatusEnum>}
423
- */
424
- WDIOQaseReporter.statusMap = {
425
- 'passed': qase_javascript_commons_1.TestStatusEnum.passed,
426
- 'failed': qase_javascript_commons_1.TestStatusEnum.failed,
427
- 'skipped': qase_javascript_commons_1.TestStatusEnum.skipped,
428
- 'pending': qase_javascript_commons_1.TestStatusEnum.skipped,
429
- };
430
443
  exports.default = WDIOQaseReporter;
package/dist/step.js CHANGED
@@ -8,10 +8,10 @@ const qase_javascript_commons_1 = require("qase-javascript-commons");
8
8
  const uuid_1 = require("uuid");
9
9
  const path_1 = __importDefault(require("path"));
10
10
  class QaseStep {
11
+ name = '';
12
+ attachments = [];
13
+ steps = [];
11
14
  constructor(name) {
12
- this.name = '';
13
- this.attachments = [];
14
- this.steps = [];
15
15
  this.name = name;
16
16
  }
17
17
  attach(attach) {
@@ -57,6 +57,7 @@ class QaseStep {
57
57
  step.data = {
58
58
  action: this.name,
59
59
  expected_result: null,
60
+ data: null,
60
61
  };
61
62
  try {
62
63
  await body.call(this, this);
package/dist/storage.js CHANGED
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findLast = exports.Storage = void 0;
4
4
  const qase_javascript_commons_1 = require("qase-javascript-commons");
5
5
  class Storage {
6
- constructor() {
7
- this.suites = [];
8
- this.ignore = false;
9
- this.items = [];
10
- }
6
+ currentFile;
7
+ suites = [];
8
+ ignore = false;
9
+ items = [];
11
10
  clear() {
12
11
  this.currentFile = undefined;
13
12
  this.suites = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-qase-reporter",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0",
4
4
  "description": "Qase WebDriverIO Reporter",
5
5
  "homepage": "https://github.com/qase-tms/qase-javascript",
6
6
  "sideEffects": false,
@@ -32,7 +32,7 @@
32
32
  "author": "Qase Team <support@qase.io>",
33
33
  "license": "Apache-2.0",
34
34
  "dependencies": {
35
- "qase-javascript-commons": "~2.2.0",
35
+ "qase-javascript-commons": "~2.2.14",
36
36
  "uuid": "^9.0.1",
37
37
  "@types/node": "^20.1.0",
38
38
  "@wdio/reporter": "^8.39.0",