@testomatio/reporter 1.6.0-beta-2-artifacts → 2.0.0-beta-esm
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/lib/adapter/codecept.js +288 -330
- package/lib/adapter/cucumber/current.js +195 -203
- package/lib/adapter/cucumber/legacy.js +130 -155
- package/lib/adapter/cucumber.js +5 -16
- package/lib/adapter/cypress-plugin/index.js +91 -105
- package/lib/adapter/jasmine/jasmine.js +63 -0
- package/lib/adapter/jasmine.js +54 -53
- package/lib/adapter/jest.js +97 -99
- package/lib/adapter/mocha/mocha.js +125 -0
- package/lib/adapter/mocha.js +111 -140
- package/lib/adapter/playwright.js +168 -200
- package/lib/adapter/vitest.js +144 -143
- package/lib/adapter/webdriver.js +113 -97
- package/lib/bin/reportXml.js +49 -49
- package/lib/bin/startTest.js +80 -97
- package/lib/client.js +344 -385
- package/lib/config.js +16 -21
- package/lib/constants.js +49 -43
- package/lib/data-storage.js +206 -188
- package/lib/fileUploader.js +245 -0
- package/lib/junit-adapter/adapter.js +17 -20
- package/lib/junit-adapter/csharp.js +18 -14
- package/lib/junit-adapter/index.js +27 -25
- package/lib/junit-adapter/java.js +41 -53
- package/lib/junit-adapter/javascript.js +30 -27
- package/lib/junit-adapter/python.js +38 -37
- package/lib/junit-adapter/ruby.js +11 -8
- package/lib/output.js +44 -52
- package/lib/package.json +1 -0
- package/lib/pipe/bitbucket.js +208 -227
- package/lib/pipe/csv.js +111 -124
- package/lib/pipe/github.js +184 -211
- package/lib/pipe/gitlab.js +164 -205
- package/lib/pipe/html.js +253 -312
- package/lib/pipe/index.js +83 -63
- package/lib/pipe/testomatio.js +391 -454
- package/lib/reporter-functions.js +16 -20
- package/lib/reporter.js +47 -17
- package/lib/services/artifacts.js +55 -51
- package/lib/services/index.js +14 -12
- package/lib/services/key-values.js +56 -53
- package/lib/services/logger.js +227 -245
- package/lib/utils/chalk.js +10 -0
- package/lib/utils/pipe_utils.js +91 -84
- package/lib/utils/utils.js +289 -273
- package/lib/xmlReader.js +480 -519
- package/package.json +57 -19
- package/src/adapter/codecept.js +369 -0
- package/src/adapter/cucumber/current.js +228 -0
- package/src/adapter/cucumber/legacy.js +158 -0
- package/src/adapter/cucumber.js +4 -0
- package/src/adapter/cypress-plugin/index.js +110 -0
- package/src/adapter/jasmine.js +60 -0
- package/src/adapter/jest.js +107 -0
- package/src/adapter/mocha.cjs +2 -0
- package/src/adapter/mocha.js +156 -0
- package/src/adapter/playwright.js +222 -0
- package/src/adapter/vitest.js +183 -0
- package/src/adapter/webdriver.js +111 -0
- package/src/bin/reportXml.js +67 -0
- package/src/bin/startTest.js +119 -0
- package/src/client.js +423 -0
- package/src/config.js +30 -0
- package/src/constants.js +49 -0
- package/src/data-storage.js +204 -0
- package/src/fileUploader.js +307 -0
- package/src/junit-adapter/adapter.js +23 -0
- package/src/junit-adapter/csharp.js +16 -0
- package/src/junit-adapter/index.js +28 -0
- package/src/junit-adapter/java.js +58 -0
- package/src/junit-adapter/javascript.js +31 -0
- package/src/junit-adapter/python.js +42 -0
- package/src/junit-adapter/ruby.js +10 -0
- package/src/output.js +57 -0
- package/src/pipe/bitbucket.js +254 -0
- package/src/pipe/csv.js +140 -0
- package/src/pipe/github.js +234 -0
- package/src/pipe/gitlab.js +229 -0
- package/src/pipe/html.js +366 -0
- package/src/pipe/index.js +73 -0
- package/src/pipe/testomatio.js +498 -0
- package/src/reporter-functions.js +44 -0
- package/src/reporter.cjs +22 -0
- package/src/reporter.js +24 -0
- package/src/services/artifacts.js +59 -0
- package/src/services/index.js +13 -0
- package/src/services/key-values.js +59 -0
- package/src/services/logger.js +314 -0
- package/src/template/emptyData.svg +23 -0
- package/src/template/testomatio.hbs +1421 -0
- package/src/utils/chalk.js +13 -0
- package/src/utils/pipe_utils.js +127 -0
- package/src/utils/utils.js +341 -0
- package/src/xmlReader.js +551 -0
- package/lib/bin/cli.js +0 -216
- package/lib/bin/uploadArtifacts.js +0 -86
- package/lib/uploader.js +0 -312
|
@@ -1,224 +1,216 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
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.CucumberReporter = void 0;
|
|
7
|
+
const cucumber_1 = require("@cucumber/cucumber");
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const constants_js_1 = require("../../constants.js");
|
|
11
|
+
const client_js_1 = __importDefault(require("../../client.js"));
|
|
12
|
+
const utils_js_1 = require("../../utils/utils.js");
|
|
13
|
+
const config_js_1 = require("../../config.js");
|
|
14
|
+
const index_js_1 = require("../../services/index.js");
|
|
15
|
+
const { GherkinDocumentParser, PickleParser } = cucumber_1.formatterHelpers;
|
|
12
16
|
const { getGherkinScenarioLocationMap, getGherkinStepMap } = GherkinDocumentParser;
|
|
13
17
|
const { getPickleStepMap } = PickleParser;
|
|
14
|
-
|
|
15
18
|
function getTestId(scenario) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (scenario) {
|
|
20
|
+
for (const tag of scenario.tags) {
|
|
21
|
+
const testId = (0, utils_js_1.getTestomatIdFromTestTitle)(tag.name);
|
|
22
|
+
if (testId)
|
|
23
|
+
return testId;
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return null;
|
|
26
|
+
return null;
|
|
24
27
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.status = STATUS.PASSED;
|
|
35
|
-
this.client.createRun();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
parseEnvelope(envelope) {
|
|
39
|
-
if (envelope.testRunStarted) {
|
|
40
|
-
fileSystem.clearDir(TESTOMAT_TMP_STORAGE_DIR);
|
|
41
|
-
}
|
|
42
|
-
if (envelope.testCaseStarted && this.client) this.onTestCaseStarted(envelope.testCaseStarted);
|
|
43
|
-
if (envelope.testCaseFinished) this.onTestCaseFinished(envelope.testCaseFinished);
|
|
44
|
-
if (envelope.testRunFinished) this.onTestRunFinished(envelope);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
onTestCaseStarted(testCaseStarted) {
|
|
48
|
-
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseStarted.id);
|
|
49
|
-
if (!global.testomatioDataStore) global.testomatioDataStore = {};
|
|
50
|
-
|
|
51
|
-
const testTitle = testCaseAttempt.pickle.name + testCaseAttempt.pickle.uri;
|
|
52
|
-
services.setContext(testTitle);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
onTestCaseFinished(testCaseFinished) {
|
|
56
|
-
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId);
|
|
57
|
-
|
|
58
|
-
let example;
|
|
59
|
-
|
|
60
|
-
let status = STATUS.PASSED;
|
|
61
|
-
let color = 'green';
|
|
62
|
-
let message;
|
|
63
|
-
|
|
64
|
-
this.cases.push(testCaseAttempt);
|
|
65
|
-
|
|
66
|
-
if (testCaseAttempt.worstTestStepResult) {
|
|
67
|
-
if (testCaseAttempt.worstTestStepResult.status === 'SKIPPED') {
|
|
68
|
-
status = STATUS.SKIPPED;
|
|
69
|
-
}
|
|
70
|
-
// if (testCaseAttempt.worstTestStepResult.status === 'UNDEFINED') {
|
|
71
|
-
// status = STATUS.SKIPPED;
|
|
72
|
-
// message = 'Undefined steps. Implement missing steps and rerun this scenario';
|
|
73
|
-
// }
|
|
74
|
-
if (testCaseAttempt.worstTestStepResult.status === 'FAILED') {
|
|
75
|
-
message = testCaseAttempt?.worstTestStepResult?.message;
|
|
76
|
-
status = STATUS.FAILED;
|
|
77
|
-
}
|
|
78
|
-
color = getStatusColor(testCaseAttempt.worstTestStepResult.status);
|
|
79
|
-
if (status !== STATUS.PASSED) this.failures.push(testCaseAttempt);
|
|
28
|
+
class CucumberReporter extends cucumber_1.Formatter {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super(options);
|
|
31
|
+
options.eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
|
|
32
|
+
this.failures = [];
|
|
33
|
+
this.cases = [];
|
|
34
|
+
this.client = new client_js_1.default({ apiKey: options.apiKey || config_js_1.config.TESTOMATIO });
|
|
35
|
+
this.client.createRun();
|
|
36
|
+
this.status = constants_js_1.STATUS.PASSED;
|
|
80
37
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
38
|
+
parseEnvelope(envelope) {
|
|
39
|
+
if (envelope.testRunStarted) {
|
|
40
|
+
utils_js_1.fileSystem.clearDir(constants_js_1.TESTOMAT_TMP_STORAGE_DIR);
|
|
41
|
+
}
|
|
42
|
+
if (envelope.testCaseStarted && this.client) {
|
|
43
|
+
this.onTestCaseStarted(envelope.testCaseStarted);
|
|
44
|
+
}
|
|
45
|
+
if (envelope.testCaseFinished)
|
|
46
|
+
this.onTestCaseFinished(envelope.testCaseFinished);
|
|
47
|
+
if (envelope.testRunFinished)
|
|
48
|
+
this.onTestRunFinished(envelope);
|
|
86
49
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
let exampleString = '';
|
|
94
|
-
if (example) exampleString = ` ${example.join(' | ')}`;
|
|
95
|
-
let cliMessage = `${chalk.bold(scenario)}${exampleString}: ${chalk[color].bold(status.toUpperCase())} `;
|
|
96
|
-
|
|
97
|
-
if (message) cliMessage += chalk.gray(message.split('\n')[0]);
|
|
98
|
-
console.log(cliMessage);
|
|
99
|
-
|
|
100
|
-
if (status !== STATUS.PASSED && status !== STATUS.SKIPPED) {
|
|
101
|
-
this.status = STATUS.FAILED;
|
|
50
|
+
onTestCaseStarted(testCaseStarted) {
|
|
51
|
+
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseStarted.id);
|
|
52
|
+
if (!global.testomatioDataStore)
|
|
53
|
+
global.testomatioDataStore = {};
|
|
54
|
+
const testTitle = testCaseAttempt.pickle.name + testCaseAttempt.pickle.uri;
|
|
55
|
+
index_js_1.services.setContext(testTitle);
|
|
102
56
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
57
|
+
onTestCaseFinished(testCaseFinished) {
|
|
58
|
+
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId);
|
|
59
|
+
let example;
|
|
60
|
+
let status = constants_js_1.STATUS.PASSED;
|
|
61
|
+
let color = 'green';
|
|
62
|
+
let message;
|
|
63
|
+
this.cases.push(testCaseAttempt);
|
|
64
|
+
if (testCaseAttempt.worstTestStepResult) {
|
|
65
|
+
if (testCaseAttempt.worstTestStepResult.status === 'SKIPPED') {
|
|
66
|
+
status = constants_js_1.STATUS.SKIPPED;
|
|
67
|
+
}
|
|
68
|
+
// if (testCaseAttempt.worstTestStepResult.status === 'UNDEFINED') {
|
|
69
|
+
// status = STATUS.SKIPPED;
|
|
70
|
+
// message = 'Undefined steps. Implement missing steps and rerun this scenario';
|
|
71
|
+
// }
|
|
72
|
+
if (testCaseAttempt.worstTestStepResult.status === 'FAILED') {
|
|
73
|
+
message = testCaseAttempt?.worstTestStepResult?.message;
|
|
74
|
+
status = constants_js_1.STATUS.FAILED;
|
|
75
|
+
}
|
|
76
|
+
color = getStatusColor(testCaseAttempt.worstTestStepResult.status);
|
|
77
|
+
if (status !== constants_js_1.STATUS.PASSED)
|
|
78
|
+
this.failures.push(testCaseAttempt);
|
|
79
|
+
}
|
|
80
|
+
if (testCaseAttempt.pickle.astNodeIds.length > 1) {
|
|
81
|
+
example = getExample(testCaseAttempt);
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
testCaseAttempt.example = example;
|
|
84
|
+
}
|
|
85
|
+
const scenario = testCaseAttempt.pickle.name;
|
|
86
|
+
// this may broke something (it is supposed to work, but I am sure it did not)
|
|
87
|
+
// const testId = testCaseAttempt.pickle.id;
|
|
88
|
+
const testId = getTestId(testCaseAttempt.pickle);
|
|
89
|
+
let exampleString = '';
|
|
90
|
+
if (example)
|
|
91
|
+
exampleString = ` ${example.join(' | ')}`;
|
|
92
|
+
let cliMessage = `${picocolors_1.default.bold(scenario)}${exampleString}: ${picocolors_1.default[color](picocolors_1.default.bold(status.toUpperCase()))} `;
|
|
93
|
+
if (message)
|
|
94
|
+
cliMessage += picocolors_1.default.gray(message.split('\n')[0]);
|
|
95
|
+
console.log(cliMessage);
|
|
96
|
+
if (status !== constants_js_1.STATUS.PASSED && status !== constants_js_1.STATUS.SKIPPED) {
|
|
97
|
+
this.status = constants_js_1.STATUS.FAILED;
|
|
98
|
+
}
|
|
99
|
+
const time = Object.values(testCaseAttempt.stepResults)
|
|
100
|
+
.map(t => t.duration)
|
|
101
|
+
.reduce((sum, duration) => sum + duration.seconds * 1000 + duration.nanos / 1000000, 0);
|
|
102
|
+
if (!this.client)
|
|
103
|
+
return;
|
|
104
|
+
const testTitle = testCaseAttempt.pickle.name + testCaseAttempt.pickle.uri;
|
|
105
|
+
const logs = index_js_1.services.logger.getLogs(testTitle).join('\n');
|
|
106
|
+
const artifacts = index_js_1.services.artifacts.get(testTitle);
|
|
107
|
+
const keyValues = index_js_1.services.keyValues.get(testTitle);
|
|
108
|
+
this.client.addTestRun(status, {
|
|
109
|
+
// error: testCaseAttempt.worstTestStepResult.message,
|
|
110
|
+
message,
|
|
111
|
+
steps: getSteps(testCaseAttempt)
|
|
112
|
+
.map(s => s.toString())
|
|
113
|
+
.join('\n')
|
|
114
|
+
.trim(),
|
|
115
|
+
example: { ...example },
|
|
116
|
+
logs,
|
|
117
|
+
manuallyAttachedArtifacts: artifacts,
|
|
118
|
+
meta: keyValues,
|
|
119
|
+
title: scenario,
|
|
120
|
+
test_id: testId,
|
|
121
|
+
time,
|
|
145
122
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
123
|
+
index_js_1.services.setContext(null);
|
|
124
|
+
}
|
|
125
|
+
onTestRunFinished(envelope) {
|
|
126
|
+
if (this.failures.length > 0) {
|
|
127
|
+
console.log(picocolors_1.default.bold('\nSUMMARY:\n\n'));
|
|
128
|
+
this.failures.forEach((tc, i) => {
|
|
129
|
+
let message = ` ${i + 1}) ${tc.pickle.name}\n`;
|
|
130
|
+
const steps = getSteps(tc);
|
|
131
|
+
steps.forEach(s => {
|
|
132
|
+
message += ` ${s.toString()}\n`;
|
|
133
|
+
});
|
|
134
|
+
console.log(message);
|
|
135
|
+
if (tc?.worstTestStepResult?.message) {
|
|
136
|
+
console.log(picocolors_1.default.red(tc?.worstTestStepResult?.message));
|
|
137
|
+
}
|
|
138
|
+
console.log();
|
|
139
|
+
});
|
|
150
140
|
}
|
|
141
|
+
const { testRunFinished } = envelope;
|
|
142
|
+
const bgColor = testRunFinished.success ? 'bgGreen' : 'bgRed';
|
|
143
|
+
const prefixSummary = `${picocolors_1.default.bold(testRunFinished.success ? ' SUCCESS ' : ' FALIURE ')}`;
|
|
151
144
|
console.log();
|
|
152
|
-
|
|
145
|
+
console.log(picocolors_1.default[bgColor](` ${prefixSummary} | Total Scenarios: ${picocolors_1.default.bold(this.cases.length)} `));
|
|
146
|
+
if (!this.client)
|
|
147
|
+
return;
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
this.client.updateRunStatus(testRunFinished.success ? constants_js_1.STATUS.PASSED : constants_js_1.STATUS.FAILED);
|
|
153
150
|
}
|
|
154
|
-
|
|
155
|
-
const { testRunFinished } = envelope;
|
|
156
|
-
|
|
157
|
-
const bgColor = testRunFinished.success ? 'bgGreen' : 'bgRed';
|
|
158
|
-
const prefixSummary = `${chalk.bold(testRunFinished.success ? ' SUCCESS ' : ' FALIURE ')}`;
|
|
159
|
-
console.log();
|
|
160
|
-
console.log(chalk[bgColor](` ${prefixSummary} | Total Scenarios: ${chalk.bold(this.cases.length)} `));
|
|
161
|
-
|
|
162
|
-
if (!this.client) return;
|
|
163
|
-
|
|
164
|
-
this.client.updateRunStatus(testRunFinished.success ? STATUS.PASSED : STATUS.FAILED);
|
|
165
|
-
}
|
|
166
151
|
}
|
|
167
|
-
|
|
152
|
+
exports.CucumberReporter = CucumberReporter;
|
|
168
153
|
function getSteps(tc) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
154
|
+
const stepIds = Object.keys(tc.stepResults);
|
|
155
|
+
const pickleSteps = getPickleStepMap(tc.pickle);
|
|
156
|
+
return stepIds
|
|
157
|
+
.map(stepId => {
|
|
158
|
+
const ts = tc.testCase.testSteps.find(t => t.id === stepId);
|
|
159
|
+
if (!ts)
|
|
160
|
+
return;
|
|
161
|
+
if (!ts.pickleStepId)
|
|
162
|
+
return;
|
|
163
|
+
const result = tc.stepResults[stepId];
|
|
164
|
+
const pickleStep = pickleSteps[ts.pickleStepId];
|
|
165
|
+
const sourceStepId = pickleStep.astNodeIds[0];
|
|
166
|
+
const step = {
|
|
167
|
+
text: pickleStep.text,
|
|
168
|
+
duration: result.duration,
|
|
169
|
+
status: result.status,
|
|
170
|
+
};
|
|
171
|
+
const color = getStatusColor(result.status);
|
|
172
|
+
if (sourceStepId && getGherkinStepMap(tc.gherkinDocument)[sourceStepId]) {
|
|
173
|
+
step.keyword = getGherkinStepMap(tc.gherkinDocument)[sourceStepId].keyword;
|
|
174
|
+
}
|
|
175
|
+
step.toString = function toString() {
|
|
176
|
+
const duration = step.duration.seconds * 1000 + step.duration.nanos / 1000000;
|
|
177
|
+
const durationString = ` ${picocolors_1.default.gray(`(${Number(duration).toFixed(2)}ms)`)}`;
|
|
178
|
+
const stepString = `${picocolors_1.default.bold(this.keyword)}${this.text}`.trim();
|
|
179
|
+
if (color === 'red')
|
|
180
|
+
return picocolors_1.default.red(stepString) + durationString;
|
|
181
|
+
if (color === 'yellow')
|
|
182
|
+
return picocolors_1.default.yellow(stepString) + durationString;
|
|
183
|
+
return stepString + durationString;
|
|
184
|
+
};
|
|
185
|
+
return step;
|
|
197
186
|
})
|
|
198
|
-
|
|
187
|
+
.filter(s => !!s);
|
|
199
188
|
}
|
|
200
|
-
|
|
201
189
|
function getStatusColor(status) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
190
|
+
if (status === 'UNDEFINED')
|
|
191
|
+
return 'yellow';
|
|
192
|
+
if (status === 'SKIPPED')
|
|
193
|
+
return 'yellow';
|
|
194
|
+
if (status === 'FAILED')
|
|
195
|
+
return 'red';
|
|
196
|
+
return 'green';
|
|
206
197
|
}
|
|
207
|
-
|
|
208
198
|
function getExample(testCaseAttempt) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
199
|
+
const nodesMap = getGherkinScenarioLocationMap(testCaseAttempt.gherkinDocument);
|
|
200
|
+
const exampleNodeId = testCaseAttempt.pickle.astNodeIds[1];
|
|
201
|
+
if (!nodesMap[exampleNodeId])
|
|
202
|
+
return;
|
|
203
|
+
const featureDoc = fs_1.default.readFileSync(testCaseAttempt.gherkinDocument.uri).toString();
|
|
204
|
+
const { line } = nodesMap[exampleNodeId];
|
|
205
|
+
const example = featureDoc.split('\n')[line - 1];
|
|
206
|
+
if (example) {
|
|
207
|
+
return example
|
|
208
|
+
.trim()
|
|
209
|
+
.split('|')
|
|
210
|
+
.filter(r => !!r)
|
|
211
|
+
.map(r => r.trim());
|
|
212
|
+
}
|
|
222
213
|
}
|
|
223
|
-
|
|
224
214
|
module.exports = CucumberReporter;
|
|
215
|
+
|
|
216
|
+
module.exports.CucumberReporter = CucumberReporter;
|