testit-adapter-codecept 1.1.2 → 1.1.4
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 +180 -208
- package/build/bootstrap.d.ts +1 -1
- package/build/bootstrap.js +37 -34
- package/build/common/__tests/box.class.spec.d.ts +1 -1
- package/build/common/__tests/box.class.spec.js +15 -15
- package/build/common/__tests/test.utils.d.ts +4 -4
- package/build/common/__tests/test.utils.js +71 -71
- package/build/common/classes/box.class.d.ts +5 -5
- package/build/common/classes/box.class.js +18 -18
- package/build/common/classes/config.class.d.ts +6 -6
- package/build/common/classes/config.class.js +67 -67
- package/build/common/classes/logger.class.d.ts +9 -9
- package/build/common/classes/logger.class.js +28 -28
- package/build/common/classes/outcome.factory.d.ts +7 -7
- package/build/common/classes/outcome.factory.js +19 -19
- package/build/common/functions/compose.function.d.ts +1 -1
- package/build/common/functions/compose.function.js +5 -5
- package/build/common/functions/hash.function.d.ts +1 -1
- package/build/common/functions/hash.function.js +15 -15
- package/build/common/functions/humanize.function.d.ts +1 -1
- package/build/common/functions/humanize.function.js +7 -7
- package/build/common/functions/is-passed.function.d.ts +2 -2
- package/build/common/functions/is-passed.function.js +7 -7
- package/build/common/functions/to-iso-string.function.d.ts +1 -1
- package/build/common/functions/to-iso-string.function.js +10 -10
- package/build/common/functions/use-hash.function.d.ts +9 -9
- package/build/common/functions/use-hash.function.js +13 -13
- package/build/common/types/nullable.type.d.ts +1 -1
- package/build/common/types/nullable.type.js +2 -2
- package/build/helper.d.ts +9 -9
- package/build/helper.js +37 -37
- package/build/http/default-http-client.class.d.ts +22 -22
- package/build/http/default-http-client.class.js +123 -123
- package/build/http/http-client.errors.d.ts +7 -7
- package/build/http/http-client.errors.js +18 -18
- package/build/index.d.ts +2 -2
- package/build/index.js +18 -18
- package/build/jest.config.d.ts +7 -7
- package/build/jest.config.js +12 -12
- package/build/services/__tests/attachments.class.spec.d.ts +1 -1
- package/build/services/__tests/attachments.class.spec.js +23 -23
- package/build/services/__tests/runs.builder.spec.d.ts +1 -1
- package/build/services/__tests/runs.builder.spec.js +79 -79
- package/build/services/__tests/tests.builder.spec.d.ts +1 -1
- package/build/services/__tests/tests.builder.spec.js +32 -32
- package/build/services/attachments.service.d.ts +11 -11
- package/build/services/attachments.service.js +28 -28
- package/build/services/runs.builder.d.ts +10 -10
- package/build/services/runs.builder.js +65 -65
- package/build/services/tests.builder.d.ts +10 -10
- package/build/services/tests.builder.js +57 -55
- package/build/strategies/base-strategy.class.d.ts +24 -24
- package/build/strategies/base-strategy.class.js +66 -66
- package/build/strategies/default-strategy.class.d.ts +16 -16
- package/build/strategies/default-strategy.class.js +44 -44
- package/build/strategies/partial-startegy.class.d.ts +20 -20
- package/build/strategies/partial-startegy.class.js +72 -72
- package/build/strategies/scratch-strategy.class.d.ts +18 -18
- package/build/strategies/scratch-strategy.class.js +49 -49
- package/build/strategies/strategy.factory.d.ts +8 -8
- package/build/strategies/strategy.factory.js +21 -21
- package/build/types/codecept.type.d.ts +28 -27
- package/build/types/codecept.type.js +2 -2
- package/build/types/origin.type.d.ts +46 -46
- package/build/types/origin.type.js +2 -2
- package/build/types/strategy.type.d.ts +14 -10
- package/build/types/strategy.type.js +2 -2
- package/package.json +46 -46
- package/testit-adapter-codecept-1.1.2.tgz +0 -0
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const runs_builder_1 = require("../runs.builder");
|
|
4
|
-
const test_utils_1 = require("../../common/__tests/test.utils");
|
|
5
|
-
describe('Runs builder', () => {
|
|
6
|
-
const test = (0, test_utils_1.getDefaultTest)();
|
|
7
|
-
const config = (0, test_utils_1.getDefaultConfig)();
|
|
8
|
-
const attachments = [{ id: '96g6d4bg-20g0-25e8-b17e-a1a34a7adf2f' }];
|
|
9
|
-
const metadata = {
|
|
10
|
-
links: [{ title: 'Google', url: 'https://google.com', type: 'Related' }],
|
|
11
|
-
message: 'Error'
|
|
12
|
-
};
|
|
13
|
-
const builder = new runs_builder_1.RunsBuilder(config);
|
|
14
|
-
it('Should build test run', () => {
|
|
15
|
-
const run = builder.build(test, metadata, attachments);
|
|
16
|
-
expect(run)
|
|
17
|
-
.toEqual({
|
|
18
|
-
autotestExternalId: 5730363800838031,
|
|
19
|
-
completeOn: '1970-01-01T01:33:54.474Z',
|
|
20
|
-
configurationId: '1c33c90c-f34c-427b-81f6-1458f5g9c072',
|
|
21
|
-
duration: 240,
|
|
22
|
-
attachments: [
|
|
23
|
-
{
|
|
24
|
-
id: '96g6d4bg-20g0-25e8-b17e-a1a34a7adf2f'
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
links: [
|
|
28
|
-
{
|
|
29
|
-
title: 'Google',
|
|
30
|
-
url: 'https://google.com',
|
|
31
|
-
type: 'Related'
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
message: 'Error',
|
|
35
|
-
parameters: {},
|
|
36
|
-
outcome: 'Passed',
|
|
37
|
-
startedOn: '1970-01-01T01:33:54.234Z',
|
|
38
|
-
setupResults: [
|
|
39
|
-
{
|
|
40
|
-
completedOn: '1970-01-01T01:33:54.274Z',
|
|
41
|
-
description: '',
|
|
42
|
-
duration: 40,
|
|
43
|
-
outcome: 'Passed',
|
|
44
|
-
startedOn: '1970-01-01T01:33:54.234Z',
|
|
45
|
-
title: 'Step Before'
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
stepResults: [
|
|
49
|
-
{
|
|
50
|
-
completedOn: '1970-01-01T01:33:54.274Z',
|
|
51
|
-
description: '',
|
|
52
|
-
duration: 40,
|
|
53
|
-
outcome: 'Passed',
|
|
54
|
-
startedOn: '1970-01-01T01:33:54.234Z',
|
|
55
|
-
title: 'Step 1'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
completedOn: '1970-01-01T01:33:54.434Z',
|
|
59
|
-
description: '',
|
|
60
|
-
duration: 200,
|
|
61
|
-
outcome: 'Passed',
|
|
62
|
-
startedOn: '1970-01-01T01:33:54.234Z',
|
|
63
|
-
title: 'Step 2'
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
teardownResults: [
|
|
67
|
-
{
|
|
68
|
-
completedOn: '1970-01-01T01:33:54.274Z',
|
|
69
|
-
description: '',
|
|
70
|
-
duration: 40,
|
|
71
|
-
outcome: 'Passed',
|
|
72
|
-
startedOn: '1970-01-01T01:33:54.234Z',
|
|
73
|
-
title: 'Step After'
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
traces: ''
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const runs_builder_1 = require("../runs.builder");
|
|
4
|
+
const test_utils_1 = require("../../common/__tests/test.utils");
|
|
5
|
+
describe('Runs builder', () => {
|
|
6
|
+
const test = (0, test_utils_1.getDefaultTest)();
|
|
7
|
+
const config = (0, test_utils_1.getDefaultConfig)();
|
|
8
|
+
const attachments = [{ id: '96g6d4bg-20g0-25e8-b17e-a1a34a7adf2f' }];
|
|
9
|
+
const metadata = {
|
|
10
|
+
links: [{ title: 'Google', url: 'https://google.com', type: 'Related' }],
|
|
11
|
+
message: 'Error'
|
|
12
|
+
};
|
|
13
|
+
const builder = new runs_builder_1.RunsBuilder(config);
|
|
14
|
+
it('Should build test run', () => {
|
|
15
|
+
const run = builder.build(test, metadata, attachments);
|
|
16
|
+
expect(run)
|
|
17
|
+
.toEqual({
|
|
18
|
+
autotestExternalId: 5730363800838031,
|
|
19
|
+
completeOn: '1970-01-01T01:33:54.474Z',
|
|
20
|
+
configurationId: '1c33c90c-f34c-427b-81f6-1458f5g9c072',
|
|
21
|
+
duration: 240,
|
|
22
|
+
attachments: [
|
|
23
|
+
{
|
|
24
|
+
id: '96g6d4bg-20g0-25e8-b17e-a1a34a7adf2f'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
links: [
|
|
28
|
+
{
|
|
29
|
+
title: 'Google',
|
|
30
|
+
url: 'https://google.com',
|
|
31
|
+
type: 'Related'
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
message: 'Error',
|
|
35
|
+
parameters: {},
|
|
36
|
+
outcome: 'Passed',
|
|
37
|
+
startedOn: '1970-01-01T01:33:54.234Z',
|
|
38
|
+
setupResults: [
|
|
39
|
+
{
|
|
40
|
+
completedOn: '1970-01-01T01:33:54.274Z',
|
|
41
|
+
description: '',
|
|
42
|
+
duration: 40,
|
|
43
|
+
outcome: 'Passed',
|
|
44
|
+
startedOn: '1970-01-01T01:33:54.234Z',
|
|
45
|
+
title: 'Step Before'
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
stepResults: [
|
|
49
|
+
{
|
|
50
|
+
completedOn: '1970-01-01T01:33:54.274Z',
|
|
51
|
+
description: '',
|
|
52
|
+
duration: 40,
|
|
53
|
+
outcome: 'Passed',
|
|
54
|
+
startedOn: '1970-01-01T01:33:54.234Z',
|
|
55
|
+
title: 'Step 1'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
completedOn: '1970-01-01T01:33:54.434Z',
|
|
59
|
+
description: '',
|
|
60
|
+
duration: 200,
|
|
61
|
+
outcome: 'Passed',
|
|
62
|
+
startedOn: '1970-01-01T01:33:54.234Z',
|
|
63
|
+
title: 'Step 2'
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
teardownResults: [
|
|
67
|
+
{
|
|
68
|
+
completedOn: '1970-01-01T01:33:54.274Z',
|
|
69
|
+
description: '',
|
|
70
|
+
duration: 40,
|
|
71
|
+
outcome: 'Passed',
|
|
72
|
+
startedOn: '1970-01-01T01:33:54.234Z',
|
|
73
|
+
title: 'Step After'
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
traces: ''
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tests_builder_1 = require("../tests.builder");
|
|
4
|
-
const test_utils_1 = require("../../common/__tests/test.utils");
|
|
5
|
-
describe('Tests builder', () => {
|
|
6
|
-
const test = (0, test_utils_1.getDefaultTest)();
|
|
7
|
-
const config = (0, test_utils_1.getDefaultConfig)();
|
|
8
|
-
const builder = new tests_builder_1.TestsBuilder(config);
|
|
9
|
-
it('Should build test', () => {
|
|
10
|
-
const data = builder.build(test);
|
|
11
|
-
expect(data)
|
|
12
|
-
.toEqual({
|
|
13
|
-
title: 'Test',
|
|
14
|
-
description: '',
|
|
15
|
-
externalId: 5730363800838031,
|
|
16
|
-
labels: [],
|
|
17
|
-
links: [],
|
|
18
|
-
name: 'Test',
|
|
19
|
-
projectId: '96g6d4bg-20g0-25e8-b17e-a1a34a7adf2f',
|
|
20
|
-
setup: [
|
|
21
|
-
{ description: '', title: 'Step Before' }
|
|
22
|
-
],
|
|
23
|
-
steps: [
|
|
24
|
-
{ title: 'Step 1', description: "" },
|
|
25
|
-
{ title: 'Step 2', description: "" }
|
|
26
|
-
],
|
|
27
|
-
teardown: [
|
|
28
|
-
{ description: '', title: 'Step After' }
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tests_builder_1 = require("../tests.builder");
|
|
4
|
+
const test_utils_1 = require("../../common/__tests/test.utils");
|
|
5
|
+
describe('Tests builder', () => {
|
|
6
|
+
const test = (0, test_utils_1.getDefaultTest)();
|
|
7
|
+
const config = (0, test_utils_1.getDefaultConfig)();
|
|
8
|
+
const builder = new tests_builder_1.TestsBuilder(config);
|
|
9
|
+
it('Should build test', () => {
|
|
10
|
+
const data = builder.build(test);
|
|
11
|
+
expect(data)
|
|
12
|
+
.toEqual({
|
|
13
|
+
title: 'Test',
|
|
14
|
+
description: '',
|
|
15
|
+
externalId: 5730363800838031,
|
|
16
|
+
labels: [],
|
|
17
|
+
links: [],
|
|
18
|
+
name: 'Test',
|
|
19
|
+
projectId: '96g6d4bg-20g0-25e8-b17e-a1a34a7adf2f',
|
|
20
|
+
setup: [
|
|
21
|
+
{ description: '', title: 'Step Before' }
|
|
22
|
+
],
|
|
23
|
+
steps: [
|
|
24
|
+
{ title: 'Step 1', description: "" },
|
|
25
|
+
{ title: 'Step 2', description: "" }
|
|
26
|
+
],
|
|
27
|
+
teardown: [
|
|
28
|
+
{ description: '', title: 'Step After' }
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DefaultHttpClient } from '../http/default-http-client.class';
|
|
2
|
-
export declare class AttachmentsService {
|
|
3
|
-
private readonly http;
|
|
4
|
-
constructor(http: DefaultHttpClient);
|
|
5
|
-
attach(paths: string[]): Promise<{
|
|
6
|
-
id: string;
|
|
7
|
-
}[]>;
|
|
8
|
-
attachTextLikeFile(text: string, name?: string): Promise<{
|
|
9
|
-
id: string;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
1
|
+
import { DefaultHttpClient } from '../http/default-http-client.class';
|
|
2
|
+
export declare class AttachmentsService {
|
|
3
|
+
private readonly http;
|
|
4
|
+
constructor(http: DefaultHttpClient);
|
|
5
|
+
attach(paths: string[]): Promise<{
|
|
6
|
+
id: string;
|
|
7
|
+
}[]>;
|
|
8
|
+
attachTextLikeFile(text: string, name?: string): Promise<{
|
|
9
|
+
id: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AttachmentsService = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const hash_function_1 = require("../common/functions/hash.function");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
class AttachmentsService {
|
|
8
|
-
constructor(http) {
|
|
9
|
-
this.http = http;
|
|
10
|
-
}
|
|
11
|
-
async attach(paths) {
|
|
12
|
-
return Promise.all(paths
|
|
13
|
-
.map(path => this.http.loadAttachment(path)
|
|
14
|
-
.then(attachment => attachment && { id: attachment.id })));
|
|
15
|
-
}
|
|
16
|
-
async attachTextLikeFile(text, name) {
|
|
17
|
-
if (!name) {
|
|
18
|
-
name = (0, hash_function_1.hash)(text) + '-attachment.txt';
|
|
19
|
-
}
|
|
20
|
-
const attachmentPath = (0, path_1.join)(__dirname, name);
|
|
21
|
-
(0, fs_1.writeFileSync)(attachmentPath, text.toString(), {
|
|
22
|
-
flag: 'w',
|
|
23
|
-
});
|
|
24
|
-
return await this.http.loadAttachment(attachmentPath)
|
|
25
|
-
.then(attachment => attachment && { id: attachment.id });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.AttachmentsService = AttachmentsService;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachmentsService = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const hash_function_1 = require("../common/functions/hash.function");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
class AttachmentsService {
|
|
8
|
+
constructor(http) {
|
|
9
|
+
this.http = http;
|
|
10
|
+
}
|
|
11
|
+
async attach(paths) {
|
|
12
|
+
return Promise.all(paths
|
|
13
|
+
.map(path => this.http.loadAttachment(path)
|
|
14
|
+
.then(attachment => attachment && { id: attachment.id })));
|
|
15
|
+
}
|
|
16
|
+
async attachTextLikeFile(text, name) {
|
|
17
|
+
if (!name) {
|
|
18
|
+
name = (0, hash_function_1.hash)(text) + '-attachment.txt';
|
|
19
|
+
}
|
|
20
|
+
const attachmentPath = (0, path_1.join)(__dirname, name);
|
|
21
|
+
(0, fs_1.writeFileSync)(attachmentPath, text.toString(), {
|
|
22
|
+
flag: 'w',
|
|
23
|
+
});
|
|
24
|
+
return await this.http.loadAttachment(attachmentPath)
|
|
25
|
+
.then(attachment => attachment && { id: attachment.id });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.AttachmentsService = AttachmentsService;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AttachmentPut, AutotestResultsForTestRun } from 'testit-api-client';
|
|
2
|
-
import { Codecept } from '../types/codecept.type';
|
|
3
|
-
import { Origin } from '../types/origin.type';
|
|
4
|
-
export declare class RunsBuilder {
|
|
5
|
-
private readonly config;
|
|
6
|
-
constructor(config: Origin.Config);
|
|
7
|
-
build(test: Codecept.Test<Origin.TestConfig>, metadata: Origin.TestMetadata, attachments: AttachmentPut[]): AutotestResultsForTestRun;
|
|
8
|
-
private buildManySteps;
|
|
9
|
-
private reduceAfterOrBeforeSuites;
|
|
10
|
-
}
|
|
1
|
+
import { AttachmentPut, AutotestResultsForTestRun } from 'testit-api-client';
|
|
2
|
+
import { Codecept } from '../types/codecept.type';
|
|
3
|
+
import { Origin } from '../types/origin.type';
|
|
4
|
+
export declare class RunsBuilder {
|
|
5
|
+
private readonly config;
|
|
6
|
+
constructor(config: Origin.Config);
|
|
7
|
+
build(test: Codecept.Test<Origin.TestConfig>, metadata: Origin.TestMetadata, attachments: AttachmentPut[]): AutotestResultsForTestRun;
|
|
8
|
+
private buildManySteps;
|
|
9
|
+
private reduceAfterOrBeforeSuites;
|
|
10
|
+
}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RunsBuilder = void 0;
|
|
4
|
-
const outcome_factory_1 = require("../common/classes/outcome.factory");
|
|
5
|
-
const humanize_function_1 = require("../common/functions/humanize.function");
|
|
6
|
-
const to_iso_string_function_1 = require("../common/functions/to-iso-string.function");
|
|
7
|
-
const use_hash_function_1 = require("../common/functions/use-hash.function");
|
|
8
|
-
class RunsBuilder {
|
|
9
|
-
constructor(config) {
|
|
10
|
-
this.config = config;
|
|
11
|
-
}
|
|
12
|
-
build(test, metadata, attachments) {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
const { _beforeEach, _afterEach, _afterAll, _beforeAll } = test.parent;
|
|
16
|
-
const parameters = ((_b = (_a = test === null || test === void 0 ? void 0 : test.inject) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.toString)
|
|
17
|
-
? JSON.parse((_d = (_c = test === null || test === void 0 ? void 0 : test.inject) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.toString())
|
|
18
|
-
: {};
|
|
19
|
-
const teardownResults = [
|
|
20
|
-
...this.reduceAfterOrBeforeSuites(_afterEach),
|
|
21
|
-
...this.reduceAfterOrBeforeSuites(_afterAll)
|
|
22
|
-
];
|
|
23
|
-
const setupResults = [
|
|
24
|
-
...this.reduceAfterOrBeforeSuites(_beforeEach),
|
|
25
|
-
...this.reduceAfterOrBeforeSuites(_beforeAll)
|
|
26
|
-
];
|
|
27
|
-
return {
|
|
28
|
-
configurationId: this.config.configurationId,
|
|
29
|
-
autotestExternalId: (_e = (0, use_hash_function_1.useDefaultHash)(test)) !== null && _e !== void 0 ? _e : (0, use_hash_function_1.useCompositeHash)(test),
|
|
30
|
-
links: (_f = metadata === null || metadata === void 0 ? void 0 : metadata.links) !== null && _f !== void 0 ? _f : [],
|
|
31
|
-
startedOn: (0, to_iso_string_function_1.safetyUseISOString)(test.startedAt),
|
|
32
|
-
duration: test.duration,
|
|
33
|
-
attachments,
|
|
34
|
-
parameters,
|
|
35
|
-
traces:
|
|
36
|
-
teardownResults,
|
|
37
|
-
setupResults,
|
|
38
|
-
completedOn: (0, to_iso_string_function_1.safetyUseISOString)((test === null || test === void 0 ? void 0 : test.startedAt) + (test === null || test === void 0 ? void 0 : test.duration)),
|
|
39
|
-
message: (_j = metadata === null || metadata === void 0 ? void 0 : metadata.message) !== null && _j !== void 0 ? _j : null,
|
|
40
|
-
outcome: outcome_factory_1.OutcomeFactory.create(test.state),
|
|
41
|
-
stepResults: !outcome_factory_1.OutcomeFactory.isSkipped(test.state) ? this.buildManySteps(test.steps) : null
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
buildManySteps(steps) {
|
|
45
|
-
return steps === null || steps === void 0 ? void 0 : steps.map(step => ({
|
|
46
|
-
title: `${step.name} ${(0, humanize_function_1.humanize)(step.args).join(',')}`.trim(),
|
|
47
|
-
outcome: outcome_factory_1.OutcomeFactory.create(step.status),
|
|
48
|
-
description: '',
|
|
49
|
-
startedOn: (0, to_iso_string_function_1.safetyUseISOString)(step.startedAt),
|
|
50
|
-
duration: step.duration,
|
|
51
|
-
completedOn: (0, to_iso_string_function_1.safetyUseISOString)((step === null || step === void 0 ? void 0 : step.startedAt) + (step === null || step === void 0 ? void 0 : step.duration))
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
reduceAfterOrBeforeSuites(suite) {
|
|
55
|
-
return suite
|
|
56
|
-
.reduce((array, suite) => {
|
|
57
|
-
var _a;
|
|
58
|
-
return [
|
|
59
|
-
...array,
|
|
60
|
-
...this.buildManySteps((_a = suite === null || suite === void 0 ? void 0 : suite.steps) !== null && _a !== void 0 ? _a : [])
|
|
61
|
-
];
|
|
62
|
-
}, []);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.RunsBuilder = RunsBuilder;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunsBuilder = void 0;
|
|
4
|
+
const outcome_factory_1 = require("../common/classes/outcome.factory");
|
|
5
|
+
const humanize_function_1 = require("../common/functions/humanize.function");
|
|
6
|
+
const to_iso_string_function_1 = require("../common/functions/to-iso-string.function");
|
|
7
|
+
const use_hash_function_1 = require("../common/functions/use-hash.function");
|
|
8
|
+
class RunsBuilder {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
build(test, metadata, attachments) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
const { _beforeEach, _afterEach, _afterAll, _beforeAll } = test.parent;
|
|
16
|
+
const parameters = ((_b = (_a = test === null || test === void 0 ? void 0 : test.inject) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.toString)
|
|
17
|
+
? JSON.parse((_d = (_c = test === null || test === void 0 ? void 0 : test.inject) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.toString())
|
|
18
|
+
: {};
|
|
19
|
+
const teardownResults = [
|
|
20
|
+
...this.reduceAfterOrBeforeSuites(_afterEach),
|
|
21
|
+
...this.reduceAfterOrBeforeSuites(_afterAll)
|
|
22
|
+
];
|
|
23
|
+
const setupResults = [
|
|
24
|
+
...this.reduceAfterOrBeforeSuites(_beforeEach),
|
|
25
|
+
...this.reduceAfterOrBeforeSuites(_beforeAll)
|
|
26
|
+
];
|
|
27
|
+
return {
|
|
28
|
+
configurationId: this.config.configurationId,
|
|
29
|
+
autotestExternalId: (_e = (0, use_hash_function_1.useDefaultHash)(test)) !== null && _e !== void 0 ? _e : (0, use_hash_function_1.useCompositeHash)(test),
|
|
30
|
+
links: (_f = metadata === null || metadata === void 0 ? void 0 : metadata.links) !== null && _f !== void 0 ? _f : [],
|
|
31
|
+
startedOn: (0, to_iso_string_function_1.safetyUseISOString)(test.startedAt),
|
|
32
|
+
duration: test.duration,
|
|
33
|
+
attachments,
|
|
34
|
+
parameters,
|
|
35
|
+
traces: typeof ((_g = test === null || test === void 0 ? void 0 : test.err) === null || _g === void 0 ? void 0 : _g.cliMessage) === "function" ? test.err.cliMessage() : (_h = test === null || test === void 0 ? void 0 : test.err) === null || _h === void 0 ? void 0 : _h.stack,
|
|
36
|
+
teardownResults,
|
|
37
|
+
setupResults,
|
|
38
|
+
completedOn: (0, to_iso_string_function_1.safetyUseISOString)((test === null || test === void 0 ? void 0 : test.startedAt) + (test === null || test === void 0 ? void 0 : test.duration)),
|
|
39
|
+
message: (_j = metadata === null || metadata === void 0 ? void 0 : metadata.message) !== null && _j !== void 0 ? _j : null,
|
|
40
|
+
outcome: outcome_factory_1.OutcomeFactory.create(test.state),
|
|
41
|
+
stepResults: !outcome_factory_1.OutcomeFactory.isSkipped(test.state) ? this.buildManySteps(test.steps) : null
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
buildManySteps(steps) {
|
|
45
|
+
return steps === null || steps === void 0 ? void 0 : steps.map(step => ({
|
|
46
|
+
title: `${step.name} ${(0, humanize_function_1.humanize)(step.args).join(',')}`.trim(),
|
|
47
|
+
outcome: outcome_factory_1.OutcomeFactory.create(step.status),
|
|
48
|
+
description: '',
|
|
49
|
+
startedOn: (0, to_iso_string_function_1.safetyUseISOString)(step.startedAt),
|
|
50
|
+
duration: step.duration,
|
|
51
|
+
completedOn: (0, to_iso_string_function_1.safetyUseISOString)((step === null || step === void 0 ? void 0 : step.startedAt) + (step === null || step === void 0 ? void 0 : step.duration))
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
reduceAfterOrBeforeSuites(suite) {
|
|
55
|
+
return suite
|
|
56
|
+
.reduce((array, suite) => {
|
|
57
|
+
var _a;
|
|
58
|
+
return [
|
|
59
|
+
...array,
|
|
60
|
+
...this.buildManySteps((_a = suite === null || suite === void 0 ? void 0 : suite.steps) !== null && _a !== void 0 ? _a : [])
|
|
61
|
+
];
|
|
62
|
+
}, []);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.RunsBuilder = RunsBuilder;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AutotestPost } from 'testit-api-client';
|
|
2
|
-
import { Codecept } from '../types/codecept.type';
|
|
3
|
-
import { Origin } from '../types/origin.type';
|
|
4
|
-
export declare class TestsBuilder {
|
|
5
|
-
private readonly config;
|
|
6
|
-
constructor(config: Origin.Config);
|
|
7
|
-
build(test: Codecept.Test<Origin.TestConfig>): AutotestPost;
|
|
8
|
-
private buildManySteps;
|
|
9
|
-
private reduceAfterOrBeforeSuites;
|
|
10
|
-
}
|
|
1
|
+
import { AutotestPost } from 'testit-api-client';
|
|
2
|
+
import { Codecept } from '../types/codecept.type';
|
|
3
|
+
import { Origin } from '../types/origin.type';
|
|
4
|
+
export declare class TestsBuilder {
|
|
5
|
+
private readonly config;
|
|
6
|
+
constructor(config: Origin.Config);
|
|
7
|
+
build(test: Codecept.Test<Origin.TestConfig>): AutotestPost;
|
|
8
|
+
private buildManySteps;
|
|
9
|
+
private reduceAfterOrBeforeSuites;
|
|
10
|
+
}
|
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestsBuilder = void 0;
|
|
4
|
-
const humanize_function_1 = require("../common/functions/humanize.function");
|
|
5
|
-
const use_hash_function_1 = require("../common/functions/use-hash.function");
|
|
6
|
-
class TestsBuilder {
|
|
7
|
-
constructor(config) {
|
|
8
|
-
this.config = config;
|
|
9
|
-
}
|
|
10
|
-
build(test) {
|
|
11
|
-
var _a, _b, _c, _d, _e;
|
|
12
|
-
const config = (0, use_hash_function_1.useConfig)(test);
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
const { _beforeEach, _afterEach, _beforeAll, _afterAll } = test.parent;
|
|
16
|
-
const teardown = [
|
|
17
|
-
...this.reduceAfterOrBeforeSuites(_afterEach),
|
|
18
|
-
...this.reduceAfterOrBeforeSuites(_afterAll)
|
|
19
|
-
];
|
|
20
|
-
const setup = [
|
|
21
|
-
...this.reduceAfterOrBeforeSuites(_beforeEach),
|
|
22
|
-
...this.reduceAfterOrBeforeSuites(_beforeAll)
|
|
23
|
-
];
|
|
24
|
-
return {
|
|
25
|
-
title: config === null || config === void 0 ? void 0 : config.title,
|
|
26
|
-
name: (_a = config === null || config === void 0 ? void 0 : config.displayName) !== null && _a !== void 0 ? _a : test.title,
|
|
27
|
-
projectId: this.config.projectId,
|
|
28
|
-
labels: ((_b = config === null || config === void 0 ? void 0 : config.labels) !== null && _b !== void 0 ? _b : []).map(label => ({ name: label })),
|
|
29
|
-
description: (_c = config === null || config === void 0 ? void 0 : config.description) !== null && _c !== void 0 ? _c : '',
|
|
30
|
-
steps: this.buildManySteps(test.steps),
|
|
31
|
-
setup,
|
|
32
|
-
links: (_d = config === null || config === void 0 ? void 0 : config.links) !== null && _d !== void 0 ? _d : [],
|
|
33
|
-
teardown,
|
|
34
|
-
externalId: (_e = (0, use_hash_function_1.useDefaultHash)(test)) !== null && _e !== void 0 ? _e : (0, use_hash_function_1.useCompositeHash)(test)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestsBuilder = void 0;
|
|
4
|
+
const humanize_function_1 = require("../common/functions/humanize.function");
|
|
5
|
+
const use_hash_function_1 = require("../common/functions/use-hash.function");
|
|
6
|
+
class TestsBuilder {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
build(test) {
|
|
11
|
+
var _a, _b, _c, _d, _e;
|
|
12
|
+
const config = (0, use_hash_function_1.useConfig)(test);
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
const { _beforeEach, _afterEach, _beforeAll, _afterAll } = test.parent;
|
|
16
|
+
const teardown = [
|
|
17
|
+
...this.reduceAfterOrBeforeSuites(_afterEach),
|
|
18
|
+
...this.reduceAfterOrBeforeSuites(_afterAll)
|
|
19
|
+
];
|
|
20
|
+
const setup = [
|
|
21
|
+
...this.reduceAfterOrBeforeSuites(_beforeEach),
|
|
22
|
+
...this.reduceAfterOrBeforeSuites(_beforeAll)
|
|
23
|
+
];
|
|
24
|
+
return {
|
|
25
|
+
title: config === null || config === void 0 ? void 0 : config.title,
|
|
26
|
+
name: (_a = config === null || config === void 0 ? void 0 : config.displayName) !== null && _a !== void 0 ? _a : test.title,
|
|
27
|
+
projectId: this.config.projectId,
|
|
28
|
+
labels: ((_b = config === null || config === void 0 ? void 0 : config.labels) !== null && _b !== void 0 ? _b : []).map(label => ({ name: label })),
|
|
29
|
+
description: (_c = config === null || config === void 0 ? void 0 : config.description) !== null && _c !== void 0 ? _c : '',
|
|
30
|
+
steps: this.buildManySteps(test.steps),
|
|
31
|
+
setup,
|
|
32
|
+
links: (_d = config === null || config === void 0 ? void 0 : config.links) !== null && _d !== void 0 ? _d : [],
|
|
33
|
+
teardown,
|
|
34
|
+
externalId: (_e = (0, use_hash_function_1.useDefaultHash)(test)) !== null && _e !== void 0 ? _e : (0, use_hash_function_1.useCompositeHash)(test),
|
|
35
|
+
namespace: config === null || config === void 0 ? void 0 : config.nameSpace,
|
|
36
|
+
classname: config === null || config === void 0 ? void 0 : config.className
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
buildManySteps(steps = []) {
|
|
40
|
+
return steps
|
|
41
|
+
.map(step => ({
|
|
42
|
+
title: `${step.name} ${(0, humanize_function_1.humanize)(step.args).join(',')}`.trim(),
|
|
43
|
+
description: ''
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
reduceAfterOrBeforeSuites(suite) {
|
|
47
|
+
return suite
|
|
48
|
+
.reduce((array, suite) => {
|
|
49
|
+
var _a;
|
|
50
|
+
return [
|
|
51
|
+
...array,
|
|
52
|
+
...this.buildManySteps((_a = suite === null || suite === void 0 ? void 0 : suite.steps) !== null && _a !== void 0 ? _a : [])
|
|
53
|
+
];
|
|
54
|
+
}, []);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.TestsBuilder = TestsBuilder;
|