@cucumber/query 13.6.0 → 14.0.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/LICENSE +21 -0
- package/dist/src/Query.d.ts +14 -11
- package/dist/src/Query.d.ts.map +1 -1
- package/dist/src/Query.js +44 -21
- package/dist/src/Query.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/Query.ts +65 -32
- package/src/acceptance.spec.ts +212 -251
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Cucumber Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/src/Query.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as messages from '@cucumber/messages';
|
|
2
|
-
import { Attachment, Duration,
|
|
3
|
-
import { Lineage
|
|
2
|
+
import { Attachment, Duration, Hook, Location, Meta, Pickle, PickleStep, Step, StepDefinition, Suggestion, TestCase, TestCaseFinished, TestCaseStarted, TestRunFinished, TestRunStarted, TestStep, TestStepFinished, TestStepResult, TestStepResultStatus, TestStepStarted } from '@cucumber/messages';
|
|
3
|
+
import { Lineage } from './Lineage';
|
|
4
4
|
export default class Query {
|
|
5
5
|
private readonly testStepResultByPickleId;
|
|
6
6
|
private readonly testStepResultsByPickleStepId;
|
|
@@ -27,6 +27,7 @@ export default class Query {
|
|
|
27
27
|
private readonly testStepStartedByTestCaseStartedId;
|
|
28
28
|
private readonly testStepFinishedByTestCaseStartedId;
|
|
29
29
|
private readonly attachmentsByTestCaseStartedId;
|
|
30
|
+
private readonly suggestionsByPickleStepId;
|
|
30
31
|
update(envelope: messages.Envelope): void;
|
|
31
32
|
private updateGherkinDocument;
|
|
32
33
|
private updateFeature;
|
|
@@ -40,6 +41,7 @@ export default class Query {
|
|
|
40
41
|
private updateAttachment;
|
|
41
42
|
private updateTestStepFinished;
|
|
42
43
|
private updateTestCaseFinished;
|
|
44
|
+
private updateSuggestion;
|
|
43
45
|
/**
|
|
44
46
|
* Gets all the results for multiple pickle steps
|
|
45
47
|
* @param pickleStepIds
|
|
@@ -72,30 +74,31 @@ export default class Query {
|
|
|
72
74
|
findAllPickles(): ReadonlyArray<Pickle>;
|
|
73
75
|
findAllPickleSteps(): ReadonlyArray<PickleStep>;
|
|
74
76
|
findAllTestCaseStarted(): ReadonlyArray<TestCaseStarted>;
|
|
75
|
-
|
|
77
|
+
findAllTestCaseFinished(): ReadonlyArray<TestCaseFinished>;
|
|
76
78
|
findAllTestSteps(): ReadonlyArray<TestStep>;
|
|
79
|
+
findAllTestStepStarted(): ReadonlyArray<TestStepStarted>;
|
|
80
|
+
findAllTestStepFinished(): ReadonlyArray<TestStepFinished>;
|
|
77
81
|
findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray<Attachment>;
|
|
78
|
-
findFeatureBy(testCaseStarted: TestCaseStarted): Feature | undefined;
|
|
79
82
|
findHookBy(testStep: TestStep): Hook | undefined;
|
|
80
83
|
findMeta(): Meta | undefined;
|
|
81
|
-
findMostSevereTestStepResultBy(
|
|
82
|
-
findNameOf(pickle: Pickle, namingStrategy: NamingStrategy): string;
|
|
84
|
+
findMostSevereTestStepResultBy(element: TestCaseStarted | TestCaseFinished): TestStepResult | undefined;
|
|
83
85
|
findLocationOf(pickle: Pickle): Location | undefined;
|
|
84
|
-
findPickleBy(element: TestCaseStarted | TestStepStarted): Pickle | undefined;
|
|
86
|
+
findPickleBy(element: TestCaseStarted | TestCaseFinished | TestStepStarted): Pickle | undefined;
|
|
85
87
|
findPickleStepBy(testStep: TestStep): PickleStep | undefined;
|
|
86
88
|
findStepBy(pickleStep: PickleStep): Step | undefined;
|
|
87
89
|
findStepDefinitionsBy(testStep: TestStep): ReadonlyArray<StepDefinition>;
|
|
90
|
+
findSuggestionsBy(element: PickleStep | Pickle): ReadonlyArray<Suggestion>;
|
|
88
91
|
findUnambiguousStepDefinitionBy(testStep: TestStep): StepDefinition | undefined;
|
|
89
|
-
findTestCaseBy(element: TestCaseStarted | TestStepStarted): TestCase | undefined;
|
|
90
|
-
findTestCaseDurationBy(
|
|
91
|
-
findTestCaseStartedBy(
|
|
92
|
+
findTestCaseBy(element: TestCaseStarted | TestCaseFinished | TestStepStarted | TestStepFinished): TestCase | undefined;
|
|
93
|
+
findTestCaseDurationBy(element: TestCaseStarted | TestCaseFinished): Duration | undefined;
|
|
94
|
+
findTestCaseStartedBy(element: TestCaseFinished | TestStepStarted | TestStepFinished): TestCaseStarted | undefined;
|
|
92
95
|
findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined;
|
|
93
96
|
findTestRunDuration(): Duration | undefined;
|
|
94
97
|
findTestRunFinished(): TestRunFinished | undefined;
|
|
95
98
|
findTestRunStarted(): TestRunStarted | undefined;
|
|
96
99
|
findTestStepBy(element: TestStepStarted | TestStepFinished): TestStep | undefined;
|
|
97
100
|
findTestStepsStartedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepStarted>;
|
|
98
|
-
findTestStepsFinishedBy(
|
|
101
|
+
findTestStepsFinishedBy(element: TestCaseStarted | TestCaseFinished): ReadonlyArray<TestStepFinished>;
|
|
99
102
|
findTestStepFinishedAndTestStepBy(testCaseStarted: TestCaseStarted): ReadonlyArray<[TestStepFinished, TestStep]>;
|
|
100
103
|
findLineageBy(element: Pickle | TestCaseStarted): Lineage | undefined;
|
|
101
104
|
}
|
package/dist/src/Query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EACL,UAAU,EACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EACL,UAAU,EACV,QAAQ,EAIR,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,UAAU,EAGV,IAAI,EACJ,cAAc,EACd,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EAEhB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,OAAO,OAAO,KAAK;IACxB,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAuD;IAChG,OAAO,CAAC,QAAQ,CAAC,6B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GAAG,SAAS;IAOhB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,gBAAgB,GAAG,QAAQ,GAAG,SAAS;IAmBzF,qBAAqB,CAC1B,OAAO,EAAE,gBAAgB,GAAG,eAAe,GAAG,gBAAgB,GAC7D,eAAe,GAAG,SAAS;IAIvB,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,gBAAgB,GAAG,SAAS;IAItF,mBAAmB,IAAI,QAAQ,GAAG,SAAS;IAU3C,mBAAmB,IAAI,eAAe,GAAG,SAAS;IAIlD,kBAAkB,IAAI,cAAc,GAAG,SAAS;IAIhD,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,gBAAgB,GAAG,QAAQ,GAAG,SAAS;IAIjF,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;IAKxF,uBAAuB,CAC5B,OAAO,EAAE,eAAe,GAAG,gBAAgB,GAC1C,aAAa,CAAC,gBAAgB,CAAC;IAO3B,iCAAiC,CACtC,eAAe,EAAE,eAAe,GAC/B,aAAa,CAAC,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAUvC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS;CAM7E"}
|
package/dist/src/Query.js
CHANGED
|
@@ -65,6 +65,7 @@ class Query {
|
|
|
65
65
|
this.testStepStartedByTestCaseStartedId = new multimaps_1.ArrayMultimap();
|
|
66
66
|
this.testStepFinishedByTestCaseStartedId = new multimaps_1.ArrayMultimap();
|
|
67
67
|
this.attachmentsByTestCaseStartedId = new multimaps_1.ArrayMultimap();
|
|
68
|
+
this.suggestionsByPickleStepId = new multimaps_1.ArrayMultimap();
|
|
68
69
|
}
|
|
69
70
|
update(envelope) {
|
|
70
71
|
if (envelope.meta) {
|
|
@@ -106,6 +107,9 @@ class Query {
|
|
|
106
107
|
if (envelope.testRunFinished) {
|
|
107
108
|
this.testRunFinished = envelope.testRunFinished;
|
|
108
109
|
}
|
|
110
|
+
if (envelope.suggestion) {
|
|
111
|
+
this.updateSuggestion(envelope.suggestion);
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
updateGherkinDocument(gherkinDocument) {
|
|
111
115
|
if (gherkinDocument.feature) {
|
|
@@ -210,6 +214,9 @@ class Query {
|
|
|
210
214
|
updateTestCaseFinished(testCaseFinished) {
|
|
211
215
|
this.testCaseFinishedByTestCaseStartedId.set(testCaseFinished.testCaseStartedId, testCaseFinished);
|
|
212
216
|
}
|
|
217
|
+
updateSuggestion(suggestion) {
|
|
218
|
+
this.suggestionsByPickleStepId.put(suggestion.pickleStepId, suggestion);
|
|
219
|
+
}
|
|
213
220
|
/**
|
|
214
221
|
* Gets all the results for multiple pickle steps
|
|
215
222
|
* @param pickleStepIds
|
|
@@ -348,26 +355,29 @@ class Query {
|
|
|
348
355
|
'id',
|
|
349
356
|
]);
|
|
350
357
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
+
findAllTestCaseFinished() {
|
|
359
|
+
return (0, lodash_sortby_1.default)([...this.testCaseFinishedByTestCaseStartedId.values()].filter((testCaseFinished) => {
|
|
360
|
+
// only include if not yet finished OR won't be retried
|
|
361
|
+
return !(testCaseFinished === null || testCaseFinished === void 0 ? void 0 : testCaseFinished.willBeRetried);
|
|
362
|
+
}), [
|
|
363
|
+
(testCaseFinished) => messages_1.TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp),
|
|
364
|
+
'id',
|
|
365
|
+
]);
|
|
358
366
|
}
|
|
359
367
|
findAllTestSteps() {
|
|
360
368
|
return [...this.testStepById.values()];
|
|
361
369
|
}
|
|
370
|
+
findAllTestStepStarted() {
|
|
371
|
+
return [...this.testStepStartedByTestCaseStartedId.values()];
|
|
372
|
+
}
|
|
373
|
+
findAllTestStepFinished() {
|
|
374
|
+
return [...this.testStepFinishedByTestCaseStartedId.values()];
|
|
375
|
+
}
|
|
362
376
|
findAttachmentsBy(testStepFinished) {
|
|
363
377
|
return this.attachmentsByTestCaseStartedId
|
|
364
378
|
.get(testStepFinished.testCaseStartedId)
|
|
365
379
|
.filter((attachment) => attachment.testStepId === testStepFinished.testStepId);
|
|
366
380
|
}
|
|
367
|
-
findFeatureBy(testCaseStarted) {
|
|
368
|
-
var _a;
|
|
369
|
-
return (_a = this.findLineageBy(testCaseStarted)) === null || _a === void 0 ? void 0 : _a.feature;
|
|
370
|
-
}
|
|
371
381
|
findHookBy(testStep) {
|
|
372
382
|
if (!testStep.hookId) {
|
|
373
383
|
return undefined;
|
|
@@ -377,13 +387,10 @@ class Query {
|
|
|
377
387
|
findMeta() {
|
|
378
388
|
return this.meta;
|
|
379
389
|
}
|
|
380
|
-
findMostSevereTestStepResultBy(
|
|
390
|
+
findMostSevereTestStepResultBy(element) {
|
|
391
|
+
const testCaseStarted = 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element;
|
|
381
392
|
return (0, lodash_sortby_1.default)(this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(([testStepFinished]) => testStepFinished.testStepResult), [(testStepResult) => (0, helpers_1.statusOrdinal)(testStepResult.status)]).at(-1);
|
|
382
393
|
}
|
|
383
|
-
findNameOf(pickle, namingStrategy) {
|
|
384
|
-
const lineage = this.findLineageBy(pickle);
|
|
385
|
-
return lineage ? namingStrategy.reduce(lineage, pickle) : pickle.name;
|
|
386
|
-
}
|
|
387
394
|
findLocationOf(pickle) {
|
|
388
395
|
var _a;
|
|
389
396
|
const lineage = this.findLineageBy(pickle);
|
|
@@ -412,6 +419,12 @@ class Query {
|
|
|
412
419
|
var _a;
|
|
413
420
|
return ((_a = testStep.stepDefinitionIds) !== null && _a !== void 0 ? _a : []).map((id) => this.stepDefinitionById.get(id));
|
|
414
421
|
}
|
|
422
|
+
findSuggestionsBy(element) {
|
|
423
|
+
if ('steps' in element) {
|
|
424
|
+
return element.steps.flatMap((value) => this.findSuggestionsBy(value));
|
|
425
|
+
}
|
|
426
|
+
return this.suggestionsByPickleStepId.get(element.id);
|
|
427
|
+
}
|
|
415
428
|
findUnambiguousStepDefinitionBy(testStep) {
|
|
416
429
|
var _a;
|
|
417
430
|
if (((_a = testStep.stepDefinitionIds) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
@@ -424,16 +437,25 @@ class Query {
|
|
|
424
437
|
helpers_1.assert.ok(testCaseStarted, 'Expected to find TestCaseStarted by TestStepStarted');
|
|
425
438
|
return this.testCaseById.get(testCaseStarted.testCaseId);
|
|
426
439
|
}
|
|
427
|
-
findTestCaseDurationBy(
|
|
428
|
-
|
|
440
|
+
findTestCaseDurationBy(element) {
|
|
441
|
+
let testCaseStarted;
|
|
442
|
+
let testCaseFinished;
|
|
443
|
+
if ('testCaseStartedId' in element) {
|
|
444
|
+
testCaseStarted = this.findTestCaseStartedBy(element);
|
|
445
|
+
testCaseFinished = element;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
testCaseStarted = element;
|
|
449
|
+
testCaseFinished = this.findTestCaseFinishedBy(element);
|
|
450
|
+
}
|
|
429
451
|
if (!testCaseFinished) {
|
|
430
452
|
return undefined;
|
|
431
453
|
}
|
|
432
454
|
return messages_1.TimeConversion.millisecondsToDuration(messages_1.TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp) -
|
|
433
455
|
messages_1.TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp));
|
|
434
456
|
}
|
|
435
|
-
findTestCaseStartedBy(
|
|
436
|
-
return this.testCaseStartedById.get(
|
|
457
|
+
findTestCaseStartedBy(element) {
|
|
458
|
+
return this.testCaseStartedById.get(element.testCaseStartedId);
|
|
437
459
|
}
|
|
438
460
|
findTestCaseFinishedBy(testCaseStarted) {
|
|
439
461
|
return this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id);
|
|
@@ -458,7 +480,8 @@ class Query {
|
|
|
458
480
|
// multimaps `get` implements `getOrDefault([])` behaviour internally
|
|
459
481
|
return [...this.testStepStartedByTestCaseStartedId.get(testCaseStarted.id)];
|
|
460
482
|
}
|
|
461
|
-
findTestStepsFinishedBy(
|
|
483
|
+
findTestStepsFinishedBy(element) {
|
|
484
|
+
const testCaseStarted = 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element;
|
|
462
485
|
// multimaps `get` implements `getOrDefault([])` behaviour internally
|
|
463
486
|
return [...this.testStepFinishedByTestCaseStartedId.get(testCaseStarted.id)];
|
|
464
487
|
}
|
package/dist/src/Query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,iDA0B2B;AAC3B,kDAAkD;AAClD,kEAAkC;AAElC,uCAAiD;AAGjD,MAAqB,KAAK;IAA1B;QACmB,6BAAwB,GAAG,IAAI,yBAAa,EAAmC,CAAA;QAC/E,kCAA6B,GAAG,IAAI,yBAAa,EAG/D,CAAA;QACc,uBAAkB,GAAG,IAAI,GAAG,EAA6B,CAAA;QACzD,yBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAA;QAChD,6BAAwB,GAAG,IAAI,GAAG,EAAkB,CAAA;QACpD,gCAA2B,GAAG,IAAI,yBAAa,EAG7D,CAAA;QACc,8BAAyB,GAAG,IAAI,yBAAa,EAAkB,CAAA;QAC/D,cAAS,GAAG,IAAI,GAAG,EAAyB,CAAA;QAC5C,4BAAuB,GAAG,IAAI,yBAAa,EAA+B,CAAA;QAC1E,0CAAqC,GAAG,IAAI,GAAG,EAG7D,CAAA;QAKc,wBAAmB,GAAiC,IAAI,GAAG,EAAE,CAAA;QAC7D,gBAAW,GAAyB,IAAI,GAAG,EAAE,CAAA;QAC7C,aAAQ,GAAsB,IAAI,GAAG,EAAE,CAAA;QACvC,eAAU,GAAwB,IAAI,GAAG,EAAE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AC,EAAE,CAAC,CAAC,CAAA;IAC9E,CAAC;IAEM,iCAAiC,CACtC,eAAgC;QAEhC,OAAO,IAAI,CAAC,mCAAmC;aAC5C,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;aACvB,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACtD,gBAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,+CAA+C,CAAC,CAAA;YACpE,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACN,CAAC;IAEM,aAAa,CAAC,OAAiC;QACpD,MAAM,MAAM,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAC7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACjD,gBAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAA;QAC7E,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC/C,CAAC;CACF;AA/kBD,wBA+kBC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport {\n Attachment,\n Duration,\n Feature,\n getWorstTestStepResult,\n GherkinDocument,\n Hook,\n Location,\n Meta,\n Pickle,\n PickleStep,\n Rule,\n Scenario,\n Step,\n StepDefinition,\n TestCase,\n TestCaseFinished,\n TestCaseStarted,\n TestRunFinished,\n TestRunStarted,\n TestStep,\n TestStepFinished,\n TestStepResult,\n TestStepResultStatus,\n TestStepStarted,\n TimeConversion,\n} from '@cucumber/messages'\nimport { ArrayMultimap } from '@teppeis/multimaps'\nimport sortBy from 'lodash.sortby'\n\nimport { assert, statusOrdinal } from './helpers'\nimport { Lineage, NamingStrategy } from './Lineage'\n\nexport default class Query {\n private readonly testStepResultByPickleId = new ArrayMultimap<string, messages.TestStepResult>()\n private readonly testStepResultsByPickleStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testCaseByPickleId = new Map<string, messages.TestCase>()\n private readonly pickleIdByTestStepId = new Map<string, string>()\n private readonly pickleStepIdByTestStepId = new Map<string, string>()\n private readonly testStepResultsbyTestStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testStepIdsByPickleStepId = new ArrayMultimap<string, string>()\n private readonly hooksById = new Map<string, messages.Hook>()\n private readonly attachmentsByTestStepId = new ArrayMultimap<string, messages.Attachment>()\n private readonly stepMatchArgumentsListsByPickleStepId = new Map<\n string,\n readonly messages.StepMatchArgumentsList[]\n >()\n\n private meta: Meta\n private testRunStarted: TestRunStarted\n private testRunFinished: TestRunFinished\n private readonly testCaseStartedById: Map<string, TestCaseStarted> = new Map()\n private readonly lineageById: Map<string, Lineage> = new Map()\n private readonly stepById: Map<string, Step> = new Map()\n private readonly pickleById: Map<string, Pickle> = new Map()\n private readonly pickleStepById: Map<string, PickleStep> = new Map()\n private readonly stepDefinitionById: Map<string, StepDefinition> = new Map()\n private readonly testCaseById: Map<string, TestCase> = new Map()\n private readonly testStepById: Map<string, TestStep> = new Map()\n private readonly testCaseFinishedByTestCaseStartedId: Map<string, TestCaseFinished> = new Map()\n private readonly testStepStartedByTestCaseStartedId: ArrayMultimap<string, TestStepStarted> =\n new ArrayMultimap()\n private readonly testStepFinishedByTestCaseStartedId: ArrayMultimap<string, TestStepFinished> =\n new ArrayMultimap()\n private readonly attachmentsByTestCaseStartedId: ArrayMultimap<string, Attachment> =\n new ArrayMultimap()\n\n public update(envelope: messages.Envelope) {\n if (envelope.meta) {\n this.meta = envelope.meta\n }\n if (envelope.gherkinDocument) {\n this.updateGherkinDocument(envelope.gherkinDocument)\n }\n if (envelope.pickle) {\n this.updatePickle(envelope.pickle)\n }\n if (envelope.hook) {\n this.hooksById.set(envelope.hook.id, envelope.hook)\n }\n if (envelope.stepDefinition) {\n this.stepDefinitionById.set(envelope.stepDefinition.id, envelope.stepDefinition)\n }\n if (envelope.testRunStarted) {\n this.testRunStarted = envelope.testRunStarted\n }\n if (envelope.testCase) {\n this.updateTestCase(envelope.testCase)\n }\n if (envelope.testCaseStarted) {\n this.updateTestCaseStarted(envelope.testCaseStarted)\n }\n if (envelope.testStepStarted) {\n this.updateTestStepStarted(envelope.testStepStarted)\n }\n if (envelope.attachment) {\n this.updateAttachment(envelope.attachment)\n }\n if (envelope.testStepFinished) {\n this.updateTestStepFinished(envelope.testStepFinished)\n }\n if (envelope.testCaseFinished) {\n this.updateTestCaseFinished(envelope.testCaseFinished)\n }\n if (envelope.testRunFinished) {\n this.testRunFinished = envelope.testRunFinished\n }\n }\n\n private updateGherkinDocument(gherkinDocument: GherkinDocument) {\n if (gherkinDocument.feature) {\n this.updateFeature(gherkinDocument.feature, {\n gherkinDocument,\n })\n }\n }\n\n private updateFeature(feature: Feature, lineage: Lineage) {\n feature.children.forEach((featureChild) => {\n if (featureChild.background) {\n this.updateSteps(featureChild.background.steps)\n }\n if (featureChild.scenario) {\n this.updateScenario(featureChild.scenario, {\n ...lineage,\n feature,\n })\n }\n if (featureChild.rule) {\n this.updateRule(featureChild.rule, {\n ...lineage,\n feature,\n })\n }\n })\n }\n\n private updateRule(rule: Rule, lineage: Lineage) {\n rule.children.forEach((ruleChild) => {\n if (ruleChild.background) {\n this.updateSteps(ruleChild.background.steps)\n }\n if (ruleChild.scenario) {\n this.updateScenario(ruleChild.scenario, {\n ...lineage,\n rule,\n })\n }\n })\n }\n\n private updateScenario(scenario: Scenario, lineage: Lineage) {\n this.lineageById.set(scenario.id, {\n ...lineage,\n scenario,\n })\n scenario.examples.forEach((examples, examplesIndex) => {\n this.lineageById.set(examples.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n })\n examples.tableBody.forEach((example, exampleIndex) => {\n this.lineageById.set(example.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n example,\n exampleIndex,\n })\n })\n })\n this.updateSteps(scenario.steps)\n }\n\n private updateSteps(steps: ReadonlyArray<Step>) {\n steps.forEach((step) => this.stepById.set(step.id, step))\n }\n\n private updatePickle(pickle: Pickle) {\n this.pickleById.set(pickle.id, pickle)\n pickle.steps.forEach((pickleStep) => this.pickleStepById.set(pickleStep.id, pickleStep))\n }\n\n private updateTestCase(testCase: TestCase) {\n this.testCaseById.set(testCase.id, testCase)\n\n this.testCaseByPickleId.set(testCase.pickleId, testCase)\n testCase.testSteps.forEach((testStep) => {\n this.testStepById.set(testStep.id, testStep)\n this.pickleIdByTestStepId.set(testStep.id, testCase.pickleId)\n this.pickleStepIdByTestStepId.set(testStep.id, testStep.pickleStepId)\n this.testStepIdsByPickleStepId.put(testStep.pickleStepId, testStep.id)\n this.stepMatchArgumentsListsByPickleStepId.set(\n testStep.pickleStepId,\n testStep.stepMatchArgumentsLists\n )\n })\n }\n\n private updateTestCaseStarted(testCaseStarted: TestCaseStarted) {\n this.testCaseStartedById.set(testCaseStarted.id, testCaseStarted)\n\n /*\n when a test case attempt starts besides the first one, clear all existing results\n and attachments for that test case, so we always report on the latest attempt\n (applies to legacy pickle-oriented query methods only)\n */\n const testCase = this.testCaseById.get(testCaseStarted.testCaseId)\n if (testCase) {\n this.testStepResultByPickleId.delete(testCase.pickleId)\n for (const testStep of testCase.testSteps) {\n this.testStepResultsByPickleStepId.delete(testStep.pickleStepId)\n this.testStepResultsbyTestStepId.delete(testStep.id)\n this.attachmentsByTestStepId.delete(testStep.id)\n }\n }\n }\n\n private updateTestStepStarted(testStepStarted: TestStepStarted) {\n this.testStepStartedByTestCaseStartedId.put(testStepStarted.testCaseStartedId, testStepStarted)\n }\n\n private updateAttachment(attachment: Attachment) {\n if (attachment.testStepId) {\n this.attachmentsByTestStepId.put(attachment.testStepId, attachment)\n }\n if (attachment.testCaseStartedId) {\n this.attachmentsByTestCaseStartedId.put(attachment.testCaseStartedId, attachment)\n }\n }\n\n private updateTestStepFinished(testStepFinished: TestStepFinished) {\n this.testStepFinishedByTestCaseStartedId.put(\n testStepFinished.testCaseStartedId,\n testStepFinished\n )\n\n const pickleId = this.pickleIdByTestStepId.get(testStepFinished.testStepId)\n this.testStepResultByPickleId.put(pickleId, testStepFinished.testStepResult)\n const testStep = this.testStepById.get(testStepFinished.testStepId)\n this.testStepResultsByPickleStepId.put(testStep.pickleStepId, testStepFinished.testStepResult)\n this.testStepResultsbyTestStepId.put(testStep.id, testStepFinished.testStepResult)\n }\n\n private updateTestCaseFinished(testCaseFinished: TestCaseFinished) {\n this.testCaseFinishedByTestCaseStartedId.set(\n testCaseFinished.testCaseStartedId,\n testCaseFinished\n )\n }\n\n /**\n * Gets all the results for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepTestStepResults(\n pickleStepIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleStepIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleStepIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultsByPickleStepId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the results for multiple pickles\n * @param pickleIds\n */\n public getPickleTestStepResults(\n pickleIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultByPickleId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the attachments for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepAttachments(\n pickleStepIds: readonly string[]\n ): readonly messages.Attachment[] {\n return this.getTestStepsAttachments(\n pickleStepIds.reduce((testStepIds: string[], pickleStepId: string) => {\n return testStepIds.concat(this.testStepIdsByPickleStepId.get(pickleStepId))\n }, [])\n )\n }\n\n public getTestStepsAttachments(testStepIds: readonly string[]): readonly messages.Attachment[] {\n return testStepIds.reduce((attachments: messages.Attachment[], testStepId) => {\n return attachments.concat(this.attachmentsByTestStepId.get(testStepId))\n }, [])\n }\n\n /**\n * Get StepMatchArguments for a pickle step\n * @param pickleStepId\n */\n public getStepMatchArgumentsLists(\n pickleStepId: string\n ): readonly messages.StepMatchArgumentsList[] | undefined {\n return this.stepMatchArgumentsListsByPickleStepId.get(pickleStepId)\n }\n\n public getHook(hookId: string): messages.Hook {\n return this.hooksById.get(hookId)\n }\n\n public getBeforeHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n (hook) => hookSteps.push(hook),\n () => null\n )\n return hookSteps\n }\n\n public getAfterHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n () => null,\n (hook) => hookSteps.push(hook)\n )\n return hookSteps\n }\n\n private identifyHookSteps(\n pickleId: string,\n onBeforeHookFound: (hook: messages.TestStep) => void,\n onAfterHookFound: (hook: messages.TestStep) => void\n ): void {\n const testCase = this.testCaseByPickleId.get(pickleId)\n\n if (!testCase) {\n return\n }\n\n let pickleStepFound = false\n\n for (const step of testCase.testSteps) {\n if (step.hookId) {\n if (pickleStepFound) {\n onAfterHookFound(step)\n } else {\n onBeforeHookFound(step)\n }\n } else {\n pickleStepFound = true\n }\n }\n }\n\n public getTestStepResults(testStepId: string): messages.TestStepResult[] {\n return this.testStepResultsbyTestStepId.get(testStepId)\n }\n\n public getStatusCounts(\n pickleIds: readonly string[]\n ): Partial<Record<messages.TestStepResultStatus, number>> {\n const result: Partial<Record<messages.TestStepResultStatus, number>> = {}\n for (const pickleId of pickleIds) {\n const testStepResult = getWorstTestStepResult(this.getPickleTestStepResults([pickleId]))\n const count = result[testStepResult.status] || 0\n result[testStepResult.status] = count + 1\n }\n return result\n }\n\n /* new common interface with Java starts here */\n\n public countMostSevereTestStepResultStatus(): Record<TestStepResultStatus, number> {\n const result: Record<TestStepResultStatus, number> = {\n [TestStepResultStatus.AMBIGUOUS]: 0,\n [TestStepResultStatus.FAILED]: 0,\n [TestStepResultStatus.PASSED]: 0,\n [TestStepResultStatus.PENDING]: 0,\n [TestStepResultStatus.SKIPPED]: 0,\n [TestStepResultStatus.UNDEFINED]: 0,\n [TestStepResultStatus.UNKNOWN]: 0,\n }\n for (const testCaseStarted of this.findAllTestCaseStarted()) {\n const mostSevereResult = sortBy(\n this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(\n ([testStepFinished]) => testStepFinished.testStepResult\n ),\n [(testStepResult) => statusOrdinal(testStepResult.status)]\n ).at(-1)\n if (mostSevereResult) {\n result[mostSevereResult.status]++\n }\n }\n return result\n }\n\n public countTestCasesStarted(): number {\n return this.findAllTestCaseStarted().length\n }\n\n public findAllPickles(): ReadonlyArray<Pickle> {\n return [...this.pickleById.values()]\n }\n\n public findAllPickleSteps(): ReadonlyArray<PickleStep> {\n return [...this.pickleStepById.values()]\n }\n\n public findAllTestCaseStarted(): ReadonlyArray<TestCaseStarted> {\n return sortBy(\n [...this.testCaseStartedById.values()].filter((testCaseStarted) => {\n const testCaseFinished = this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n // only include if not yet finished OR won't be retried\n return !testCaseFinished?.willBeRetried\n }),\n [\n (testCaseStarted) =>\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp),\n 'id',\n ]\n )\n }\n\n public findAllTestCaseStartedGroupedByFeature(): Map<\n Feature | undefined,\n ReadonlyArray<TestCaseStarted>\n > {\n const results = new Map()\n sortBy(\n this.findAllTestCaseStarted().map(\n (testCaseStarted) => [this.findLineageBy(testCaseStarted), testCaseStarted] as const\n ),\n [([lineage]) => lineage.gherkinDocument.uri]\n ).forEach(([{ feature }, testCaseStarted]) => {\n results.set(feature, [...(results.get(feature) ?? []), testCaseStarted])\n })\n return results\n }\n\n public findAllTestSteps(): ReadonlyArray<TestStep> {\n return [...this.testStepById.values()]\n }\n\n public findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray<Attachment> {\n return this.attachmentsByTestCaseStartedId\n .get(testStepFinished.testCaseStartedId)\n .filter((attachment) => attachment.testStepId === testStepFinished.testStepId)\n }\n\n public findFeatureBy(testCaseStarted: TestCaseStarted): Feature | undefined {\n return this.findLineageBy(testCaseStarted)?.feature\n }\n\n public findHookBy(testStep: TestStep): Hook | undefined {\n if (!testStep.hookId) {\n return undefined\n }\n return this.hooksById.get(testStep.hookId)\n }\n\n public findMeta(): Meta | undefined {\n return this.meta\n }\n\n public findMostSevereTestStepResultBy(\n testCaseStarted: TestCaseStarted\n ): TestStepResult | undefined {\n return sortBy(\n this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(\n ([testStepFinished]) => testStepFinished.testStepResult\n ),\n [(testStepResult) => statusOrdinal(testStepResult.status)]\n ).at(-1)\n }\n\n public findNameOf(pickle: Pickle, namingStrategy: NamingStrategy): string {\n const lineage = this.findLineageBy(pickle)\n return lineage ? namingStrategy.reduce(lineage, pickle) : pickle.name\n }\n\n public findLocationOf(pickle: Pickle): Location | undefined {\n const lineage = this.findLineageBy(pickle)\n if (lineage?.example) {\n return lineage.example.location\n }\n return lineage?.scenario?.location\n }\n\n public findPickleBy(element: TestCaseStarted | TestStepStarted): Pickle | undefined {\n const testCase = this.findTestCaseBy(element)\n assert.ok(testCase, 'Expected to find TestCase from TestCaseStarted')\n return this.pickleById.get(testCase.pickleId)\n }\n\n public findPickleStepBy(testStep: TestStep): PickleStep | undefined {\n if (!testStep.pickleStepId) {\n return undefined\n }\n return this.pickleStepById.get(testStep.pickleStepId)\n }\n\n public findStepBy(pickleStep: PickleStep): Step | undefined {\n const [astNodeId] = pickleStep.astNodeIds\n assert.ok(astNodeId, 'Expected PickleStep to have an astNodeId')\n return this.stepById.get(astNodeId)\n }\n\n public findStepDefinitionsBy(testStep: TestStep): ReadonlyArray<StepDefinition> {\n return (testStep.stepDefinitionIds ?? []).map((id) => this.stepDefinitionById.get(id))\n }\n\n public findUnambiguousStepDefinitionBy(testStep: TestStep): StepDefinition | undefined {\n if (testStep.stepDefinitionIds?.length === 1) {\n return this.stepDefinitionById.get(testStep.stepDefinitionIds[0])\n }\n return undefined\n }\n\n public findTestCaseBy(element: TestCaseStarted | TestStepStarted): TestCase | undefined {\n const testCaseStarted =\n 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element\n assert.ok(testCaseStarted, 'Expected to find TestCaseStarted by TestStepStarted')\n return this.testCaseById.get(testCaseStarted.testCaseId)\n }\n\n public findTestCaseDurationBy(testCaseStarted: TestCaseStarted): Duration | undefined {\n const testCaseFinished = this.findTestCaseFinishedBy(testCaseStarted)\n if (!testCaseFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp)\n )\n }\n\n public findTestCaseStartedBy(testStepStarted: TestStepStarted): TestCaseStarted | undefined {\n return this.testCaseStartedById.get(testStepStarted.testCaseStartedId)\n }\n\n public findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined {\n return this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n }\n\n public findTestRunDuration(): Duration | undefined {\n if (!this.testRunStarted || !this.testRunFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunStarted.timestamp)\n )\n }\n\n public findTestRunFinished(): TestRunFinished | undefined {\n return this.testRunFinished\n }\n\n public findTestRunStarted(): TestRunStarted | undefined {\n return this.testRunStarted\n }\n\n public findTestStepBy(element: TestStepStarted | TestStepFinished): TestStep | undefined {\n return this.testStepById.get(element.testStepId)\n }\n\n public findTestStepsStartedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepStarted> {\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepStartedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepsFinishedBy(\n testCaseStarted: TestCaseStarted\n ): ReadonlyArray<TestStepFinished> {\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepFinishedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepFinishedAndTestStepBy(\n testCaseStarted: TestCaseStarted\n ): ReadonlyArray<[TestStepFinished, TestStep]> {\n return this.testStepFinishedByTestCaseStartedId\n .get(testCaseStarted.id)\n .map((testStepFinished) => {\n const testStep = this.findTestStepBy(testStepFinished)\n assert.ok(testStep, 'Expected to find TestStep by TestStepFinished')\n return [testStepFinished, testStep]\n })\n }\n\n public findLineageBy(element: Pickle | TestCaseStarted): Lineage | undefined {\n const pickle = 'testCaseId' in element ? this.findPickleBy(element) : element\n const deepestAstNodeId = pickle.astNodeIds.at(-1)\n assert.ok(deepestAstNodeId, 'Expected Pickle to have at least one astNodeId')\n return this.lineageById.get(deepestAstNodeId)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,iDA2B2B;AAC3B,kDAAkD;AAClD,kEAAkC;AAElC,uCAAiD;AAGjD,MAAqB,KAAK;IAA1B;QACmB,6BAAwB,GAAG,IAAI,yBAAa,EAAmC,CAAA;QAC/E,kCAA6B,GAAG,IAAI,yBAAa,EAG/D,CAAA;QACc,uBAAkB,GAAG,IAAI,GAAG,EAA6B,CAAA;QACzD,yBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAA;QAChD,6BAAwB,GAAG,IAAI,GAAG,EAAkB,CAAA;QACpD,gCAA2B,GAAG,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5C,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;aACvB,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACtD,gBAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,+CAA+C,CAAC,CAAA;YACpE,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACN,CAAC;IAEM,aAAa,CAAC,OAAiC;QACpD,MAAM,MAAM,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAC7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACjD,gBAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAA;QAC7E,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC/C,CAAC;CACF;AA/mBD,wBA+mBC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport {\n Attachment,\n Duration,\n Feature,\n getWorstTestStepResult,\n GherkinDocument,\n Hook,\n Location,\n Meta,\n Pickle,\n PickleStep,\n Rule,\n Scenario,\n Step,\n StepDefinition,\n Suggestion,\n TestCase,\n TestCaseFinished,\n TestCaseStarted,\n TestRunFinished,\n TestRunStarted,\n TestStep,\n TestStepFinished,\n TestStepResult,\n TestStepResultStatus,\n TestStepStarted,\n TimeConversion,\n} from '@cucumber/messages'\nimport { ArrayMultimap } from '@teppeis/multimaps'\nimport sortBy from 'lodash.sortby'\n\nimport { assert, statusOrdinal } from './helpers'\nimport { Lineage } from './Lineage'\n\nexport default class Query {\n private readonly testStepResultByPickleId = new ArrayMultimap<string, messages.TestStepResult>()\n private readonly testStepResultsByPickleStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testCaseByPickleId = new Map<string, messages.TestCase>()\n private readonly pickleIdByTestStepId = new Map<string, string>()\n private readonly pickleStepIdByTestStepId = new Map<string, string>()\n private readonly testStepResultsbyTestStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testStepIdsByPickleStepId = new ArrayMultimap<string, string>()\n private readonly hooksById = new Map<string, messages.Hook>()\n private readonly attachmentsByTestStepId = new ArrayMultimap<string, messages.Attachment>()\n private readonly stepMatchArgumentsListsByPickleStepId = new Map<\n string,\n readonly messages.StepMatchArgumentsList[]\n >()\n\n private meta: Meta\n private testRunStarted: TestRunStarted\n private testRunFinished: TestRunFinished\n private readonly testCaseStartedById: Map<string, TestCaseStarted> = new Map()\n private readonly lineageById: Map<string, Lineage> = new Map()\n private readonly stepById: Map<string, Step> = new Map()\n private readonly pickleById: Map<string, Pickle> = new Map()\n private readonly pickleStepById: Map<string, PickleStep> = new Map()\n private readonly stepDefinitionById: Map<string, StepDefinition> = new Map()\n private readonly testCaseById: Map<string, TestCase> = new Map()\n private readonly testStepById: Map<string, TestStep> = new Map()\n private readonly testCaseFinishedByTestCaseStartedId: Map<string, TestCaseFinished> = new Map()\n private readonly testStepStartedByTestCaseStartedId: ArrayMultimap<string, TestStepStarted> =\n new ArrayMultimap()\n private readonly testStepFinishedByTestCaseStartedId: ArrayMultimap<string, TestStepFinished> =\n new ArrayMultimap()\n private readonly attachmentsByTestCaseStartedId: ArrayMultimap<string, Attachment> =\n new ArrayMultimap()\n private readonly suggestionsByPickleStepId: ArrayMultimap<string, Suggestion> =\n new ArrayMultimap()\n\n public update(envelope: messages.Envelope) {\n if (envelope.meta) {\n this.meta = envelope.meta\n }\n if (envelope.gherkinDocument) {\n this.updateGherkinDocument(envelope.gherkinDocument)\n }\n if (envelope.pickle) {\n this.updatePickle(envelope.pickle)\n }\n if (envelope.hook) {\n this.hooksById.set(envelope.hook.id, envelope.hook)\n }\n if (envelope.stepDefinition) {\n this.stepDefinitionById.set(envelope.stepDefinition.id, envelope.stepDefinition)\n }\n if (envelope.testRunStarted) {\n this.testRunStarted = envelope.testRunStarted\n }\n if (envelope.testCase) {\n this.updateTestCase(envelope.testCase)\n }\n if (envelope.testCaseStarted) {\n this.updateTestCaseStarted(envelope.testCaseStarted)\n }\n if (envelope.testStepStarted) {\n this.updateTestStepStarted(envelope.testStepStarted)\n }\n if (envelope.attachment) {\n this.updateAttachment(envelope.attachment)\n }\n if (envelope.testStepFinished) {\n this.updateTestStepFinished(envelope.testStepFinished)\n }\n if (envelope.testCaseFinished) {\n this.updateTestCaseFinished(envelope.testCaseFinished)\n }\n if (envelope.testRunFinished) {\n this.testRunFinished = envelope.testRunFinished\n }\n\n if (envelope.suggestion) {\n this.updateSuggestion(envelope.suggestion)\n }\n }\n\n private updateGherkinDocument(gherkinDocument: GherkinDocument) {\n if (gherkinDocument.feature) {\n this.updateFeature(gherkinDocument.feature, {\n gherkinDocument,\n })\n }\n }\n\n private updateFeature(feature: Feature, lineage: Lineage) {\n feature.children.forEach((featureChild) => {\n if (featureChild.background) {\n this.updateSteps(featureChild.background.steps)\n }\n if (featureChild.scenario) {\n this.updateScenario(featureChild.scenario, {\n ...lineage,\n feature,\n })\n }\n if (featureChild.rule) {\n this.updateRule(featureChild.rule, {\n ...lineage,\n feature,\n })\n }\n })\n }\n\n private updateRule(rule: Rule, lineage: Lineage) {\n rule.children.forEach((ruleChild) => {\n if (ruleChild.background) {\n this.updateSteps(ruleChild.background.steps)\n }\n if (ruleChild.scenario) {\n this.updateScenario(ruleChild.scenario, {\n ...lineage,\n rule,\n })\n }\n })\n }\n\n private updateScenario(scenario: Scenario, lineage: Lineage) {\n this.lineageById.set(scenario.id, {\n ...lineage,\n scenario,\n })\n scenario.examples.forEach((examples, examplesIndex) => {\n this.lineageById.set(examples.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n })\n examples.tableBody.forEach((example, exampleIndex) => {\n this.lineageById.set(example.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n example,\n exampleIndex,\n })\n })\n })\n this.updateSteps(scenario.steps)\n }\n\n private updateSteps(steps: ReadonlyArray<Step>) {\n steps.forEach((step) => this.stepById.set(step.id, step))\n }\n\n private updatePickle(pickle: Pickle) {\n this.pickleById.set(pickle.id, pickle)\n pickle.steps.forEach((pickleStep) => this.pickleStepById.set(pickleStep.id, pickleStep))\n }\n\n private updateTestCase(testCase: TestCase) {\n this.testCaseById.set(testCase.id, testCase)\n\n this.testCaseByPickleId.set(testCase.pickleId, testCase)\n testCase.testSteps.forEach((testStep) => {\n this.testStepById.set(testStep.id, testStep)\n this.pickleIdByTestStepId.set(testStep.id, testCase.pickleId)\n this.pickleStepIdByTestStepId.set(testStep.id, testStep.pickleStepId)\n this.testStepIdsByPickleStepId.put(testStep.pickleStepId, testStep.id)\n this.stepMatchArgumentsListsByPickleStepId.set(\n testStep.pickleStepId,\n testStep.stepMatchArgumentsLists\n )\n })\n }\n\n private updateTestCaseStarted(testCaseStarted: TestCaseStarted) {\n this.testCaseStartedById.set(testCaseStarted.id, testCaseStarted)\n\n /*\n when a test case attempt starts besides the first one, clear all existing results\n and attachments for that test case, so we always report on the latest attempt\n (applies to legacy pickle-oriented query methods only)\n */\n const testCase = this.testCaseById.get(testCaseStarted.testCaseId)\n if (testCase) {\n this.testStepResultByPickleId.delete(testCase.pickleId)\n for (const testStep of testCase.testSteps) {\n this.testStepResultsByPickleStepId.delete(testStep.pickleStepId)\n this.testStepResultsbyTestStepId.delete(testStep.id)\n this.attachmentsByTestStepId.delete(testStep.id)\n }\n }\n }\n\n private updateTestStepStarted(testStepStarted: TestStepStarted) {\n this.testStepStartedByTestCaseStartedId.put(testStepStarted.testCaseStartedId, testStepStarted)\n }\n\n private updateAttachment(attachment: Attachment) {\n if (attachment.testStepId) {\n this.attachmentsByTestStepId.put(attachment.testStepId, attachment)\n }\n if (attachment.testCaseStartedId) {\n this.attachmentsByTestCaseStartedId.put(attachment.testCaseStartedId, attachment)\n }\n }\n\n private updateTestStepFinished(testStepFinished: TestStepFinished) {\n this.testStepFinishedByTestCaseStartedId.put(\n testStepFinished.testCaseStartedId,\n testStepFinished\n )\n\n const pickleId = this.pickleIdByTestStepId.get(testStepFinished.testStepId)\n this.testStepResultByPickleId.put(pickleId, testStepFinished.testStepResult)\n const testStep = this.testStepById.get(testStepFinished.testStepId)\n this.testStepResultsByPickleStepId.put(testStep.pickleStepId, testStepFinished.testStepResult)\n this.testStepResultsbyTestStepId.put(testStep.id, testStepFinished.testStepResult)\n }\n\n private updateTestCaseFinished(testCaseFinished: TestCaseFinished) {\n this.testCaseFinishedByTestCaseStartedId.set(\n testCaseFinished.testCaseStartedId,\n testCaseFinished\n )\n }\n\n private updateSuggestion(suggestion: Suggestion) {\n this.suggestionsByPickleStepId.put(suggestion.pickleStepId, suggestion)\n }\n\n /**\n * Gets all the results for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepTestStepResults(\n pickleStepIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleStepIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleStepIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultsByPickleStepId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the results for multiple pickles\n * @param pickleIds\n */\n public getPickleTestStepResults(\n pickleIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultByPickleId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the attachments for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepAttachments(\n pickleStepIds: readonly string[]\n ): readonly messages.Attachment[] {\n return this.getTestStepsAttachments(\n pickleStepIds.reduce((testStepIds: string[], pickleStepId: string) => {\n return testStepIds.concat(this.testStepIdsByPickleStepId.get(pickleStepId))\n }, [])\n )\n }\n\n public getTestStepsAttachments(testStepIds: readonly string[]): readonly messages.Attachment[] {\n return testStepIds.reduce((attachments: messages.Attachment[], testStepId) => {\n return attachments.concat(this.attachmentsByTestStepId.get(testStepId))\n }, [])\n }\n\n /**\n * Get StepMatchArguments for a pickle step\n * @param pickleStepId\n */\n public getStepMatchArgumentsLists(\n pickleStepId: string\n ): readonly messages.StepMatchArgumentsList[] | undefined {\n return this.stepMatchArgumentsListsByPickleStepId.get(pickleStepId)\n }\n\n public getHook(hookId: string): messages.Hook {\n return this.hooksById.get(hookId)\n }\n\n public getBeforeHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n (hook) => hookSteps.push(hook),\n () => null\n )\n return hookSteps\n }\n\n public getAfterHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n () => null,\n (hook) => hookSteps.push(hook)\n )\n return hookSteps\n }\n\n private identifyHookSteps(\n pickleId: string,\n onBeforeHookFound: (hook: messages.TestStep) => void,\n onAfterHookFound: (hook: messages.TestStep) => void\n ): void {\n const testCase = this.testCaseByPickleId.get(pickleId)\n\n if (!testCase) {\n return\n }\n\n let pickleStepFound = false\n\n for (const step of testCase.testSteps) {\n if (step.hookId) {\n if (pickleStepFound) {\n onAfterHookFound(step)\n } else {\n onBeforeHookFound(step)\n }\n } else {\n pickleStepFound = true\n }\n }\n }\n\n public getTestStepResults(testStepId: string): messages.TestStepResult[] {\n return this.testStepResultsbyTestStepId.get(testStepId)\n }\n\n public getStatusCounts(\n pickleIds: readonly string[]\n ): Partial<Record<messages.TestStepResultStatus, number>> {\n const result: Partial<Record<messages.TestStepResultStatus, number>> = {}\n for (const pickleId of pickleIds) {\n const testStepResult = getWorstTestStepResult(this.getPickleTestStepResults([pickleId]))\n const count = result[testStepResult.status] || 0\n result[testStepResult.status] = count + 1\n }\n return result\n }\n\n /* new common interface with Java starts here */\n\n public countMostSevereTestStepResultStatus(): Record<TestStepResultStatus, number> {\n const result: Record<TestStepResultStatus, number> = {\n [TestStepResultStatus.AMBIGUOUS]: 0,\n [TestStepResultStatus.FAILED]: 0,\n [TestStepResultStatus.PASSED]: 0,\n [TestStepResultStatus.PENDING]: 0,\n [TestStepResultStatus.SKIPPED]: 0,\n [TestStepResultStatus.UNDEFINED]: 0,\n [TestStepResultStatus.UNKNOWN]: 0,\n }\n for (const testCaseStarted of this.findAllTestCaseStarted()) {\n const mostSevereResult = sortBy(\n this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(\n ([testStepFinished]) => testStepFinished.testStepResult\n ),\n [(testStepResult) => statusOrdinal(testStepResult.status)]\n ).at(-1)\n if (mostSevereResult) {\n result[mostSevereResult.status]++\n }\n }\n return result\n }\n\n public countTestCasesStarted(): number {\n return this.findAllTestCaseStarted().length\n }\n\n public findAllPickles(): ReadonlyArray<Pickle> {\n return [...this.pickleById.values()]\n }\n\n public findAllPickleSteps(): ReadonlyArray<PickleStep> {\n return [...this.pickleStepById.values()]\n }\n\n public findAllTestCaseStarted(): ReadonlyArray<TestCaseStarted> {\n return sortBy(\n [...this.testCaseStartedById.values()].filter((testCaseStarted) => {\n const testCaseFinished = this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n // only include if not yet finished OR won't be retried\n return !testCaseFinished?.willBeRetried\n }),\n [\n (testCaseStarted) =>\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp),\n 'id',\n ]\n )\n }\n\n public findAllTestCaseFinished(): ReadonlyArray<TestCaseFinished> {\n return sortBy(\n [...this.testCaseFinishedByTestCaseStartedId.values()].filter((testCaseFinished) => {\n // only include if not yet finished OR won't be retried\n return !testCaseFinished?.willBeRetried\n }),\n [\n (testCaseFinished) =>\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp),\n 'id',\n ]\n )\n }\n\n public findAllTestSteps(): ReadonlyArray<TestStep> {\n return [...this.testStepById.values()]\n }\n\n public findAllTestStepStarted(): ReadonlyArray<TestStepStarted> {\n return [...this.testStepStartedByTestCaseStartedId.values()]\n }\n\n public findAllTestStepFinished(): ReadonlyArray<TestStepFinished> {\n return [...this.testStepFinishedByTestCaseStartedId.values()]\n }\n\n public findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray<Attachment> {\n return this.attachmentsByTestCaseStartedId\n .get(testStepFinished.testCaseStartedId)\n .filter((attachment) => attachment.testStepId === testStepFinished.testStepId)\n }\n\n public findHookBy(testStep: TestStep): Hook | undefined {\n if (!testStep.hookId) {\n return undefined\n }\n return this.hooksById.get(testStep.hookId)\n }\n\n public findMeta(): Meta | undefined {\n return this.meta\n }\n\n public findMostSevereTestStepResultBy(\n element: TestCaseStarted | TestCaseFinished\n ): TestStepResult | undefined {\n const testCaseStarted =\n 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element\n return sortBy(\n this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(\n ([testStepFinished]) => testStepFinished.testStepResult\n ),\n [(testStepResult) => statusOrdinal(testStepResult.status)]\n ).at(-1)\n }\n\n public findLocationOf(pickle: Pickle): Location | undefined {\n const lineage = this.findLineageBy(pickle)\n if (lineage?.example) {\n return lineage.example.location\n }\n return lineage?.scenario?.location\n }\n\n public findPickleBy(\n element: TestCaseStarted | TestCaseFinished | TestStepStarted\n ): Pickle | undefined {\n const testCase = this.findTestCaseBy(element)\n assert.ok(testCase, 'Expected to find TestCase from TestCaseStarted')\n return this.pickleById.get(testCase.pickleId)\n }\n\n public findPickleStepBy(testStep: TestStep): PickleStep | undefined {\n if (!testStep.pickleStepId) {\n return undefined\n }\n return this.pickleStepById.get(testStep.pickleStepId)\n }\n\n public findStepBy(pickleStep: PickleStep): Step | undefined {\n const [astNodeId] = pickleStep.astNodeIds\n assert.ok(astNodeId, 'Expected PickleStep to have an astNodeId')\n return this.stepById.get(astNodeId)\n }\n\n public findStepDefinitionsBy(testStep: TestStep): ReadonlyArray<StepDefinition> {\n return (testStep.stepDefinitionIds ?? []).map((id) => this.stepDefinitionById.get(id))\n }\n\n findSuggestionsBy(element: PickleStep | Pickle): ReadonlyArray<Suggestion> {\n if ('steps' in element) {\n return element.steps.flatMap((value) => this.findSuggestionsBy(value))\n }\n return this.suggestionsByPickleStepId.get(element.id)\n }\n\n public findUnambiguousStepDefinitionBy(testStep: TestStep): StepDefinition | undefined {\n if (testStep.stepDefinitionIds?.length === 1) {\n return this.stepDefinitionById.get(testStep.stepDefinitionIds[0])\n }\n return undefined\n }\n\n public findTestCaseBy(\n element: TestCaseStarted | TestCaseFinished | TestStepStarted | TestStepFinished\n ): TestCase | undefined {\n const testCaseStarted =\n 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element\n assert.ok(testCaseStarted, 'Expected to find TestCaseStarted by TestStepStarted')\n return this.testCaseById.get(testCaseStarted.testCaseId)\n }\n\n public findTestCaseDurationBy(element: TestCaseStarted | TestCaseFinished): Duration | undefined {\n let testCaseStarted: TestCaseStarted\n let testCaseFinished: TestCaseFinished\n if ('testCaseStartedId' in element) {\n testCaseStarted = this.findTestCaseStartedBy(element)\n testCaseFinished = element\n } else {\n testCaseStarted = element\n testCaseFinished = this.findTestCaseFinishedBy(element)\n }\n if (!testCaseFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp)\n )\n }\n\n public findTestCaseStartedBy(\n element: TestCaseFinished | TestStepStarted | TestStepFinished\n ): TestCaseStarted | undefined {\n return this.testCaseStartedById.get(element.testCaseStartedId)\n }\n\n public findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined {\n return this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n }\n\n public findTestRunDuration(): Duration | undefined {\n if (!this.testRunStarted || !this.testRunFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunStarted.timestamp)\n )\n }\n\n public findTestRunFinished(): TestRunFinished | undefined {\n return this.testRunFinished\n }\n\n public findTestRunStarted(): TestRunStarted | undefined {\n return this.testRunStarted\n }\n\n public findTestStepBy(element: TestStepStarted | TestStepFinished): TestStep | undefined {\n return this.testStepById.get(element.testStepId)\n }\n\n public findTestStepsStartedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepStarted> {\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepStartedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepsFinishedBy(\n element: TestCaseStarted | TestCaseFinished\n ): ReadonlyArray<TestStepFinished> {\n const testCaseStarted =\n 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepFinishedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepFinishedAndTestStepBy(\n testCaseStarted: TestCaseStarted\n ): ReadonlyArray<[TestStepFinished, TestStep]> {\n return this.testStepFinishedByTestCaseStartedId\n .get(testCaseStarted.id)\n .map((testStepFinished) => {\n const testStep = this.findTestStepBy(testStepFinished)\n assert.ok(testStep, 'Expected to find TestStep by TestStepFinished')\n return [testStepFinished, testStep]\n })\n }\n\n public findLineageBy(element: Pickle | TestCaseStarted): Lineage | undefined {\n const pickle = 'testCaseId' in element ? this.findPickleBy(element) : element\n const deepestAstNodeId = pickle.astNodeIds.at(-1)\n assert.ok(deepestAstNodeId, 'Expected Pickle to have at least one astNodeId')\n return this.lineageById.get(deepestAstNodeId)\n }\n}\n"]}
|