testit-adapter-jest 5.0.7 → 5.0.8-TMS-5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -6
- package/dist/testitEnvironment.d.ts +0 -6
- package/dist/testitEnvironment.js +27 -34
- package/package.json +2 -2
- package/types.d.ts +0 -6
package/README.md
CHANGED
|
@@ -123,14 +123,12 @@ $ npx jest -t "$(cat tmp/filter.txt)"
|
|
|
123
123
|
Methods can be used to specify information about autotest.
|
|
124
124
|
|
|
125
125
|
Description of metadata methods:
|
|
126
|
-
- `testit.
|
|
127
|
-
- `testit.workItemIds` - deprecated, use `testit.workItemId` instead
|
|
126
|
+
- `testit.workItemIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
|
|
128
127
|
- `testit.displayName` - internal autotest name (used in Test IT)
|
|
129
128
|
- `testit.externalId` - unique internal autotest ID (used in Test IT)
|
|
130
129
|
- `testit.title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
|
|
131
130
|
- `testit.description` - autotest description specified in the autotest card
|
|
132
131
|
- `testit.labels` - labels listed in the autotest card
|
|
133
|
-
- `testit.layer` - test pyramid layer in the autotest card (source **Run**). Use `TestLayers` from `testit-js-commons` for recommended values (`E2E`, `UI`, `API`, `Contract`, `Integration`, `Component`, `Unit`), or any custom string
|
|
134
132
|
- `testit.tags` - tags listed in the autotest card
|
|
135
133
|
- `testit.link` - links listed in the autotest card
|
|
136
134
|
- `testit.namespace` - directory in the TMS system (default - directory's name of test)
|
|
@@ -146,15 +144,12 @@ Description of methods:
|
|
|
146
144
|
|
|
147
145
|
#### Simple test
|
|
148
146
|
```js
|
|
149
|
-
import { TestLayers } from 'testit-js-commons';
|
|
150
|
-
|
|
151
147
|
test('All annotations', () => {
|
|
152
148
|
testit.externalId('all_annotations');
|
|
153
149
|
testit.displayName('All annotations');
|
|
154
150
|
testit.title('All annotations title');
|
|
155
151
|
testit.description('Test with all annotations');
|
|
156
152
|
testit.labels(['label1', 'label2']);
|
|
157
|
-
testit.layer(TestLayers.API);
|
|
158
153
|
|
|
159
154
|
testit.addMessage('This is a message');
|
|
160
155
|
testit.addLinks([
|
|
@@ -47,7 +47,6 @@ export default class TestItEnvironment extends NodeEnvironment {
|
|
|
47
47
|
private snapshotAutotestData;
|
|
48
48
|
private buildSetupSteps;
|
|
49
49
|
private buildTeardownSteps;
|
|
50
|
-
private buildAutotestPost;
|
|
51
50
|
private sendRealtimePayload;
|
|
52
51
|
/** afterAll hooks run after all tests; patch teardown when importRealtime is enabled. */
|
|
53
52
|
private flushRealtimeTeardown;
|
|
@@ -62,12 +61,7 @@ export default class TestItEnvironment extends NodeEnvironment {
|
|
|
62
61
|
addAttachments(attachments: string[]): void;
|
|
63
62
|
setLinks(links: Link[]): void;
|
|
64
63
|
setLabels(labels: string[]): void;
|
|
65
|
-
setLayer(layer: string): void;
|
|
66
64
|
setTags(tags: string[]): void;
|
|
67
|
-
setWorkItemId(globalId: string): void;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Use workItemId with a single globalId instead.
|
|
70
|
-
*/
|
|
71
65
|
setWorkItems(workItems: string[]): void;
|
|
72
66
|
setParams(params: any): void;
|
|
73
67
|
setNameSpace(nameSpace: string): void;
|
|
@@ -94,9 +94,7 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
94
94
|
displayName: this.setDisplayName.bind(this),
|
|
95
95
|
links: this.setLinks.bind(this),
|
|
96
96
|
labels: this.setLabels.bind(this),
|
|
97
|
-
layer: this.setLayer.bind(this),
|
|
98
97
|
tags: this.setTags.bind(this),
|
|
99
|
-
workItemId: this.setWorkItemId.bind(this),
|
|
100
98
|
workItemIds: this.setWorkItems.bind(this),
|
|
101
99
|
params: this.setParams.bind(this),
|
|
102
100
|
step: this.startStep.bind(this),
|
|
@@ -288,15 +286,24 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
288
286
|
const afterEach = autotest.afterEach;
|
|
289
287
|
return includeAfterAll ? afterEach.concat(this.afterAllSteps) : afterEach;
|
|
290
288
|
}
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
async sendRealtimePayload(autotest, result, includeAfterAll) {
|
|
290
|
+
const setupSteps = this.buildSetupSteps(autotest);
|
|
291
|
+
const teardownSteps = this.buildTeardownSteps(autotest, includeAfterAll);
|
|
292
|
+
testit_js_commons_2.logger.debug("[jest-env] sendRealtimePayload", {
|
|
293
|
+
externalId: autotest.externalId,
|
|
294
|
+
outcome: result.outcome,
|
|
295
|
+
includeAfterAll,
|
|
296
|
+
setupSteps: setupSteps.length,
|
|
297
|
+
teardownSteps: teardownSteps.length,
|
|
298
|
+
testSteps: autotest.testSteps.length,
|
|
299
|
+
});
|
|
300
|
+
const autotestPost = {
|
|
293
301
|
externalId: autotest.externalId,
|
|
294
302
|
title: autotest.title,
|
|
295
303
|
name: autotest.name,
|
|
296
304
|
description: autotest.description,
|
|
297
305
|
links: autotest.links,
|
|
298
306
|
labels: autotest.labels,
|
|
299
|
-
layer: autotest.layer,
|
|
300
307
|
tags: autotest.tags,
|
|
301
308
|
namespace: autotest.namespace ?? testit_js_commons_1.Utils.getDir(this.testPath),
|
|
302
309
|
classname: autotest.classname ?? testit_js_commons_1.Utils.getFileName(this.testPath),
|
|
@@ -304,21 +311,7 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
304
311
|
steps: autotest.testSteps,
|
|
305
312
|
teardown: teardownSteps,
|
|
306
313
|
externalKey: autotest.externalKey,
|
|
307
|
-
workItemIds: autotest.workItemIds,
|
|
308
314
|
};
|
|
309
|
-
}
|
|
310
|
-
async sendRealtimePayload(autotest, result, includeAfterAll) {
|
|
311
|
-
const setupSteps = this.buildSetupSteps(autotest);
|
|
312
|
-
const teardownSteps = this.buildTeardownSteps(autotest, includeAfterAll);
|
|
313
|
-
testit_js_commons_2.logger.debug("[jest-env] sendRealtimePayload", {
|
|
314
|
-
externalId: autotest.externalId,
|
|
315
|
-
outcome: result.outcome,
|
|
316
|
-
includeAfterAll,
|
|
317
|
-
setupSteps: setupSteps.length,
|
|
318
|
-
teardownSteps: teardownSteps.length,
|
|
319
|
-
testSteps: autotest.testSteps.length,
|
|
320
|
-
});
|
|
321
|
-
const autotestPost = this.buildAutotestPost(autotest, setupSteps, teardownSteps);
|
|
322
315
|
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
323
316
|
await this.strategy.loadTestRun([
|
|
324
317
|
{
|
|
@@ -358,8 +351,6 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
358
351
|
if (setupSteps.length === 0 && teardownSteps.length === 0) {
|
|
359
352
|
continue;
|
|
360
353
|
}
|
|
361
|
-
const autotestPost = this.buildAutotestPost(autotest, setupSteps, teardownSteps);
|
|
362
|
-
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
363
354
|
await this.strategy.updateSetupTeardown([
|
|
364
355
|
{
|
|
365
356
|
autoTestExternalId: autotest.externalId,
|
|
@@ -389,7 +380,21 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
389
380
|
log("Mapping autotest %s", autotest.name);
|
|
390
381
|
const setupSteps = this.beforeAllSteps.concat(autotest.beforeEach);
|
|
391
382
|
const teardownSteps = autotest.afterEach.concat(this.afterAllSteps);
|
|
392
|
-
const autotestPost =
|
|
383
|
+
const autotestPost = {
|
|
384
|
+
externalId: autotest.externalId,
|
|
385
|
+
title: autotest.title,
|
|
386
|
+
name: autotest.name,
|
|
387
|
+
description: autotest.description,
|
|
388
|
+
links: autotest.links,
|
|
389
|
+
labels: autotest.labels,
|
|
390
|
+
tags: autotest.tags,
|
|
391
|
+
namespace: autotest.namespace ?? testit_js_commons_1.Utils.getDir(this.testPath),
|
|
392
|
+
classname: autotest.classname ?? testit_js_commons_1.Utils.getFileName(this.testPath),
|
|
393
|
+
setup: setupSteps,
|
|
394
|
+
steps: autotest.testSteps,
|
|
395
|
+
teardown: teardownSteps,
|
|
396
|
+
externalKey: autotest.externalKey,
|
|
397
|
+
};
|
|
393
398
|
try {
|
|
394
399
|
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
395
400
|
}
|
|
@@ -481,23 +486,11 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
481
486
|
log("Setting labels to %s", this.autotestData.name);
|
|
482
487
|
this.autotestData.labels = labels.map((label) => ({ name: label }));
|
|
483
488
|
}
|
|
484
|
-
setLayer(layer) {
|
|
485
|
-
log("Setting layer to %s for %s", layer, this.autotestData.name);
|
|
486
|
-
this.autotestData.layer = layer;
|
|
487
|
-
}
|
|
488
489
|
setTags(tags) {
|
|
489
490
|
log("Setting tags to %s", this.autotestData.name);
|
|
490
491
|
this.autotestData.tags = tags;
|
|
491
492
|
}
|
|
492
|
-
setWorkItemId(globalId) {
|
|
493
|
-
log("Setting work item id to %s", this.autotestData.name);
|
|
494
|
-
this.autotestData.workItemIds = [globalId];
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* @deprecated Use workItemId with a single globalId instead.
|
|
498
|
-
*/
|
|
499
493
|
setWorkItems(workItems) {
|
|
500
|
-
testit_js_commons_2.logger.warn("workItemIds is deprecated. Use workItemId with a single globalId instead.");
|
|
501
494
|
log("Setting work items to %s", this.autotestData.name);
|
|
502
495
|
this.autotestData.workItemIds = workItems;
|
|
503
496
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testit-adapter-jest",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.8-TMS-5.8",
|
|
4
4
|
"description": "Jest adapter for Test IT",
|
|
5
5
|
"main": "dist/testitEnvironment.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"debug": "^4.3.4",
|
|
19
|
-
"testit-js-commons": "5.0.
|
|
19
|
+
"testit-js-commons": "5.0.8-TMS-5.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/debug": "^4.1.7",
|
package/types.d.ts
CHANGED
|
@@ -6,12 +6,6 @@ declare global {
|
|
|
6
6
|
displayName(name: string): void;
|
|
7
7
|
links(links: Link[]): void;
|
|
8
8
|
labels(labels: string[]): void;
|
|
9
|
-
layer(layer: string): void;
|
|
10
|
-
tags(tags: string[]): void;
|
|
11
|
-
workItemId(globalId: string): void;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use workItemId with a single globalId instead.
|
|
14
|
-
*/
|
|
15
9
|
workItemIds(workItemsIds: string[]): void;
|
|
16
10
|
params(params: any): void;
|
|
17
11
|
step(name: string, description?: string): void;
|