testit-adapter-codecept 5.0.9-TMS-5.8 → 5.1.0
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
CHANGED
|
@@ -140,12 +140,14 @@ $ npx codeceptjs run --grep "$(cat tmp/filter.txt)"
|
|
|
140
140
|
Methods can be used to specify information about autotest.
|
|
141
141
|
|
|
142
142
|
Description of metadata methods:
|
|
143
|
-
- `
|
|
143
|
+
- `workItemId` - a method that links an autotest with a manual test. Receives a single globalId
|
|
144
|
+
- `workItemIds` - deprecated, use `workItemId` instead
|
|
144
145
|
- `displayName` - internal autotest name (used in Test IT)
|
|
145
146
|
- `externalId` - unique internal autotest ID (used in Test IT)
|
|
146
147
|
- `title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
|
|
147
148
|
- `description` - autotest description specified in the autotest card
|
|
148
149
|
- `labels` - labels listed in the autotest card
|
|
150
|
+
- `layer` - test pyramid layer in the autotest card (source **Run**). Use `TestLayers` from `testit-js-commons` for recommended values, or any custom string
|
|
149
151
|
- `tags` - tags listed in the autotest card
|
|
150
152
|
- `link` - links listed in the autotest card
|
|
151
153
|
- `namespace` - directory in the TMS system
|
|
@@ -170,6 +172,7 @@ Scenario(
|
|
|
170
172
|
title: 'Title',
|
|
171
173
|
description: 'Description',
|
|
172
174
|
labels: ['Custom label'],
|
|
175
|
+
layer: 'API',
|
|
173
176
|
links: [
|
|
174
177
|
{
|
|
175
178
|
title: 'Google about this error',
|
|
@@ -179,7 +182,7 @@ Scenario(
|
|
|
179
182
|
hasInfo: true
|
|
180
183
|
}
|
|
181
184
|
],
|
|
182
|
-
|
|
185
|
+
workItemId: '1140'
|
|
183
186
|
},
|
|
184
187
|
({ I }) => {
|
|
185
188
|
I.amOnPage('https://github.com');
|
package/build/bootstrap.js
CHANGED
|
@@ -3,13 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const codeceptjs_1 = require("codeceptjs");
|
|
4
4
|
const testit_js_commons_1 = require("testit-js-commons");
|
|
5
5
|
const builders_1 = require("./builders");
|
|
6
|
-
module.exports = async function (
|
|
6
|
+
module.exports = async function () {
|
|
7
7
|
const config = new testit_js_commons_1.ConfigComposer().compose();
|
|
8
8
|
const strategy = testit_js_commons_1.StrategyFactory.create(config);
|
|
9
9
|
const helper = codeceptjs_1.container.helpers("TestITHelper");
|
|
10
10
|
await strategy.setup();
|
|
11
|
+
let finalized = false;
|
|
12
|
+
const finalize = async () => {
|
|
13
|
+
if (finalized) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
finalized = true;
|
|
17
|
+
await strategy.teardown();
|
|
18
|
+
};
|
|
11
19
|
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.test.finished, (test) => {
|
|
12
20
|
codeceptjs_1.recorder.add("transferTestAndRuns", async () => {
|
|
21
|
+
// Keep sync-storage LastStatus fresh; otherwise Force Work X fires after ~60s of in_progress.
|
|
22
|
+
await strategy.touchWorker();
|
|
13
23
|
const autotest = builders_1.TestsBuilder.build(test);
|
|
14
24
|
await strategy.loadAutotest(autotest, test.state);
|
|
15
25
|
const result = await new builders_1.ResultBuilder(config).build(test, helper.metadata);
|
|
@@ -17,7 +27,20 @@ module.exports = async function (options) {
|
|
|
17
27
|
helper.metadata = {};
|
|
18
28
|
});
|
|
19
29
|
});
|
|
30
|
+
// Single-process `codeceptjs run` — workers.after never fires.
|
|
31
|
+
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.all.result, () => {
|
|
32
|
+
if (process.env.RUNS_WITH_WORKERS) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
codeceptjs_1.recorder.add("testitTeardown", async () => {
|
|
36
|
+
await finalize();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
// Parallel `codeceptjs run-workers`.
|
|
40
|
+
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.workers.result, async () => {
|
|
41
|
+
await finalize();
|
|
42
|
+
});
|
|
20
43
|
codeceptjs_1.event.dispatcher.on(codeceptjs_1.event.workers.after, async () => {
|
|
21
|
-
await
|
|
44
|
+
await finalize();
|
|
22
45
|
});
|
|
23
46
|
};
|
|
@@ -10,7 +10,7 @@ class ResultBuilder {
|
|
|
10
10
|
this.additions = new testit_js_commons_1.Additions(config);
|
|
11
11
|
}
|
|
12
12
|
async build(test, metadata) {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
const { _beforeEach, _afterEach, _afterAll, _beforeAll } = test.parent;
|
|
@@ -24,7 +24,7 @@ class ResultBuilder {
|
|
|
24
24
|
...this.reduceAfterOrBeforeSuites(_beforeAll),
|
|
25
25
|
];
|
|
26
26
|
let traces = typeof ((_e = test === null || test === void 0 ? void 0 : test.err) === null || _e === void 0 ? void 0 : _e.cliMessage) === "function" ? test.err.cliMessage() : (_f = test === null || test === void 0 ? void 0 : test.err) === null || _f === void 0 ? void 0 : _f.stack;
|
|
27
|
-
let message =
|
|
27
|
+
let message = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
28
28
|
// If TMS_IS_CI env is true, trim traces and message to 20 chars and log this
|
|
29
29
|
if (process.env.TMS_IS_CI === "true") {
|
|
30
30
|
if (typeof traces === "string" && traces.length > 20) {
|
|
@@ -37,17 +37,17 @@ class ResultBuilder {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
|
-
autoTestExternalId: (
|
|
40
|
+
autoTestExternalId: (_g = (0, utils_1.useDefaultHash)(test)) !== null && _g !== void 0 ? _g : (0, utils_1.useCompositeHash)(test),
|
|
41
41
|
links: metadata === null || metadata === void 0 ? void 0 : metadata.links,
|
|
42
42
|
startedOn: new Date(test.startedAt),
|
|
43
43
|
duration: test.duration,
|
|
44
44
|
attachments: await this.loadAttachments(test, metadata),
|
|
45
|
-
parameters,
|
|
45
|
+
parameters: Object.keys(parameters).length > 0 ? parameters : undefined,
|
|
46
46
|
traces: traces,
|
|
47
47
|
teardownResults,
|
|
48
48
|
setupResults,
|
|
49
49
|
completedOn: test.duration ? new Date(test.startedAt + test.duration) : undefined,
|
|
50
|
-
message
|
|
50
|
+
message,
|
|
51
51
|
outcome: test.state === "passed" ? "Passed" : "Failed",
|
|
52
52
|
stepResults: this.buildManySteps(test.steps),
|
|
53
53
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TestsBuilder = void 0;
|
|
4
4
|
const utils_1 = require("../common/utils");
|
|
5
|
+
const testit_js_commons_1 = require("testit-js-commons");
|
|
5
6
|
class TestsBuilder {
|
|
6
7
|
static build(test) {
|
|
7
8
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -15,6 +16,7 @@ class TestsBuilder {
|
|
|
15
16
|
title: config === null || config === void 0 ? void 0 : config.title,
|
|
16
17
|
name: (_a = config === null || config === void 0 ? void 0 : config.displayName) !== null && _a !== void 0 ? _a : test.title,
|
|
17
18
|
labels: ((_b = config === null || config === void 0 ? void 0 : config.labels) !== null && _b !== void 0 ? _b : []).map((label) => ({ name: label })),
|
|
19
|
+
layer: config === null || config === void 0 ? void 0 : config.layer,
|
|
18
20
|
tags: (_c = config === null || config === void 0 ? void 0 : config.tags) !== null && _c !== void 0 ? _c : [],
|
|
19
21
|
description: (_d = config === null || config === void 0 ? void 0 : config.description) !== null && _d !== void 0 ? _d : "",
|
|
20
22
|
steps: this.buildManySteps(test.steps),
|
|
@@ -24,6 +26,7 @@ class TestsBuilder {
|
|
|
24
26
|
externalId: (_f = (0, utils_1.useDefaultHash)(test)) !== null && _f !== void 0 ? _f : (0, utils_1.useCompositeHash)(test),
|
|
25
27
|
namespace: config === null || config === void 0 ? void 0 : config.nameSpace,
|
|
26
28
|
classname: config === null || config === void 0 ? void 0 : config.className,
|
|
29
|
+
workItemIds: resolveWorkItemIds(config),
|
|
27
30
|
externalKey: test.title,
|
|
28
31
|
};
|
|
29
32
|
}
|
|
@@ -38,3 +41,13 @@ class TestsBuilder {
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
exports.TestsBuilder = TestsBuilder;
|
|
44
|
+
function resolveWorkItemIds(config) {
|
|
45
|
+
var _a;
|
|
46
|
+
if ((_a = config === null || config === void 0 ? void 0 : config.workItemIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
47
|
+
testit_js_commons_1.logger.warn("workItemIds is deprecated. Use workItemId with a single globalId instead.");
|
|
48
|
+
}
|
|
49
|
+
if (config === null || config === void 0 ? void 0 : config.workItemId) {
|
|
50
|
+
return [config.workItemId];
|
|
51
|
+
}
|
|
52
|
+
return config === null || config === void 0 ? void 0 : config.workItemIds;
|
|
53
|
+
}
|
|
@@ -7,8 +7,13 @@ export declare namespace Origin {
|
|
|
7
7
|
externalId?: string;
|
|
8
8
|
links: Link[];
|
|
9
9
|
labels?: string[];
|
|
10
|
+
layer?: string;
|
|
10
11
|
tags?: string[];
|
|
11
|
-
|
|
12
|
+
workItemId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use workItemId with a single globalId instead.
|
|
15
|
+
*/
|
|
16
|
+
workItemIds?: string[];
|
|
12
17
|
classname?: string;
|
|
13
18
|
namespace?: string;
|
|
14
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testit-adapter-codecept",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Codecept adapter for Test IT",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"watch": "tsc -p tsconfig.json -w"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"testit-js-commons": "5.0
|
|
18
|
+
"testit-js-commons": "5.1.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@codeceptjs/configure": "^0.10.0",
|