testit-adapter-cucumber 1.0.0 → 1.0.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/.vs/VSWorkspaceState.json +8 -0
- package/.vs/slnx.sqlite +0 -0
- package/.vs/testit-adapter-cucumber/v16/.suo +0 -0
- package/.vs/testit-adapter-cucumber/v16/TestStore/0/000.testlog +0 -0
- package/.vs/testit-adapter-cucumber/v16/TestStore/0/testlog.manifest +0 -0
- package/dist/formatter.d.ts +35 -0
- package/dist/formatter.js +236 -0
- package/dist/formatter.js.map +1 -0
- package/dist/mappers.d.ts +14 -0
- package/dist/mappers.js +140 -0
- package/dist/mappers.js.map +1 -0
- package/dist/storage.d.ts +31 -0
- package/dist/storage.js +169 -0
- package/dist/storage.js.map +1 -0
- package/dist/types/formatter.d.ts +17 -0
- package/dist/types/formatter.js +3 -0
- package/dist/types/formatter.js.map +1 -0
- package/dist/types/storage.d.ts +17 -0
- package/dist/types/storage.js +3 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/types/tags.d.ts +22 -0
- package/dist/types/tags.js +25 -0
- package/dist/types/tags.js.map +1 -0
- package/dist/types/world.d.ts +7 -0
- package/dist/types/world.js +3 -0
- package/dist/types/world.js.map +1 -0
- package/dist/utils.d.ts +15 -0
- package/dist/utils.js +138 -0
- package/dist/utils.js.map +1 -0
- package/package.json +8 -3
- package/src/formatter.ts +58 -39
- package/src/storage.ts +53 -54
- package/src/utils.ts +14 -1
- package/readme.md +0 -78
package/.vs/slnx.sqlite
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Formatter, IFormatterOptions } from '@cucumber/cucumber';
|
|
2
|
+
import { GherkinDocument, Pickle, TestCase, TestStepFinished, TestRunFinished, TestCaseStarted, TestCaseFinished, TestStepStarted, Meta, TestRunStarted } from '@cucumber/messages';
|
|
3
|
+
import { ClientConfigWithFile, IClient, LinkPost } from 'testit-api-client';
|
|
4
|
+
import { IStorage } from './types/storage';
|
|
5
|
+
import { IFormatter } from './types/formatter';
|
|
6
|
+
import { AutotestPostWithWorkItemId } from './mappers';
|
|
7
|
+
export declare class TestItFormatter extends Formatter implements IFormatter {
|
|
8
|
+
client: IClient;
|
|
9
|
+
storage: IStorage;
|
|
10
|
+
currentTestCaseId: string | undefined;
|
|
11
|
+
resolvedAutotests: Array<string | undefined> | undefined;
|
|
12
|
+
constructor(options: IFormatterOptions, config: Partial<ClientConfigWithFile>);
|
|
13
|
+
private testRunId;
|
|
14
|
+
private testRunStarted;
|
|
15
|
+
private attachmentsQueue;
|
|
16
|
+
onMeta(_meta: Meta): void;
|
|
17
|
+
onGherkinDocument(document: GherkinDocument): void;
|
|
18
|
+
onPickle(pickle: Pickle): void;
|
|
19
|
+
onTestRunStarted(_testRunStarted: TestRunStarted): void;
|
|
20
|
+
onTestCase(testCase: TestCase): void;
|
|
21
|
+
onTestCaseStarted(testCaseStarted: TestCaseStarted): void;
|
|
22
|
+
testStepStarted(testStepStarted: TestStepStarted): void;
|
|
23
|
+
onTestStepFinished(testStepFinished: TestStepFinished): void;
|
|
24
|
+
testCaseFinished(testCaseFinished: TestCaseFinished): void;
|
|
25
|
+
onTestRunFinished(_testRunFinished: TestRunFinished): void;
|
|
26
|
+
loadAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
27
|
+
loadPassedAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
28
|
+
createNewAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
29
|
+
updateAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
30
|
+
linkWorkItem(externalId: string, workItemId: string): Promise<void>;
|
|
31
|
+
addMessage(message: string): void;
|
|
32
|
+
addLinks(links: LinkPost[]): void;
|
|
33
|
+
addAttachments(attachments: string[]): void;
|
|
34
|
+
private logError;
|
|
35
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestItFormatter = void 0;
|
|
4
|
+
const cucumber_1 = require("@cucumber/cucumber");
|
|
5
|
+
const testit_api_client_1 = require("testit-api-client");
|
|
6
|
+
const storage_1 = require("./storage");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
class TestItFormatter extends cucumber_1.Formatter {
|
|
9
|
+
constructor(options, config) {
|
|
10
|
+
super(options);
|
|
11
|
+
this.storage = new storage_1.Storage();
|
|
12
|
+
this.attachmentsQueue = [];
|
|
13
|
+
this.client = new testit_api_client_1.Client(config);
|
|
14
|
+
options.eventBroadcaster.on('envelope', (envelope) => {
|
|
15
|
+
if (envelope.meta) {
|
|
16
|
+
return this.onMeta(envelope.meta);
|
|
17
|
+
}
|
|
18
|
+
if (envelope.gherkinDocument) {
|
|
19
|
+
return this.onGherkinDocument(envelope.gherkinDocument);
|
|
20
|
+
}
|
|
21
|
+
if (envelope.pickle) {
|
|
22
|
+
if (this.resolvedAutotests !== undefined) {
|
|
23
|
+
if (this.resolvedAutotests.length > 0) {
|
|
24
|
+
const tags = (0, utils_1.parseTags)(envelope.pickle.tags);
|
|
25
|
+
for (const externalId of this.resolvedAutotests) {
|
|
26
|
+
if (externalId === tags.externalId) {
|
|
27
|
+
return this.onPickle(envelope.pickle);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
envelope.pickle = undefined;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return this.onPickle(envelope.pickle);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (envelope.testCase) {
|
|
38
|
+
return this.onTestCase(envelope.testCase);
|
|
39
|
+
}
|
|
40
|
+
if (envelope.testRunStarted) {
|
|
41
|
+
return this.onTestRunStarted(envelope.testRunStarted);
|
|
42
|
+
}
|
|
43
|
+
if (envelope.testCaseStarted) {
|
|
44
|
+
return this.onTestCaseStarted(envelope.testCaseStarted);
|
|
45
|
+
}
|
|
46
|
+
if (envelope.testStepStarted) {
|
|
47
|
+
return this.testStepStarted(envelope.testStepStarted);
|
|
48
|
+
}
|
|
49
|
+
if (envelope.testStepFinished) {
|
|
50
|
+
return this.onTestStepFinished(envelope.testStepFinished);
|
|
51
|
+
}
|
|
52
|
+
if (envelope.testCaseFinished) {
|
|
53
|
+
return this.testCaseFinished(envelope.testCaseFinished);
|
|
54
|
+
}
|
|
55
|
+
if (envelope.testRunFinished) {
|
|
56
|
+
return this.onTestRunFinished(envelope.testRunFinished);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
options.supportCodeLibrary.World.prototype.addMessage =
|
|
60
|
+
this.addMessage.bind(this);
|
|
61
|
+
options.supportCodeLibrary.World.prototype.addLinks =
|
|
62
|
+
this.addLinks.bind(this);
|
|
63
|
+
options.supportCodeLibrary.World.prototype.addAttachments =
|
|
64
|
+
this.addAttachments.bind(this);
|
|
65
|
+
}
|
|
66
|
+
onMeta(_meta) {
|
|
67
|
+
const { projectId, testRunId, configurationId } = this.client.getConfig();
|
|
68
|
+
if (testRunId === undefined) {
|
|
69
|
+
this.testRunId = this.client
|
|
70
|
+
.createTestRun({
|
|
71
|
+
projectId,
|
|
72
|
+
})
|
|
73
|
+
.then((testRun) => testRun.id);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.testRunId = Promise.resolve(testRunId);
|
|
77
|
+
const responce = this.client.getTestRun(testRunId);
|
|
78
|
+
this.resolvedAutotests = (0, utils_1.parsedAutotests)(responce.testResults, configurationId);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
onGherkinDocument(document) {
|
|
82
|
+
this.storage.saveGherkinDocument(document);
|
|
83
|
+
}
|
|
84
|
+
onPickle(pickle) {
|
|
85
|
+
this.storage.savePickle(pickle);
|
|
86
|
+
}
|
|
87
|
+
onTestRunStarted(_testRunStarted) {
|
|
88
|
+
if (this.testRunId === undefined) {
|
|
89
|
+
throw new Error('TestRunId is not yet specified');
|
|
90
|
+
}
|
|
91
|
+
this.testRunStarted = this.testRunId.then((id) => this.client.startTestRun(id));
|
|
92
|
+
}
|
|
93
|
+
onTestCase(testCase) {
|
|
94
|
+
this.storage.saveTestCase(testCase);
|
|
95
|
+
}
|
|
96
|
+
onTestCaseStarted(testCaseStarted) {
|
|
97
|
+
this.currentTestCaseId = testCaseStarted.testCaseId;
|
|
98
|
+
this.storage.saveTestCaseStarted(testCaseStarted);
|
|
99
|
+
}
|
|
100
|
+
testStepStarted(testStepStarted) {
|
|
101
|
+
this.storage.saveTestStepStarted(testStepStarted);
|
|
102
|
+
}
|
|
103
|
+
onTestStepFinished(testStepFinished) {
|
|
104
|
+
this.storage.saveTestStepFinished(testStepFinished);
|
|
105
|
+
}
|
|
106
|
+
testCaseFinished(testCaseFinished) {
|
|
107
|
+
this.currentTestCaseId = undefined;
|
|
108
|
+
this.storage.saveTestCaseFinished(testCaseFinished);
|
|
109
|
+
}
|
|
110
|
+
onTestRunFinished(_testRunFinished) {
|
|
111
|
+
if (this.testRunId === undefined) {
|
|
112
|
+
throw new Error('TestRunId is not yet specified');
|
|
113
|
+
}
|
|
114
|
+
if (this.testRunStarted === undefined) {
|
|
115
|
+
throw new Error('Test run is not started yet');
|
|
116
|
+
}
|
|
117
|
+
const { configurationId } = this.client.getConfig();
|
|
118
|
+
const results = this.storage.getTestRunResults(configurationId);
|
|
119
|
+
if (results.length > 0) {
|
|
120
|
+
Promise.all([
|
|
121
|
+
this.testRunId,
|
|
122
|
+
this.testRunStarted,
|
|
123
|
+
Promise.all(this.attachmentsQueue),
|
|
124
|
+
])
|
|
125
|
+
.then(async ([id]) => {
|
|
126
|
+
const autotests = this.storage.getAutotests(this.client.getConfig().projectId);
|
|
127
|
+
await Promise.all(autotests.map((autotestPost) => {
|
|
128
|
+
const result = results.find((result) => result.autotestExternalId === autotestPost.externalId);
|
|
129
|
+
if (result !== undefined) {
|
|
130
|
+
if (result.outcome !== 'Passed') {
|
|
131
|
+
return this.loadAutotest(autotestPost);
|
|
132
|
+
}
|
|
133
|
+
return this.loadPassedAutotest(autotestPost);
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
await Promise.all(results.map((result) => {
|
|
137
|
+
return this.client.loadTestRunResults(id, [result]);
|
|
138
|
+
}));
|
|
139
|
+
})
|
|
140
|
+
.catch((err) => {
|
|
141
|
+
var _a;
|
|
142
|
+
console.error(err);
|
|
143
|
+
(_a = this.testRunId) === null || _a === void 0 ? void 0 : _a.then((id) => this.client.completeTestRun(id));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async loadAutotest(autotestPost) {
|
|
148
|
+
var _a;
|
|
149
|
+
try {
|
|
150
|
+
await this.createNewAutotest(autotestPost);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
const axiosError = err;
|
|
154
|
+
if (((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.status) === 409) {
|
|
155
|
+
const [autotest] = await this.client.getAutotest({
|
|
156
|
+
projectId: this.client.getConfig().projectId,
|
|
157
|
+
externalId: autotestPost.externalId,
|
|
158
|
+
});
|
|
159
|
+
await this.updateAutotest(Object.assign(Object.assign({}, autotest), { links: autotestPost.links }));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.logError(axiosError);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async loadPassedAutotest(autotestPost) {
|
|
167
|
+
var _a;
|
|
168
|
+
try {
|
|
169
|
+
await this.createNewAutotest(autotestPost);
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
const axiosError = err;
|
|
173
|
+
if (((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.status) === 409) {
|
|
174
|
+
await this.updateAutotest(autotestPost);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.logError(axiosError);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (autotestPost.workItemId !== undefined) {
|
|
181
|
+
this.linkWorkItem(autotestPost.externalId, autotestPost.workItemId);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async createNewAutotest(autotestPost) {
|
|
185
|
+
await this.client.createAutotest(autotestPost);
|
|
186
|
+
}
|
|
187
|
+
async updateAutotest(autotestPost) {
|
|
188
|
+
await this.client.updateAutotest(autotestPost).catch(this.logError);
|
|
189
|
+
}
|
|
190
|
+
async linkWorkItem(externalId, workItemId) {
|
|
191
|
+
const [autotest] = await this.client
|
|
192
|
+
.getAutotest({
|
|
193
|
+
projectId: this.client.getConfig().projectId,
|
|
194
|
+
externalId: externalId,
|
|
195
|
+
})
|
|
196
|
+
.catch(() => []);
|
|
197
|
+
if ((autotest === null || autotest === void 0 ? void 0 : autotest.id) !== undefined) {
|
|
198
|
+
await this.client.linkToWorkItem(autotest.id, {
|
|
199
|
+
id: workItemId,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
addMessage(message) {
|
|
204
|
+
if (this.currentTestCaseId === undefined) {
|
|
205
|
+
throw new Error('CurrentTestCaseId is not set');
|
|
206
|
+
}
|
|
207
|
+
this.storage.addMessage(this.currentTestCaseId, message);
|
|
208
|
+
}
|
|
209
|
+
addLinks(links) {
|
|
210
|
+
if (this.currentTestCaseId === undefined) {
|
|
211
|
+
throw new Error('CurrentTestCaseId is not set');
|
|
212
|
+
}
|
|
213
|
+
this.storage.addLinks(this.currentTestCaseId, links);
|
|
214
|
+
}
|
|
215
|
+
addAttachments(attachments) {
|
|
216
|
+
if (this.currentTestCaseId === undefined) {
|
|
217
|
+
throw new Error('CurrentTestCaseId is not set');
|
|
218
|
+
}
|
|
219
|
+
const currentTestCaseId = this.currentTestCaseId;
|
|
220
|
+
this.attachmentsQueue.push(...attachments.map(async (attachment) => {
|
|
221
|
+
const { id } = await this.client.loadAttachment(attachment);
|
|
222
|
+
if (id === undefined) {
|
|
223
|
+
// NOTE: Why?
|
|
224
|
+
console.warn('Attachment id is not returned');
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
this.storage.addAttachment(currentTestCaseId, id);
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
logError(err) {
|
|
231
|
+
var _a, _b;
|
|
232
|
+
console.error((_a = err.response) === null || _a === void 0 ? void 0 : _a.status, err.config.method, err.config.url, (_b = err.response) === null || _b === void 0 ? void 0 : _b.data);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.TestItFormatter = TestItFormatter;
|
|
236
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":";;;AAAA,iDAAkE;AAclE,yDAK2B;AAE3B,uCAAoC;AAIpC,mCAAqD;AAErD,MAAa,eAAgB,SAAQ,oBAAS;IAM5C,YACE,OAA0B,EAC1B,MAAqC;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;QARjB,YAAO,GAAa,IAAI,iBAAO,EAAE,CAAC;QAgE1B,qBAAgB,GAAoB,EAAE,CAAC;QAvD7C,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAM,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAkB,EAAE,EAAE;YAC7D,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACjB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aACnC;YACD,IAAI,QAAQ,CAAC,eAAe,EAAE;gBAC5B,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;aACzD;YACD,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;oBACxC,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,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CAAC;SACjD;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,cAAc,CAAC,WAAqB;QAClC,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACjD;QACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CACxB,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YACtC,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YAC5D,IAAI,EAAE,KAAK,SAAS,EAAE;gBACpB,aAAa;gBACb,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;gBAC9C,OAAO;aACR;YACD,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,QAAQ,CAAC,GAAe;;QAC9B,OAAO,CAAC,KAAK,CACX,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,EACpB,GAAG,CAAC,MAAM,CAAC,MAAM,EACjB,GAAG,CAAC,MAAM,CAAC,GAAG,EACd,MAAA,GAAG,CAAC,QAAQ,0CAAE,IAAI,CACnB,CAAC;IACJ,CAAC;CAGF;AApRD,0CAoRC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Background, DataTable, Examples, GherkinDocument, Rule, Scenario, Step, TestStepResultStatus } from '@cucumber/messages';
|
|
2
|
+
import { AutotestPost, AutotestStep, OutcomeType } from 'testit-api-client';
|
|
3
|
+
export interface AutotestPostWithWorkItemId extends AutotestPost {
|
|
4
|
+
workItemId?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function mapStatus(status: TestStepResultStatus): OutcomeType;
|
|
7
|
+
export declare function mapDate(date: number): string;
|
|
8
|
+
export declare function mapDocument(document: GherkinDocument, projectId: string): AutotestPostWithWorkItemId[];
|
|
9
|
+
export declare function mapBackground(background: Background): AutotestStep;
|
|
10
|
+
export declare function mapRule(rule: Rule, projectId: string, setup: AutotestStep[]): AutotestPostWithWorkItemId[];
|
|
11
|
+
export declare function mapScenario(scenario: Scenario, projectId: string, setup: AutotestStep[]): AutotestPostWithWorkItemId;
|
|
12
|
+
export declare function mapExamples(examples: Examples): AutotestStep;
|
|
13
|
+
export declare function mapStep(step: Step): AutotestStep;
|
|
14
|
+
export declare function mapDataTable(dataTable: DataTable | undefined): string | undefined;
|
package/dist/mappers.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapDataTable = exports.mapStep = exports.mapExamples = exports.mapScenario = exports.mapRule = exports.mapBackground = exports.mapDocument = exports.mapDate = exports.mapStatus = void 0;
|
|
4
|
+
const messages_1 = require("@cucumber/messages");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
function mapStatus(status) {
|
|
7
|
+
switch (status) {
|
|
8
|
+
case messages_1.TestStepResultStatus.PASSED:
|
|
9
|
+
return 'Passed';
|
|
10
|
+
case messages_1.TestStepResultStatus.FAILED:
|
|
11
|
+
return 'Failed';
|
|
12
|
+
case messages_1.TestStepResultStatus.PENDING:
|
|
13
|
+
return 'Pending';
|
|
14
|
+
case messages_1.TestStepResultStatus.SKIPPED:
|
|
15
|
+
return 'Skipped';
|
|
16
|
+
case messages_1.TestStepResultStatus.UNKNOWN:
|
|
17
|
+
case messages_1.TestStepResultStatus.UNDEFINED:
|
|
18
|
+
case messages_1.TestStepResultStatus.AMBIGUOUS:
|
|
19
|
+
return 'Blocked';
|
|
20
|
+
default:
|
|
21
|
+
throw new Error('Unknown status');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.mapStatus = mapStatus;
|
|
25
|
+
function mapDate(date) {
|
|
26
|
+
return new Date(date * 1000).toISOString();
|
|
27
|
+
}
|
|
28
|
+
exports.mapDate = mapDate;
|
|
29
|
+
function mapDocument(document, projectId) {
|
|
30
|
+
if (document.feature === undefined) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const setup = document.feature.children
|
|
34
|
+
.filter((child) => child.background !== undefined)
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
36
|
+
.map((child) => mapBackground(child.background));
|
|
37
|
+
const scenarioAutotests = document.feature.children
|
|
38
|
+
.filter((child) => child.scenario !== undefined)
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
|
+
.map((child) => mapScenario(child.scenario, projectId, setup));
|
|
41
|
+
const ruleAutotests = document.feature.children
|
|
42
|
+
.filter((child) => child.rule !== undefined)
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
+
.flatMap((child) => mapRule(child.rule, projectId, setup));
|
|
45
|
+
return scenarioAutotests.concat(...ruleAutotests);
|
|
46
|
+
}
|
|
47
|
+
exports.mapDocument = mapDocument;
|
|
48
|
+
function mapBackground(background) {
|
|
49
|
+
return {
|
|
50
|
+
title: background.name,
|
|
51
|
+
description: background.description,
|
|
52
|
+
steps: background.steps.map(mapStep),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.mapBackground = mapBackground;
|
|
56
|
+
function mapRule(rule, projectId, setup) {
|
|
57
|
+
const ruleSetup = setup.concat(rule.children
|
|
58
|
+
.filter((child) => child.background !== undefined)
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
60
|
+
.map((child) => mapBackground(child.background)));
|
|
61
|
+
return (rule.children
|
|
62
|
+
.filter((child) => child.scenario !== undefined)
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
64
|
+
.map((child) => mapScenario(child.scenario, projectId, ruleSetup)));
|
|
65
|
+
}
|
|
66
|
+
exports.mapRule = mapRule;
|
|
67
|
+
function mapScenario(scenario, projectId, setup) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const tags = (0, utils_1.parseTags)(scenario.tags);
|
|
70
|
+
if (tags.externalId === undefined) {
|
|
71
|
+
throw new Error(`External id is not provided in ${scenario.name}`);
|
|
72
|
+
}
|
|
73
|
+
const exampleSteps = scenario.examples.map(mapExamples);
|
|
74
|
+
return {
|
|
75
|
+
setup: exampleSteps.concat(setup),
|
|
76
|
+
externalId: tags.externalId,
|
|
77
|
+
links: tags.links,
|
|
78
|
+
name: (_a = tags.name) !== null && _a !== void 0 ? _a : scenario.name,
|
|
79
|
+
title: tags.title,
|
|
80
|
+
description: (_b = tags.description) !== null && _b !== void 0 ? _b : scenario.description,
|
|
81
|
+
projectId,
|
|
82
|
+
steps: scenario.steps.map(mapStep),
|
|
83
|
+
workItemId: tags.workItemId,
|
|
84
|
+
// Disable for now (BUG??)
|
|
85
|
+
// labels:
|
|
86
|
+
// tags.labels.length > 0
|
|
87
|
+
// ? tags.labels.map((label) => ({ name: label }))
|
|
88
|
+
// : undefined,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
exports.mapScenario = mapScenario;
|
|
92
|
+
function mapExamples(examples) {
|
|
93
|
+
var _a, _b, _c, _d;
|
|
94
|
+
let table = [];
|
|
95
|
+
const body = examples.tableBody.map((row) => row.cells.map((cell) => cell.value));
|
|
96
|
+
if (examples.tableHeader !== undefined) {
|
|
97
|
+
const header = (_a = examples.tableHeader) === null || _a === void 0 ? void 0 : _a.cells.map((cell) => cell.value);
|
|
98
|
+
table = body.map((row) => header.reduce((acc, key, i) => {
|
|
99
|
+
acc[key] = row[i];
|
|
100
|
+
return acc;
|
|
101
|
+
}, {}));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
table = body;
|
|
105
|
+
}
|
|
106
|
+
const description = [examples.description];
|
|
107
|
+
const tags = (0, utils_1.parseTags)(examples.tags);
|
|
108
|
+
if (table.length > 0) {
|
|
109
|
+
description.push(JSON.stringify(table));
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
title: (_c = (_b = tags.title) !== null && _b !== void 0 ? _b : tags.name) !== null && _c !== void 0 ? _c : examples.name,
|
|
113
|
+
description: (_d = tags.description) !== null && _d !== void 0 ? _d : description.join('\n\n'),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
exports.mapExamples = mapExamples;
|
|
117
|
+
function mapStep(step) {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
return {
|
|
120
|
+
title: `${step.keyword} ${step.text}`,
|
|
121
|
+
description: (_b = (_a = step.docString) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : mapDataTable(step.dataTable),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
exports.mapStep = mapStep;
|
|
125
|
+
function mapDataTable(dataTable) {
|
|
126
|
+
if (dataTable === undefined) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
const keys = dataTable.rows[0].cells.map((cell) => cell.value);
|
|
130
|
+
const rows = dataTable.rows
|
|
131
|
+
.slice(1)
|
|
132
|
+
.map((row) => row.cells.map((cell) => cell.value));
|
|
133
|
+
const objects = rows.map((value) => keys.reduce((acc, key, i) => {
|
|
134
|
+
acc[key] = value[i];
|
|
135
|
+
return acc;
|
|
136
|
+
}, {}));
|
|
137
|
+
return JSON.stringify(objects);
|
|
138
|
+
}
|
|
139
|
+
exports.mapDataTable = mapDataTable;
|
|
140
|
+
//# sourceMappingURL=mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mappers.js","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":";;;AAAA,iDAS4B;AAE5B,mCAAoC;AAMpC,SAAgB,SAAS,CAAC,MAA4B;IACpD,QAAQ,MAAM,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EAAE;QAC3B,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI;SACxB,KAAK,CAAC,CAAC,CAAC;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACjC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;QAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAA4B,CAAC,CACjC,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAjBD,oCAiBC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AttachmentPut, AttachmentPutModelAutotestStepResults, AutotestResultsForTestRun, LinkPost } from 'testit-api-client';
|
|
2
|
+
import { GherkinDocument, Pickle, PickleStep, TestCase, TestCaseFinished, TestCaseStarted, TestStepFinished, TestStepStarted } from '@cucumber/messages';
|
|
3
|
+
import { IStorage } from './types/storage';
|
|
4
|
+
import { AutotestPostWithWorkItemId } from './mappers';
|
|
5
|
+
export declare class Storage implements IStorage {
|
|
6
|
+
private gherkinDocuments;
|
|
7
|
+
private pickles;
|
|
8
|
+
private testCases;
|
|
9
|
+
private testCasesStarted;
|
|
10
|
+
private testCasesFinished;
|
|
11
|
+
private testStepsStarted;
|
|
12
|
+
private testStepsFinished;
|
|
13
|
+
private messages;
|
|
14
|
+
private links;
|
|
15
|
+
private attachments;
|
|
16
|
+
saveGherkinDocument(document: GherkinDocument): void;
|
|
17
|
+
getAutotests(projectId: string): AutotestPostWithWorkItemId[];
|
|
18
|
+
savePickle(pickle: Pickle): void;
|
|
19
|
+
saveTestCase(testCase: TestCase): void;
|
|
20
|
+
saveTestCaseStarted(testCaseStarted: TestCaseStarted): void;
|
|
21
|
+
saveTestCaseFinished(testCaseFinished: TestCaseFinished): void;
|
|
22
|
+
saveTestStepStarted(testStepStarted: TestStepStarted): void;
|
|
23
|
+
saveTestStepFinished(testStepFinished: TestStepFinished): void;
|
|
24
|
+
getTestRunResults(configurationId: string): AutotestResultsForTestRun[];
|
|
25
|
+
getStepResult(pickleStep: PickleStep, testCase: TestCase): AttachmentPutModelAutotestStepResults;
|
|
26
|
+
getStepMessage(pickleStep: PickleStep, testCase: TestCase): string | undefined;
|
|
27
|
+
getAttachments(testCaseId: string): AttachmentPut[] | undefined;
|
|
28
|
+
addMessage(testCaseId: string, message: string): void;
|
|
29
|
+
addLinks(testCaseId: string, links: LinkPost[]): void;
|
|
30
|
+
addAttachment(testCaseId: string, attachmentId: string): void;
|
|
31
|
+
}
|