cypress-qase-reporter 2.2.0-beta.1 → 2.2.0-beta.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 +3 -2
- package/changelog.md +34 -0
- package/dist/metadata/manager.d.ts +6 -1
- package/dist/metadata/manager.js +102 -0
- package/dist/metadata/models.d.ts +24 -0
- package/dist/metadata.js +18 -0
- package/dist/mocha.d.ts +41 -7
- package/dist/mocha.js +44 -7
- package/dist/reporter.d.ts +1 -0
- package/dist/reporter.js +42 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -106,6 +106,7 @@ parameterize your tests.
|
|
|
106
106
|
- `qase.parameters` - set the parameters of the test case
|
|
107
107
|
- `qase.groupParameters` - set the group parameters of the test case
|
|
108
108
|
- `qase.ignore` - ignore the test case in Qase. The test will be executed, but the results will not be sent to Qase.
|
|
109
|
+
- `qase.step` - create a step in the test case
|
|
109
110
|
|
|
110
111
|
For example:
|
|
111
112
|
|
|
@@ -206,8 +207,8 @@ module.exports = cypress.defineConfig({
|
|
|
206
207
|
video: false,
|
|
207
208
|
e2e: {
|
|
208
209
|
setupNodeEvents(on, config) {
|
|
209
|
-
|
|
210
|
-
|
|
210
|
+
require('cypress-qase-reporter/plugin')(on, config)
|
|
211
|
+
require('cypress-qase-reporter/metadata')(on)
|
|
211
212
|
},
|
|
212
213
|
},
|
|
213
214
|
});
|
package/changelog.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# cypress-qase-reporter@2.2.0-beta.3
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Added the ability to add attachments to tests or steps:
|
|
6
|
+
|
|
7
|
+
- `qase.attach` - add an attachment to test or step
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
it('test', () => {
|
|
11
|
+
qase.attach({ paths: '/path/to/file' });
|
|
12
|
+
qase.step('Step 1', () => {
|
|
13
|
+
cy.visit('https://example.com');
|
|
14
|
+
qase.attach({ name: 'attachment.txt', content: 'Hello, world!', contentType: 'text/plain' });
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# cypress-qase-reporter@2.2.0-beta.2
|
|
20
|
+
|
|
21
|
+
## What's new
|
|
22
|
+
|
|
23
|
+
Added the ability to add steps in tests:
|
|
24
|
+
|
|
25
|
+
- `qase.step` - add a step to the test
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
it('test', () => {
|
|
29
|
+
qase.step('Step 1', () => {
|
|
30
|
+
cy.visit('https://example.com');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
1
35
|
# cypress-qase-reporter@2.2.0-beta.1
|
|
2
36
|
|
|
3
37
|
## What's new
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { Metadata } from './models';
|
|
1
|
+
import { Attach, Metadata } from './models';
|
|
2
|
+
import { Attachment } from 'qase-javascript-commons';
|
|
2
3
|
export declare class MetadataManager {
|
|
3
4
|
static getMetadata(): Metadata | undefined;
|
|
4
5
|
static setIgnore(): void;
|
|
6
|
+
static addStepStart(name: string): void;
|
|
7
|
+
static addStepEnd(status: string): void;
|
|
8
|
+
static addAttach(attach: Attach): void;
|
|
5
9
|
static setSuite(suite: string): void;
|
|
6
10
|
static setComment(comment: string): void;
|
|
7
11
|
static setTitle(title: string): void;
|
|
@@ -11,4 +15,5 @@ export declare class MetadataManager {
|
|
|
11
15
|
private static setMetadata;
|
|
12
16
|
static clear(): void;
|
|
13
17
|
static isExists(): boolean;
|
|
18
|
+
static prepareAttach(attach: Attach): Attachment[];
|
|
14
19
|
}
|
package/dist/metadata/manager.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.MetadataManager = void 0;
|
|
4
7
|
const fs_1 = require("fs");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const qase_javascript_commons_1 = require("qase-javascript-commons");
|
|
5
11
|
const metadataPath = 'qaseMetadata';
|
|
6
12
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
7
13
|
class MetadataManager {
|
|
@@ -17,6 +23,11 @@ class MetadataManager {
|
|
|
17
23
|
ignore: false,
|
|
18
24
|
suite: undefined,
|
|
19
25
|
comment: undefined,
|
|
26
|
+
steps: [],
|
|
27
|
+
currentStepId: undefined,
|
|
28
|
+
firstStepName: undefined,
|
|
29
|
+
attachments: [],
|
|
30
|
+
stepAttachments: {},
|
|
20
31
|
};
|
|
21
32
|
try {
|
|
22
33
|
const data = (0, fs_1.readFileSync)(metadataPath, 'utf8');
|
|
@@ -33,6 +44,55 @@ class MetadataManager {
|
|
|
33
44
|
metadata.ignore = true;
|
|
34
45
|
this.setMetadata(metadata);
|
|
35
46
|
}
|
|
47
|
+
static addStepStart(name) {
|
|
48
|
+
const metadata = this.getMetadata() ?? {};
|
|
49
|
+
if (metadata.firstStepName === name) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!metadata.steps) {
|
|
53
|
+
metadata.steps = [];
|
|
54
|
+
}
|
|
55
|
+
const id = (0, uuid_1.v4)();
|
|
56
|
+
const parentId = metadata.currentStepId ?? undefined;
|
|
57
|
+
metadata.steps.push({ timestamp: Date.now(), name, id: id, parentId: parentId });
|
|
58
|
+
metadata.currentStepId = id;
|
|
59
|
+
if (!metadata.firstStepName) {
|
|
60
|
+
metadata.firstStepName = name;
|
|
61
|
+
}
|
|
62
|
+
this.setMetadata(metadata);
|
|
63
|
+
}
|
|
64
|
+
static addStepEnd(status) {
|
|
65
|
+
const metadata = this.getMetadata() ?? {};
|
|
66
|
+
if (!metadata.steps || !metadata.currentStepId) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const parentId = metadata.steps.reverse().find((step) => step.id === metadata.currentStepId)?.parentId;
|
|
70
|
+
metadata.steps.push({ timestamp: Date.now(), status, id: metadata.currentStepId });
|
|
71
|
+
metadata.currentStepId = parentId;
|
|
72
|
+
this.setMetadata(metadata);
|
|
73
|
+
}
|
|
74
|
+
static addAttach(attach) {
|
|
75
|
+
const metadata = this.getMetadata() ?? {};
|
|
76
|
+
if (!metadata.attachments) {
|
|
77
|
+
metadata.attachments = [];
|
|
78
|
+
}
|
|
79
|
+
if (!metadata.stepAttachments) {
|
|
80
|
+
metadata.stepAttachments = {};
|
|
81
|
+
}
|
|
82
|
+
const attachments = this.prepareAttach(attach);
|
|
83
|
+
if (metadata.currentStepId) {
|
|
84
|
+
if (metadata.stepAttachments[metadata.currentStepId] === undefined) {
|
|
85
|
+
metadata.stepAttachments[metadata.currentStepId] = attachments;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
metadata.stepAttachments[metadata.currentStepId]?.push(...attachments);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
metadata.attachments.push(...attachments);
|
|
93
|
+
}
|
|
94
|
+
this.setMetadata(metadata);
|
|
95
|
+
}
|
|
36
96
|
static setSuite(suite) {
|
|
37
97
|
const metadata = this.getMetadata() ?? {};
|
|
38
98
|
metadata.suite = suite;
|
|
@@ -86,5 +146,47 @@ class MetadataManager {
|
|
|
86
146
|
static isExists() {
|
|
87
147
|
return (0, fs_1.existsSync)(metadataPath);
|
|
88
148
|
}
|
|
149
|
+
static prepareAttach(attach) {
|
|
150
|
+
const attachments = [];
|
|
151
|
+
if (attach.paths) {
|
|
152
|
+
if (Array.isArray(attach.paths)) {
|
|
153
|
+
attach.paths.forEach((file) => {
|
|
154
|
+
const attachmentName = path_1.default.basename(file);
|
|
155
|
+
const contentType = (0, qase_javascript_commons_1.getMimeTypes)(file);
|
|
156
|
+
attachments.push({
|
|
157
|
+
file_name: attachmentName,
|
|
158
|
+
mime_type: contentType,
|
|
159
|
+
file_path: file,
|
|
160
|
+
content: '',
|
|
161
|
+
size: 0,
|
|
162
|
+
id: (0, uuid_1.v4)(),
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
const attachmentName = path_1.default.basename(attach.paths);
|
|
168
|
+
const contentType = (0, qase_javascript_commons_1.getMimeTypes)(attach.paths);
|
|
169
|
+
attachments.push({
|
|
170
|
+
file_name: attachmentName,
|
|
171
|
+
mime_type: contentType,
|
|
172
|
+
file_path: attach.paths,
|
|
173
|
+
content: '',
|
|
174
|
+
size: 0,
|
|
175
|
+
id: (0, uuid_1.v4)(),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else if (attach.content) {
|
|
180
|
+
attachments.push({
|
|
181
|
+
file_name: attach.name ?? 'attachment',
|
|
182
|
+
mime_type: attach.contentType ?? 'application/octet-stream',
|
|
183
|
+
file_path: null,
|
|
184
|
+
content: attach.content,
|
|
185
|
+
size: 0,
|
|
186
|
+
id: (0, uuid_1.v4)(),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return attachments;
|
|
190
|
+
}
|
|
89
191
|
}
|
|
90
192
|
exports.MetadataManager = MetadataManager;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Attachment } from 'qase-javascript-commons';
|
|
1
3
|
export interface Metadata {
|
|
2
4
|
title?: string | undefined;
|
|
3
5
|
fields?: Record<string, string>;
|
|
@@ -6,4 +8,26 @@ export interface Metadata {
|
|
|
6
8
|
ignore?: boolean;
|
|
7
9
|
suite?: string | undefined;
|
|
8
10
|
comment?: string | undefined;
|
|
11
|
+
steps?: (StepStart | StepEnd)[];
|
|
12
|
+
currentStepId?: string | undefined;
|
|
13
|
+
firstStepName?: string | undefined;
|
|
14
|
+
attachments?: Attachment[];
|
|
15
|
+
stepAttachments?: Record<string, Attachment[]>;
|
|
16
|
+
}
|
|
17
|
+
export interface StepStart {
|
|
18
|
+
id: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
name: string;
|
|
21
|
+
parentId: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface StepEnd {
|
|
24
|
+
id: string;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
status: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Attach {
|
|
29
|
+
name?: string;
|
|
30
|
+
paths?: string | string[];
|
|
31
|
+
content?: Buffer | string;
|
|
32
|
+
contentType?: string;
|
|
9
33
|
}
|
package/dist/metadata.js
CHANGED
|
@@ -44,4 +44,22 @@ module.exports = function (on) {
|
|
|
44
44
|
return null;
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
|
+
on('task', {
|
|
48
|
+
qaseStepStart(value) {
|
|
49
|
+
manager_1.MetadataManager.addStepStart(value);
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
on('task', {
|
|
54
|
+
qaseStepEnd(value) {
|
|
55
|
+
manager_1.MetadataManager.addStepEnd(value);
|
|
56
|
+
return null;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
on('task', {
|
|
60
|
+
qaseAttach(value) {
|
|
61
|
+
manager_1.MetadataManager.addAttach(value);
|
|
62
|
+
return null;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
47
65
|
};
|
package/dist/mocha.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
/// <reference types="cypress" />
|
|
4
|
+
/// <reference types="cypress" />
|
|
5
|
+
/// <reference types="node" />
|
|
2
6
|
import { Test } from 'mocha';
|
|
3
7
|
export declare const qase: {
|
|
4
8
|
(caseId: number | string | number[] | string[], test: Test): Test;
|
|
@@ -11,7 +15,7 @@ export declare const qase: {
|
|
|
11
15
|
* cy.visit('https://example.com');
|
|
12
16
|
* });
|
|
13
17
|
*/
|
|
14
|
-
title(value: string): void
|
|
18
|
+
title(value: string): Cypress.Chainable<JQuery<void>>;
|
|
15
19
|
/**
|
|
16
20
|
* Set fields for the test case
|
|
17
21
|
* @param {Record<string, string>} values
|
|
@@ -21,7 +25,7 @@ export declare const qase: {
|
|
|
21
25
|
* cy.visit('https://example.com');
|
|
22
26
|
* });
|
|
23
27
|
*/
|
|
24
|
-
fields(values: Record<string, string>): void
|
|
28
|
+
fields(values: Record<string, string>): Cypress.Chainable<JQuery<void>>;
|
|
25
29
|
/**
|
|
26
30
|
* Ignore the test case result in Qase
|
|
27
31
|
* @example
|
|
@@ -30,7 +34,7 @@ export declare const qase: {
|
|
|
30
34
|
* cy.visit('https://example.com');
|
|
31
35
|
* });
|
|
32
36
|
*/
|
|
33
|
-
ignore(): void
|
|
37
|
+
ignore(): Cypress.Chainable<JQuery<void>>;
|
|
34
38
|
/**
|
|
35
39
|
* Set parameters for the test case
|
|
36
40
|
* @param {Record<string, string>} values
|
|
@@ -40,7 +44,7 @@ export declare const qase: {
|
|
|
40
44
|
* cy.visit('https://example.com');
|
|
41
45
|
* });
|
|
42
46
|
*/
|
|
43
|
-
parameters(values: Record<string, string>): void
|
|
47
|
+
parameters(values: Record<string, string>): Cypress.Chainable<JQuery<void>>;
|
|
44
48
|
/**
|
|
45
49
|
* Set group parameters for the test case
|
|
46
50
|
* @param {Record<string, string>} values
|
|
@@ -50,7 +54,7 @@ export declare const qase: {
|
|
|
50
54
|
* cy.visit('https://example.com');
|
|
51
55
|
* });
|
|
52
56
|
*/
|
|
53
|
-
groupParameters(values: Record<string, string>): void
|
|
57
|
+
groupParameters(values: Record<string, string>): Cypress.Chainable<JQuery<void>>;
|
|
54
58
|
/**
|
|
55
59
|
* Set a suite for the test case
|
|
56
60
|
* @param {string} value
|
|
@@ -60,7 +64,7 @@ export declare const qase: {
|
|
|
60
64
|
* cy.visit('https://example.com');
|
|
61
65
|
* });
|
|
62
66
|
*/
|
|
63
|
-
suite(value: string): void
|
|
67
|
+
suite(value: string): Cypress.Chainable<JQuery<void>>;
|
|
64
68
|
/**
|
|
65
69
|
* Set a comment for the test case
|
|
66
70
|
* @param {string} value
|
|
@@ -70,5 +74,35 @@ export declare const qase: {
|
|
|
70
74
|
* cy.visit('https://example.com');
|
|
71
75
|
* });
|
|
72
76
|
*/
|
|
73
|
-
comment(value: string): void
|
|
77
|
+
comment(value: string): Cypress.Chainable<JQuery<void>>;
|
|
78
|
+
/**
|
|
79
|
+
* Add a step to the test case
|
|
80
|
+
* @param {string} name
|
|
81
|
+
* @param {() => T | PromiseLike<T>} body
|
|
82
|
+
* @example
|
|
83
|
+
* it('test', () => {
|
|
84
|
+
* qase.step("Some step", () => {
|
|
85
|
+
* // some actions
|
|
86
|
+
* });
|
|
87
|
+
* cy.visit('https://example.com');
|
|
88
|
+
* });
|
|
89
|
+
*/
|
|
90
|
+
step<T = void>(name: string, body: () => T | PromiseLike<T>): Cypress.Chainable<JQuery<void>>;
|
|
91
|
+
/**
|
|
92
|
+
* Attach a file to the test case or the step
|
|
93
|
+
* @param attach
|
|
94
|
+
* @example
|
|
95
|
+
* it('test', () => {
|
|
96
|
+
* qase.attach({ name: 'attachment.txt', content: 'Hello, world!', contentType: 'text/plain' });
|
|
97
|
+
* qase.attach({ paths: '/path/to/file'});
|
|
98
|
+
* qase.attach({ paths: ['/path/to/file', '/path/to/another/file']});
|
|
99
|
+
* cy.visit('https://example.com');
|
|
100
|
+
* });
|
|
101
|
+
*/
|
|
102
|
+
attach(attach: {
|
|
103
|
+
name?: string;
|
|
104
|
+
paths?: string | string[];
|
|
105
|
+
content?: Buffer | string;
|
|
106
|
+
contentType?: string;
|
|
107
|
+
}): Cypress.Chainable<JQuery<void>>;
|
|
74
108
|
};
|
package/dist/mocha.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.qase = qase;
|
|
|
17
17
|
* });
|
|
18
18
|
*/
|
|
19
19
|
exports.qase.title = (value) => {
|
|
20
|
-
cy.task('qaseTitle', value).then(() => {
|
|
20
|
+
return cy.task('qaseTitle', value).then(() => {
|
|
21
21
|
//
|
|
22
22
|
});
|
|
23
23
|
};
|
|
@@ -31,7 +31,7 @@ exports.qase.title = (value) => {
|
|
|
31
31
|
* });
|
|
32
32
|
*/
|
|
33
33
|
exports.qase.fields = (values) => {
|
|
34
|
-
cy.task('qaseFields', values).then(() => {
|
|
34
|
+
return cy.task('qaseFields', values).then(() => {
|
|
35
35
|
//
|
|
36
36
|
});
|
|
37
37
|
};
|
|
@@ -44,7 +44,7 @@ exports.qase.fields = (values) => {
|
|
|
44
44
|
* });
|
|
45
45
|
*/
|
|
46
46
|
exports.qase.ignore = () => {
|
|
47
|
-
cy.task('qaseIgnore').then(() => {
|
|
47
|
+
return cy.task('qaseIgnore').then(() => {
|
|
48
48
|
//
|
|
49
49
|
});
|
|
50
50
|
};
|
|
@@ -58,7 +58,7 @@ exports.qase.ignore = () => {
|
|
|
58
58
|
* });
|
|
59
59
|
*/
|
|
60
60
|
exports.qase.parameters = (values) => {
|
|
61
|
-
cy.task('qaseParameters', values).then(() => {
|
|
61
|
+
return cy.task('qaseParameters', values).then(() => {
|
|
62
62
|
//
|
|
63
63
|
});
|
|
64
64
|
};
|
|
@@ -72,7 +72,7 @@ exports.qase.parameters = (values) => {
|
|
|
72
72
|
* });
|
|
73
73
|
*/
|
|
74
74
|
exports.qase.groupParameters = (values) => {
|
|
75
|
-
cy.task('qaseGroupParameters', values).then(() => {
|
|
75
|
+
return cy.task('qaseGroupParameters', values).then(() => {
|
|
76
76
|
//
|
|
77
77
|
});
|
|
78
78
|
};
|
|
@@ -86,7 +86,7 @@ exports.qase.groupParameters = (values) => {
|
|
|
86
86
|
* });
|
|
87
87
|
*/
|
|
88
88
|
exports.qase.suite = (value) => {
|
|
89
|
-
cy.task('qaseSuite', value).then(() => {
|
|
89
|
+
return cy.task('qaseSuite', value).then(() => {
|
|
90
90
|
//
|
|
91
91
|
});
|
|
92
92
|
};
|
|
@@ -100,7 +100,44 @@ exports.qase.suite = (value) => {
|
|
|
100
100
|
* });
|
|
101
101
|
*/
|
|
102
102
|
exports.qase.comment = (value) => {
|
|
103
|
-
cy.task('qaseComment', value).then(() => {
|
|
103
|
+
return cy.task('qaseComment', value).then(() => {
|
|
104
|
+
//
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Add a step to the test case
|
|
109
|
+
* @param {string} name
|
|
110
|
+
* @param {() => T | PromiseLike<T>} body
|
|
111
|
+
* @example
|
|
112
|
+
* it('test', () => {
|
|
113
|
+
* qase.step("Some step", () => {
|
|
114
|
+
* // some actions
|
|
115
|
+
* });
|
|
116
|
+
* cy.visit('https://example.com');
|
|
117
|
+
* });
|
|
118
|
+
*/
|
|
119
|
+
exports.qase.step = (name, body) => {
|
|
120
|
+
return cy.task('qaseStepStart', name).then(() => {
|
|
121
|
+
return Cypress.Promise.resolve(body());
|
|
122
|
+
}).then(() => {
|
|
123
|
+
cy.task('qaseStepEnd', 'passed').then(() => {
|
|
124
|
+
//
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Attach a file to the test case or the step
|
|
130
|
+
* @param attach
|
|
131
|
+
* @example
|
|
132
|
+
* it('test', () => {
|
|
133
|
+
* qase.attach({ name: 'attachment.txt', content: 'Hello, world!', contentType: 'text/plain' });
|
|
134
|
+
* qase.attach({ paths: '/path/to/file'});
|
|
135
|
+
* qase.attach({ paths: ['/path/to/file', '/path/to/another/file']});
|
|
136
|
+
* cy.visit('https://example.com');
|
|
137
|
+
* });
|
|
138
|
+
*/
|
|
139
|
+
exports.qase.attach = (attach) => {
|
|
140
|
+
return cy.task('qaseAttach', attach).then(() => {
|
|
104
141
|
//
|
|
105
142
|
});
|
|
106
143
|
};
|
package/dist/reporter.d.ts
CHANGED
package/dist/reporter.js
CHANGED
|
@@ -107,6 +107,7 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
|
|
|
107
107
|
const attachments = this.screenshotsFolder
|
|
108
108
|
? CypressQaseReporter.findAttachments(ids, this.screenshotsFolder)
|
|
109
109
|
: undefined;
|
|
110
|
+
attachments?.push(...(metadata?.attachments ?? []));
|
|
110
111
|
let relations = {};
|
|
111
112
|
if (test.parent !== undefined) {
|
|
112
113
|
const data = [];
|
|
@@ -155,7 +156,7 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
|
|
|
155
156
|
relations: relations,
|
|
156
157
|
run_id: null,
|
|
157
158
|
signature: this.getSignature(test, ids),
|
|
158
|
-
steps: [],
|
|
159
|
+
steps: metadata?.steps ? this.getSteps(metadata.steps, metadata.stepAttachments ?? {}) : [],
|
|
159
160
|
id: (0, uuid_1.v4)(),
|
|
160
161
|
execution: {
|
|
161
162
|
status: test.state
|
|
@@ -208,6 +209,46 @@ class CypressQaseReporter extends mocha_1.reporters.Base {
|
|
|
208
209
|
}
|
|
209
210
|
return undefined;
|
|
210
211
|
}
|
|
212
|
+
getSteps(steps, attachments) {
|
|
213
|
+
const result = [];
|
|
214
|
+
const stepMap = new Map();
|
|
215
|
+
for (const step of steps.sort((a, b) => a.timestamp - b.timestamp)) {
|
|
216
|
+
if (!('status' in step)) {
|
|
217
|
+
const newStep = new qase_javascript_commons_1.TestStepType();
|
|
218
|
+
newStep.id = step.id;
|
|
219
|
+
newStep.execution.status = qase_javascript_commons_1.StepStatusEnum.failed;
|
|
220
|
+
newStep.execution.start_time = step.timestamp;
|
|
221
|
+
newStep.execution.end_time = Date.now();
|
|
222
|
+
newStep.data = {
|
|
223
|
+
action: step.name,
|
|
224
|
+
expected_result: null,
|
|
225
|
+
};
|
|
226
|
+
if (attachments[step.id]) {
|
|
227
|
+
newStep.attachments = attachments[step.id] ?? [];
|
|
228
|
+
}
|
|
229
|
+
const parentId = step.parentId;
|
|
230
|
+
if (parentId) {
|
|
231
|
+
newStep.parent_id = parentId;
|
|
232
|
+
const parent = stepMap.get(parentId);
|
|
233
|
+
if (parent) {
|
|
234
|
+
parent.steps.push(newStep);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
result.push(newStep);
|
|
239
|
+
}
|
|
240
|
+
stepMap.set(step.id, newStep);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const stepType = stepMap.get(step.id);
|
|
244
|
+
if (stepType) {
|
|
245
|
+
stepType.execution.status = step.status;
|
|
246
|
+
stepType.execution.end_time = step.timestamp;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
211
252
|
}
|
|
212
253
|
exports.CypressQaseReporter = CypressQaseReporter;
|
|
213
254
|
/**
|