wdio-qase-reporter 1.0.3 → 1.1.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 +2 -2
- package/changelog.md +7 -0
- package/dist/reporter.d.ts +1 -1
- package/dist/reporter.js +4 -4
- package/dist/storage.js +1 -1
- package/dist/utils.js +1 -0
- package/dist/wdio.d.ts +1 -1
- package/dist/wdio.js +5 -3
- package/package.json +2 -2
- package/dist/step.d.ts +0 -16
- package/dist/step.js +0 -88
package/README.md
CHANGED
package/changelog.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# qase-wdio@1.1.0
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
- Updated to the latest minor version of the common package for improved compatibility and features.
|
|
6
|
+
- Fixed all ESLint warnings across the project to ensure code quality and maintainability.
|
|
7
|
+
|
|
1
8
|
# qase-wdio@1.0.2
|
|
2
9
|
|
|
3
10
|
## What's new
|
package/dist/reporter.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export default class WDIOQaseReporter extends WDIOReporter {
|
|
|
25
25
|
onRunnerStart(runner: RunnerStats): void;
|
|
26
26
|
onSuiteStart(suite: SuiteStats): void;
|
|
27
27
|
onSuiteEnd(suite: SuiteStats): Promise<void>;
|
|
28
|
-
onRunnerEnd(
|
|
28
|
+
onRunnerEnd(): Promise<void>;
|
|
29
29
|
onTestStart(test: TestStats): void;
|
|
30
30
|
/**
|
|
31
31
|
* @param {Error[]} testErrors
|
package/dist/reporter.js
CHANGED
|
@@ -34,6 +34,7 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
34
34
|
isSync;
|
|
35
35
|
_options;
|
|
36
36
|
_isMultiremote;
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
38
|
constructor(options) {
|
|
38
39
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
39
40
|
super(options);
|
|
@@ -60,7 +61,6 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
60
61
|
}
|
|
61
62
|
onRunnerStart(runner) {
|
|
62
63
|
this._isMultiremote = runner.isMultiremote;
|
|
63
|
-
// this.reporter.startTestRun();
|
|
64
64
|
this.isSync = false;
|
|
65
65
|
}
|
|
66
66
|
onSuiteStart(suite) {
|
|
@@ -127,7 +127,7 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
127
127
|
}
|
|
128
128
|
this.storage.clear();
|
|
129
129
|
}
|
|
130
|
-
async onRunnerEnd(
|
|
130
|
+
async onRunnerEnd() {
|
|
131
131
|
await this.reporter.sendResults();
|
|
132
132
|
this.isSync = true;
|
|
133
133
|
}
|
|
@@ -146,6 +146,7 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
146
146
|
static transformError(testErrors) {
|
|
147
147
|
const err = new qase_javascript_commons_1.CompoundError();
|
|
148
148
|
for (const error of testErrors) {
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
149
150
|
if (error.message == undefined) {
|
|
150
151
|
continue;
|
|
151
152
|
}
|
|
@@ -216,6 +217,7 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
216
217
|
testResult.message = err === null ?
|
|
217
218
|
null : err.message === undefined ?
|
|
218
219
|
null : err.message;
|
|
220
|
+
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);
|
|
219
221
|
await this.reporter.addTestResult(testResult);
|
|
220
222
|
}
|
|
221
223
|
onBeforeCommand(command) {
|
|
@@ -325,8 +327,6 @@ class WDIOQaseReporter extends reporter_1.default {
|
|
|
325
327
|
curTest.fields = records;
|
|
326
328
|
}
|
|
327
329
|
addAttachment({ name, type, content, paths }) {
|
|
328
|
-
console.log('addAttachment');
|
|
329
|
-
console.log(name, type, content, paths);
|
|
330
330
|
const curTest = this.storage.getCurrentTest();
|
|
331
331
|
if (!curTest) {
|
|
332
332
|
return;
|
package/dist/storage.js
CHANGED
|
@@ -39,7 +39,7 @@ const findLast = (arr, predicate) => {
|
|
|
39
39
|
let result;
|
|
40
40
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
42
|
-
// @ts-
|
|
42
|
+
// @ts-expect-error
|
|
43
43
|
if (predicate(arr[i])) {
|
|
44
44
|
result = arr[i];
|
|
45
45
|
break;
|
package/dist/utils.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.isScreenshotCommand = exports.isEmpty = void 0;
|
|
|
6
6
|
* @param object {Object}
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
10
|
const isEmpty = (object) =>
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
11
12
|
!object || Object.keys(object).length === 0;
|
package/dist/wdio.d.ts
CHANGED
package/dist/wdio.js
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.qase = void 0;
|
|
4
4
|
const events_1 = require("./events");
|
|
5
|
-
const
|
|
5
|
+
const qase_javascript_commons_1 = require("qase-javascript-commons");
|
|
6
6
|
/**
|
|
7
7
|
* Send event to reporter
|
|
8
8
|
* @param {string} event - event name
|
|
9
9
|
* @param {object} msg - event payload
|
|
10
10
|
* @private
|
|
11
11
|
*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
13
|
const sendEvent = (event, msg = {}) => {
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
14
15
|
process.emit(event, msg);
|
|
15
16
|
};
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
16
18
|
class qase {
|
|
17
19
|
/**
|
|
18
20
|
* Assign QaseID to test
|
|
@@ -91,7 +93,7 @@ class qase {
|
|
|
91
93
|
* @param {StepFunction} body - the step content function
|
|
92
94
|
*/
|
|
93
95
|
static async step(name, body) {
|
|
94
|
-
const runningStep = new
|
|
96
|
+
const runningStep = new qase_javascript_commons_1.QaseStep(name);
|
|
95
97
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
96
98
|
await runningStep.run(body, async (message) => sendEvent(events_1.events.addStep, message));
|
|
97
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wdio-qase-reporter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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.
|
|
35
|
+
"qase-javascript-commons": "~2.3.3",
|
|
36
36
|
"uuid": "^9.0.1",
|
|
37
37
|
"@types/node": "^20.1.0",
|
|
38
38
|
"@wdio/reporter": "^8.39.0",
|
package/dist/step.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Attachment, TestStepType } from 'qase-javascript-commons';
|
|
2
|
-
export type StepFunction<T = any> = (this: QaseStep, step: QaseStep) => T | Promise<T>;
|
|
3
|
-
export declare class QaseStep {
|
|
4
|
-
name: string;
|
|
5
|
-
attachments: Attachment[];
|
|
6
|
-
steps: TestStepType[];
|
|
7
|
-
constructor(name: string);
|
|
8
|
-
attach(attach: {
|
|
9
|
-
name?: string;
|
|
10
|
-
type?: string;
|
|
11
|
-
content?: string;
|
|
12
|
-
paths?: string[] | string;
|
|
13
|
-
}): void;
|
|
14
|
-
step(name: string, body: StepFunction): Promise<void>;
|
|
15
|
-
run(body: StepFunction, messageEmitter: (step: TestStepType) => Promise<void>): Promise<void>;
|
|
16
|
-
}
|
package/dist/step.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.QaseStep = void 0;
|
|
7
|
-
const qase_javascript_commons_1 = require("qase-javascript-commons");
|
|
8
|
-
const uuid_1 = require("uuid");
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
class QaseStep {
|
|
11
|
-
name = '';
|
|
12
|
-
attachments = [];
|
|
13
|
-
steps = [];
|
|
14
|
-
constructor(name) {
|
|
15
|
-
this.name = name;
|
|
16
|
-
}
|
|
17
|
-
attach(attach) {
|
|
18
|
-
if (attach.paths) {
|
|
19
|
-
const files = Array.isArray(attach.paths) ? attach.paths : [attach.paths];
|
|
20
|
-
for (const file of files) {
|
|
21
|
-
const attachmentName = path_1.default.basename(file);
|
|
22
|
-
const contentType = 'application/octet-stream';
|
|
23
|
-
this.attachments.push({
|
|
24
|
-
id: (0, uuid_1.v4)(),
|
|
25
|
-
file_name: attachmentName,
|
|
26
|
-
mime_type: contentType,
|
|
27
|
-
content: '',
|
|
28
|
-
file_path: file,
|
|
29
|
-
size: 0,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (attach.content) {
|
|
35
|
-
const attachmentName = attach.name ?? 'attachment';
|
|
36
|
-
const contentType = attach.type ?? 'application/octet-stream';
|
|
37
|
-
this.attachments.push({
|
|
38
|
-
id: (0, uuid_1.v4)(),
|
|
39
|
-
file_name: attachmentName,
|
|
40
|
-
mime_type: contentType,
|
|
41
|
-
content: attach.content,
|
|
42
|
-
file_path: null,
|
|
43
|
-
size: attach.content.length,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async step(name, body) {
|
|
48
|
-
const childStep = new QaseStep(name);
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
50
|
-
await childStep.run(body, async (step) => {
|
|
51
|
-
this.steps.push(step);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
async run(body, messageEmitter) {
|
|
55
|
-
const startDate = new Date().getTime();
|
|
56
|
-
const step = new qase_javascript_commons_1.TestStepType();
|
|
57
|
-
step.data = {
|
|
58
|
-
action: this.name,
|
|
59
|
-
expected_result: null,
|
|
60
|
-
data: null,
|
|
61
|
-
};
|
|
62
|
-
try {
|
|
63
|
-
await body.call(this, this);
|
|
64
|
-
step.execution = {
|
|
65
|
-
start_time: startDate,
|
|
66
|
-
end_time: new Date().getTime(),
|
|
67
|
-
status: qase_javascript_commons_1.StepStatusEnum.passed,
|
|
68
|
-
duration: null,
|
|
69
|
-
};
|
|
70
|
-
step.attachments = this.attachments;
|
|
71
|
-
step.steps = this.steps;
|
|
72
|
-
await messageEmitter(step);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
step.execution = {
|
|
76
|
-
start_time: startDate,
|
|
77
|
-
end_time: new Date().getTime(),
|
|
78
|
-
status: qase_javascript_commons_1.StepStatusEnum.failed,
|
|
79
|
-
duration: null,
|
|
80
|
-
};
|
|
81
|
-
step.attachments = this.attachments;
|
|
82
|
-
step.steps = this.steps;
|
|
83
|
-
await messageEmitter(step);
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.QaseStep = QaseStep;
|