qase-javascript-commons 2.2.7 → 2.2.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/dist/config/config-loader.js +2 -0
- package/dist/formatter/json-formatter.js +1 -0
- package/dist/formatter/jsonp-formatter.js +1 -0
- package/dist/models/error.js +2 -0
- package/dist/models/step-execution.js +4 -0
- package/dist/models/test-execution.js +6 -0
- package/dist/models/test-result.js +15 -0
- package/dist/models/test-step.js +7 -0
- package/dist/qase.js +29 -10
- package/dist/reporters/abstract-reporter.js +10 -5
- package/dist/reporters/report-reporter.js +5 -1
- package/dist/reporters/testops-reporter.js +90 -39
- package/dist/state/state.js +1 -1
- package/dist/steps/step.js +3 -3
- package/dist/utils/logger.js +2 -0
- package/dist/utils/qase-error.js +4 -0
- package/dist/utils/validate-json.js +1 -0
- package/dist/writer/fs-writer.js +3 -0
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ const qase_error_1 = require("../utils/qase-error");
|
|
|
11
11
|
const validate_json_1 = require("../utils/validate-json");
|
|
12
12
|
const config_validation_schema_1 = require("./config-validation-schema");
|
|
13
13
|
class ConfigLoader {
|
|
14
|
+
paths;
|
|
15
|
+
validationSchema;
|
|
14
16
|
constructor(validationSchema, paths = ['qase.config.json', '.qaserc']) {
|
|
15
17
|
this.paths = paths;
|
|
16
18
|
this.validationSchema = (0, lodash_merge_1.default)({}, config_validation_schema_1.configValidationSchema, validationSchema);
|
package/dist/models/error.js
CHANGED
|
@@ -9,6 +9,10 @@ var StepStatusEnum;
|
|
|
9
9
|
StepStatusEnum["skipped"] = "skipped";
|
|
10
10
|
})(StepStatusEnum || (exports.StepStatusEnum = StepStatusEnum = {}));
|
|
11
11
|
class StepExecution {
|
|
12
|
+
start_time;
|
|
13
|
+
status;
|
|
14
|
+
end_time;
|
|
15
|
+
duration;
|
|
12
16
|
constructor() {
|
|
13
17
|
this.status = StepStatusEnum.passed;
|
|
14
18
|
this.start_time = null;
|
|
@@ -14,6 +14,12 @@ var TestStatusEnum;
|
|
|
14
14
|
TestStatusEnum["invalid"] = "invalid";
|
|
15
15
|
})(TestStatusEnum || (exports.TestStatusEnum = TestStatusEnum = {}));
|
|
16
16
|
class TestExecution {
|
|
17
|
+
start_time;
|
|
18
|
+
status;
|
|
19
|
+
end_time;
|
|
20
|
+
duration;
|
|
21
|
+
stacktrace;
|
|
22
|
+
thread;
|
|
17
23
|
constructor() {
|
|
18
24
|
this.status = TestStatusEnum.passed;
|
|
19
25
|
this.start_time = null;
|
|
@@ -3,6 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TestResultType = void 0;
|
|
4
4
|
const test_execution_1 = require("./test-execution");
|
|
5
5
|
class TestResultType {
|
|
6
|
+
id;
|
|
7
|
+
title;
|
|
8
|
+
signature;
|
|
9
|
+
run_id;
|
|
10
|
+
testops_id;
|
|
11
|
+
execution;
|
|
12
|
+
fields;
|
|
13
|
+
attachments;
|
|
14
|
+
steps;
|
|
15
|
+
params;
|
|
16
|
+
group_params;
|
|
17
|
+
author;
|
|
18
|
+
relations;
|
|
19
|
+
muted;
|
|
20
|
+
message;
|
|
6
21
|
constructor(title) {
|
|
7
22
|
this.id = '';
|
|
8
23
|
this.title = title;
|
package/dist/models/test-step.js
CHANGED
|
@@ -8,6 +8,13 @@ var StepType;
|
|
|
8
8
|
StepType["GHERKIN"] = "gherkin";
|
|
9
9
|
})(StepType || (exports.StepType = StepType = {}));
|
|
10
10
|
class TestStepType {
|
|
11
|
+
id;
|
|
12
|
+
step_type;
|
|
13
|
+
data;
|
|
14
|
+
parent_id;
|
|
15
|
+
execution;
|
|
16
|
+
attachments;
|
|
17
|
+
steps;
|
|
11
18
|
constructor(type = StepType.TEXT) {
|
|
12
19
|
this.id = '';
|
|
13
20
|
this.step_type = type;
|
package/dist/qase.js
CHANGED
|
@@ -34,6 +34,7 @@ const resultLogMap = {
|
|
|
34
34
|
* @implements AbstractReporter
|
|
35
35
|
*/
|
|
36
36
|
class QaseReporter {
|
|
37
|
+
static instance;
|
|
37
38
|
/**
|
|
38
39
|
* @param {string} frameworkPackage
|
|
39
40
|
* @param {string} frameworkName
|
|
@@ -66,20 +67,38 @@ class QaseReporter {
|
|
|
66
67
|
'X-Platform': `node=${nodeVersion}; npm=${npmVersion}; os=${os}; arch=${arch}`,
|
|
67
68
|
};
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @type {InternalReporterInterface}
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
upstreamReporter;
|
|
75
|
+
/**
|
|
76
|
+
* @type {InternalReporterInterface}
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
fallbackReporter;
|
|
80
|
+
/**
|
|
81
|
+
* @type {boolean | undefined}
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
captureLogs;
|
|
85
|
+
/**
|
|
86
|
+
* @type {boolean}
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
disabled = false;
|
|
90
|
+
/**
|
|
91
|
+
* @type {boolean}
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
useFallback = false;
|
|
95
|
+
logger;
|
|
96
|
+
startTestRunOperation;
|
|
97
|
+
options;
|
|
69
98
|
/**
|
|
70
99
|
* @param {OptionsType} options
|
|
71
100
|
*/
|
|
72
101
|
constructor(options) {
|
|
73
|
-
/**
|
|
74
|
-
* @type {boolean}
|
|
75
|
-
* @private
|
|
76
|
-
*/
|
|
77
|
-
this.disabled = false;
|
|
78
|
-
/**
|
|
79
|
-
* @type {boolean}
|
|
80
|
-
* @private
|
|
81
|
-
*/
|
|
82
|
-
this.useFallback = false;
|
|
83
102
|
if (state_1.StateManager.isStateExists()) {
|
|
84
103
|
const state = state_1.StateManager.getState();
|
|
85
104
|
if (state.IsModeChanged && state.Mode) {
|
|
@@ -8,16 +8,21 @@ const uuid_1 = require("uuid");
|
|
|
8
8
|
* @implements InternalReporterInterface
|
|
9
9
|
*/
|
|
10
10
|
class AbstractReporter {
|
|
11
|
+
/**
|
|
12
|
+
* @type {LoggerInterface}
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
logger;
|
|
16
|
+
/**
|
|
17
|
+
* @type {TestResultType[]}
|
|
18
|
+
* @protected
|
|
19
|
+
*/
|
|
20
|
+
results = [];
|
|
11
21
|
/**
|
|
12
22
|
* @protected
|
|
13
23
|
* @param {LoggerInterface} logger
|
|
14
24
|
*/
|
|
15
25
|
constructor(logger) {
|
|
16
|
-
/**
|
|
17
|
-
* @type {TestResultType[]}
|
|
18
|
-
* @protected
|
|
19
|
-
*/
|
|
20
|
-
this.results = [];
|
|
21
26
|
this.logger = logger;
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
@@ -34,6 +34,11 @@ const process = __importStar(require("process"));
|
|
|
34
34
|
* @extends AbstractReporter
|
|
35
35
|
*/
|
|
36
36
|
class ReportReporter extends abstract_reporter_1.AbstractReporter {
|
|
37
|
+
writer;
|
|
38
|
+
environment;
|
|
39
|
+
runId;
|
|
40
|
+
rootSuite;
|
|
41
|
+
startTime = Date.now();
|
|
37
42
|
/**
|
|
38
43
|
* @param {LoggerInterface} logger
|
|
39
44
|
* @param {WriterInterface} writer
|
|
@@ -44,7 +49,6 @@ class ReportReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
44
49
|
constructor(logger, writer, environment, rootSuite, runId) {
|
|
45
50
|
super(logger);
|
|
46
51
|
this.writer = writer;
|
|
47
|
-
this.startTime = Date.now();
|
|
48
52
|
this.environment = environment;
|
|
49
53
|
this.runId = runId;
|
|
50
54
|
this.rootSuite = rootSuite;
|
|
@@ -18,6 +18,96 @@ const defaultChunkSize = 200;
|
|
|
18
18
|
* @extends AbstractReporter
|
|
19
19
|
*/
|
|
20
20
|
class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
21
|
+
api;
|
|
22
|
+
/**
|
|
23
|
+
* @type {Record<TestStatusEnum, string>}
|
|
24
|
+
*/
|
|
25
|
+
static statusMap = {
|
|
26
|
+
[models_1.TestStatusEnum.passed]: 'passed',
|
|
27
|
+
[models_1.TestStatusEnum.failed]: 'failed',
|
|
28
|
+
[models_1.TestStatusEnum.skipped]: 'skipped',
|
|
29
|
+
[models_1.TestStatusEnum.disabled]: 'disabled',
|
|
30
|
+
[models_1.TestStatusEnum.blocked]: 'blocked',
|
|
31
|
+
[models_1.TestStatusEnum.invalid]: 'invalid',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @type {Record<StepStatusEnum, ResultStepStatus>}
|
|
35
|
+
*/
|
|
36
|
+
static stepStatusMap = {
|
|
37
|
+
[models_1.StepStatusEnum.passed]: qaseio_1.ResultStepStatus.PASSED,
|
|
38
|
+
[models_1.StepStatusEnum.failed]: qaseio_1.ResultStepStatus.FAILED,
|
|
39
|
+
[models_1.StepStatusEnum.blocked]: qaseio_1.ResultStepStatus.BLOCKED,
|
|
40
|
+
[models_1.StepStatusEnum.skipped]: qaseio_1.ResultStepStatus.SKIPPED,
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @type {Record<StepStatusEnum, ResultStepStatus>}
|
|
44
|
+
*/
|
|
45
|
+
static stepStatusMapV1 = {
|
|
46
|
+
[models_1.StepStatusEnum.passed]: qaseio_1.TestStepResultCreateStatusEnum.PASSED,
|
|
47
|
+
[models_1.StepStatusEnum.failed]: qaseio_1.TestStepResultCreateStatusEnum.FAILED,
|
|
48
|
+
[models_1.StepStatusEnum.blocked]: qaseio_1.TestStepResultCreateStatusEnum.BLOCKED,
|
|
49
|
+
[models_1.StepStatusEnum.skipped]: qaseio_1.TestStepResultCreateStatusEnum.BLOCKED,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
baseUrl;
|
|
56
|
+
/**
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
projectCode;
|
|
61
|
+
/**
|
|
62
|
+
* @type {boolean | undefined}
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
isUploadAttachments;
|
|
66
|
+
/**
|
|
67
|
+
* @type {TestOpsRunType}
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
run;
|
|
71
|
+
/**
|
|
72
|
+
* @type { string | undefined}
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
environment;
|
|
76
|
+
/**
|
|
77
|
+
* @type { number | undefined}
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
planId;
|
|
81
|
+
/**
|
|
82
|
+
* @type {TestResultType[]}
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
batchSize;
|
|
86
|
+
/**
|
|
87
|
+
* @type {boolean | undefined}
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
useV2;
|
|
91
|
+
/**
|
|
92
|
+
* @type {boolean | undefined}
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
defect;
|
|
96
|
+
/**
|
|
97
|
+
* @type {string | undefined}
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
rootSuite;
|
|
101
|
+
/**
|
|
102
|
+
* @type {number}
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
firstIndex = 0;
|
|
106
|
+
/**
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
isTestRunReady = false;
|
|
21
111
|
/**
|
|
22
112
|
* @param {LoggerInterface} logger
|
|
23
113
|
* @param {ReporterOptionsType & TestOpsOptionsType} options
|
|
@@ -30,16 +120,6 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
30
120
|
const { project, uploadAttachments, run, plan, } = options;
|
|
31
121
|
super(logger);
|
|
32
122
|
this.api = api;
|
|
33
|
-
/**
|
|
34
|
-
* @type {number}
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
this.firstIndex = 0;
|
|
38
|
-
/**
|
|
39
|
-
* @type {boolean}
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
this.isTestRunReady = false;
|
|
43
123
|
this.baseUrl = this.getBaseUrl(baseUrl);
|
|
44
124
|
this.projectCode = project;
|
|
45
125
|
this.isUploadAttachments = uploadAttachments;
|
|
@@ -584,32 +664,3 @@ class TestOpsReporter extends abstract_reporter_1.AbstractReporter {
|
|
|
584
664
|
}
|
|
585
665
|
}
|
|
586
666
|
exports.TestOpsReporter = TestOpsReporter;
|
|
587
|
-
/**
|
|
588
|
-
* @type {Record<TestStatusEnum, string>}
|
|
589
|
-
*/
|
|
590
|
-
TestOpsReporter.statusMap = {
|
|
591
|
-
[models_1.TestStatusEnum.passed]: 'passed',
|
|
592
|
-
[models_1.TestStatusEnum.failed]: 'failed',
|
|
593
|
-
[models_1.TestStatusEnum.skipped]: 'skipped',
|
|
594
|
-
[models_1.TestStatusEnum.disabled]: 'disabled',
|
|
595
|
-
[models_1.TestStatusEnum.blocked]: 'blocked',
|
|
596
|
-
[models_1.TestStatusEnum.invalid]: 'invalid',
|
|
597
|
-
};
|
|
598
|
-
/**
|
|
599
|
-
* @type {Record<StepStatusEnum, ResultStepStatus>}
|
|
600
|
-
*/
|
|
601
|
-
TestOpsReporter.stepStatusMap = {
|
|
602
|
-
[models_1.StepStatusEnum.passed]: qaseio_1.ResultStepStatus.PASSED,
|
|
603
|
-
[models_1.StepStatusEnum.failed]: qaseio_1.ResultStepStatus.FAILED,
|
|
604
|
-
[models_1.StepStatusEnum.blocked]: qaseio_1.ResultStepStatus.BLOCKED,
|
|
605
|
-
[models_1.StepStatusEnum.skipped]: qaseio_1.ResultStepStatus.SKIPPED,
|
|
606
|
-
};
|
|
607
|
-
/**
|
|
608
|
-
* @type {Record<StepStatusEnum, ResultStepStatus>}
|
|
609
|
-
*/
|
|
610
|
-
TestOpsReporter.stepStatusMapV1 = {
|
|
611
|
-
[models_1.StepStatusEnum.passed]: qaseio_1.TestStepResultCreateStatusEnum.PASSED,
|
|
612
|
-
[models_1.StepStatusEnum.failed]: qaseio_1.TestStepResultCreateStatusEnum.FAILED,
|
|
613
|
-
[models_1.StepStatusEnum.blocked]: qaseio_1.TestStepResultCreateStatusEnum.BLOCKED,
|
|
614
|
-
[models_1.StepStatusEnum.skipped]: qaseio_1.TestStepResultCreateStatusEnum.BLOCKED,
|
|
615
|
-
};
|
package/dist/state/state.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.StateManager = void 0;
|
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
class StateManager {
|
|
10
|
+
static statePath = path_1.default.resolve(__dirname, 'reporterState.json');
|
|
10
11
|
static getState() {
|
|
11
12
|
let state = {
|
|
12
13
|
RunId: undefined,
|
|
@@ -60,4 +61,3 @@ class StateManager {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
exports.StateManager = StateManager;
|
|
63
|
-
StateManager.statePath = path_1.default.resolve(__dirname, 'reporterState.json');
|
package/dist/steps/step.js
CHANGED
|
@@ -8,10 +8,10 @@ const uuid_1 = require("uuid");
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const models_1 = require("../models");
|
|
10
10
|
class QaseStep {
|
|
11
|
+
name = '';
|
|
12
|
+
attachments = [];
|
|
13
|
+
steps = [];
|
|
11
14
|
constructor(name) {
|
|
12
|
-
this.name = '';
|
|
13
|
-
this.attachments = [];
|
|
14
|
-
this.steps = [];
|
|
15
15
|
this.name = name;
|
|
16
16
|
}
|
|
17
17
|
attach(attach) {
|
package/dist/utils/logger.js
CHANGED
|
@@ -33,6 +33,8 @@ const is_axios_error_1 = require("./is-axios-error");
|
|
|
33
33
|
const qase_error_1 = require("./qase-error");
|
|
34
34
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
35
35
|
class Logger {
|
|
36
|
+
debug;
|
|
37
|
+
filePath;
|
|
36
38
|
constructor(options) {
|
|
37
39
|
this.debug = options.debug;
|
|
38
40
|
const dir = options.dir ?? './logs';
|
package/dist/utils/qase-error.js
CHANGED
package/dist/writer/fs-writer.js
CHANGED