testit-js-commons 5.0.3 → 5.0.5
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/lib/adapters-api/dist/ApiClient.js +6 -5
- package/lib/adapters-api/dist/api/AttachmentsApi.js +5 -5
- package/lib/adapters-api/dist/api/AutoTestsApi.js +11 -11
- package/lib/adapters-api/dist/api/ConfigurationsApi.js +1 -1
- package/lib/adapters-api/dist/api/ParametersApi.js +3 -3
- package/lib/adapters-api/dist/api/ProjectAttributesApi.js +6 -6
- package/lib/adapters-api/dist/api/ProjectSectionsApi.js +1 -1
- package/lib/adapters-api/dist/api/ProjectWorkItemsApi.js +1 -1
- package/lib/adapters-api/dist/api/ProjectsApi.js +4 -4
- package/lib/adapters-api/dist/api/SectionsApi.js +2 -2
- package/lib/adapters-api/dist/api/TestResultsApi.js +3 -3
- package/lib/adapters-api/dist/api/TestRunsApi.js +8 -8
- package/lib/adapters-api/dist/api/WorkItemsApi.js +3 -3
- package/lib/adapters-api/dist/api/WorkflowsApi.js +1 -1
- package/lib/adapters-api/dist/index.js +3 -3
- package/lib/adapters-api/dist/model/AttachmentPutModelAutoTestStepResultsModel.js +1 -1
- package/lib/adapters-api/dist/model/AutoTestStepResult.js +1 -1
- package/lib/adapters-api/dist/model/AutoTestStepResultUpdateRequest.js +1 -1
- package/lib/adapters-api/dist/model/CreateEmptyTestRunApiModel.js +2 -2
- package/lib/adapters-api/dist/model/CustomAttributeApiResult.js +2 -2
- package/lib/adapters-api/dist/model/{CustomAttributeGetModel.js → CustomAttributeModel.js} +89 -39
- package/lib/adapters-api/dist/model/CustomAttributePutModel.js +1 -1
- package/lib/adapters-api/dist/model/LabelApiModel.js +4 -15
- package/lib/adapters-api/dist/model/TestResultResponse.js +18 -4
- package/lib/adapters-api/dist/model/UpdateEmptyTestRunApiModel.js +1 -1
- package/lib/adapters-api/index.d.ts +40 -196
- package/lib/common/utils/tms-load-test-run-debug.d.ts +2 -0
- package/lib/common/utils/tms-load-test-run-debug.js +6 -0
- package/lib/services/syncstorage/syncstorage.runner.js +6 -5
- package/lib/services/syncstorage/syncstorage.runner.test.js +16 -0
- package/lib/services/testruns/testruns.converter.d.ts +3 -0
- package/lib/services/testruns/testruns.converter.js +12 -0
- package/lib/services/testruns/testruns.converter.test.d.ts +1 -0
- package/lib/services/testruns/testruns.converter.test.js +30 -0
- package/lib/services/testruns/testruns.handler.d.ts +2 -2
- package/lib/services/testruns/testruns.handler.js +12 -2
- package/lib/services/testruns/testruns.service.d.ts +5 -2
- package/lib/services/testruns/testruns.service.js +80 -33
- package/lib/services/testruns/testruns.service.test.d.ts +1 -0
- package/lib/services/testruns/testruns.service.test.js +83 -0
- package/lib/services/testruns/testruns.type.d.ts +2 -0
- package/lib/strategy/base.strategy.d.ts +1 -0
- package/lib/strategy/base.strategy.js +5 -0
- package/lib/strategy/strategy.type.d.ts +1 -0
- package/lib/sync-storage/dist/ApiClient.js +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare class TestRunErrorHandler {
|
|
2
|
-
static handleErrorStartTestRun(err:
|
|
3
|
-
static handleErrorCompletedTestRun(err:
|
|
2
|
+
static handleErrorStartTestRun(err: unknown, message?: string): void;
|
|
3
|
+
static handleErrorCompletedTestRun(err: unknown, message?: string): void;
|
|
4
4
|
}
|
|
@@ -4,13 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TestRunErrorHandler = void 0;
|
|
7
|
+
const utils_1 = require("../../common/utils");
|
|
7
8
|
const logger_1 = __importDefault(require("../../logger"));
|
|
9
|
+
function logTestRunHttpError(action, err, message = "") {
|
|
10
|
+
var _a;
|
|
11
|
+
const e = (0, utils_1.unwrapHttpError)(err);
|
|
12
|
+
const status = e ? (0, utils_1.getHttpStatus)(e) : undefined;
|
|
13
|
+
const code = e ? (0, utils_1.getNetworkErrorCode)(e) : undefined;
|
|
14
|
+
const body = (_a = err === null || err === void 0 ? void 0 : err.body) !== null && _a !== void 0 ? _a : e === null || e === void 0 ? void 0 : e.body;
|
|
15
|
+
const detail = message || (err instanceof Error ? err.message : String(err));
|
|
16
|
+
logger_1.default.error(`Failed ${action}. Message: ${detail}. status=${status !== null && status !== void 0 ? status : "n/a"} code=${code !== null && code !== void 0 ? code : "n/a"}`, body !== null && body !== void 0 ? body : err);
|
|
17
|
+
}
|
|
8
18
|
class TestRunErrorHandler {
|
|
9
19
|
static handleErrorStartTestRun(err, message = "") {
|
|
10
|
-
|
|
20
|
+
logTestRunHttpError("start test run in system", err, message);
|
|
11
21
|
}
|
|
12
22
|
static handleErrorCompletedTestRun(err, message = "") {
|
|
13
|
-
|
|
23
|
+
logTestRunHttpError("complete test run in system", err, message);
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
exports.TestRunErrorHandler = TestRunErrorHandler;
|
|
@@ -6,7 +6,9 @@ export declare class TestRunsService extends BaseService implements ITestRunsSer
|
|
|
6
6
|
protected _client: any;
|
|
7
7
|
protected _converter: ITestRunConverter;
|
|
8
8
|
private readonly _testResults;
|
|
9
|
-
/**
|
|
9
|
+
/** Finalized via POST setAutoTestResults in this process (skip duplicate bulk send). */
|
|
10
|
+
private readonly finalizedExternalIds;
|
|
11
|
+
/** testResultId by autoTestExternalId within current run (InProgress POST + final POST). */
|
|
10
12
|
private readonly testResultIdsByExternalId;
|
|
11
13
|
constructor(config: AdapterConfig);
|
|
12
14
|
createTestRun(): Promise<TestRunId>;
|
|
@@ -16,8 +18,9 @@ export declare class TestRunsService extends BaseService implements ITestRunsSer
|
|
|
16
18
|
completeTestRun(testRunId: TestRunId): Promise<void>;
|
|
17
19
|
postInProgressAutotestResult(testRunId: string, result: AutotestResult): Promise<void>;
|
|
18
20
|
loadAutotests(testRunId: string, results: Array<AutotestResult>): Promise<void>;
|
|
21
|
+
updateSetupTeardown(results: Array<AutotestResult>): Promise<void>;
|
|
19
22
|
private resolveExistingTestResultId;
|
|
20
23
|
private rememberCreatedTestResultId;
|
|
21
24
|
private sendAutotestResultWithRetry;
|
|
22
|
-
private
|
|
25
|
+
private updateSetupTeardownWithRetry;
|
|
23
26
|
}
|
|
@@ -25,7 +25,9 @@ class TestRunsService extends common_1.BaseService {
|
|
|
25
25
|
constructor(config) {
|
|
26
26
|
super(config);
|
|
27
27
|
this.config = config;
|
|
28
|
-
/**
|
|
28
|
+
/** Finalized via POST setAutoTestResults in this process (skip duplicate bulk send). */
|
|
29
|
+
this.finalizedExternalIds = new Set();
|
|
30
|
+
/** testResultId by autoTestExternalId within current run (InProgress POST + final POST). */
|
|
29
31
|
this.testResultIdsByExternalId = new Map();
|
|
30
32
|
this._client = new AdaptersApi.TestRunsApi(AdaptersApi.ApiClient.instance);
|
|
31
33
|
this._converter = new testruns_converter_1.TestRunConverter(config);
|
|
@@ -71,15 +73,12 @@ class TestRunsService extends common_1.BaseService {
|
|
|
71
73
|
}
|
|
72
74
|
getTestRun(testRunId) {
|
|
73
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
return yield this
|
|
75
|
-
.adaptersTestRunsIdGet(testRunId)
|
|
76
|
+
return yield (0, utils_1.withHttpRetry)(() => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const response = yield this._client.adaptersTestRunsIdGet(testRunId);
|
|
76
78
|
// @ts-ignore
|
|
77
|
-
.then((response) => {
|
|
78
79
|
const data = (response === null || response === void 0 ? void 0 : response.body) || response;
|
|
79
|
-
return data;
|
|
80
|
-
})
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
.then((run) => this._converter.toLocalTestRun(run));
|
|
80
|
+
return this._converter.toLocalTestRun(data);
|
|
81
|
+
}), { label: `getTestRun:${testRunId}` });
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
84
|
updateTestRun(testRun) {
|
|
@@ -121,8 +120,24 @@ class TestRunsService extends common_1.BaseService {
|
|
|
121
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
121
|
try {
|
|
123
122
|
const testRun = yield this.getTestRun(testRunId);
|
|
124
|
-
if (testRun.stateName
|
|
125
|
-
|
|
123
|
+
if (testRun.stateName !== "NotStarted") {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
yield (0, utils_1.withHttpRetry)(() => this._client.adaptersTestRunsIdStartPost(testRunId), {
|
|
128
|
+
label: `startTestRun:${testRunId}`,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
const refreshed = yield this.getTestRun(testRunId);
|
|
133
|
+
if (refreshed.stateName !== "NotStarted") {
|
|
134
|
+
logger_1.default.debug("[testruns] startTestRun skipped: run already started", {
|
|
135
|
+
testRunId,
|
|
136
|
+
stateName: refreshed.stateName,
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
throw err;
|
|
126
141
|
}
|
|
127
142
|
}
|
|
128
143
|
catch (err) {
|
|
@@ -162,26 +177,13 @@ class TestRunsService extends common_1.BaseService {
|
|
|
162
177
|
}
|
|
163
178
|
loadAutotests(testRunId, results) {
|
|
164
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
var _a, _b
|
|
180
|
+
var _a, _b;
|
|
166
181
|
for (const result of results) {
|
|
167
182
|
const externalId = result.autoTestExternalId;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
(0, utils_1.logTmsLoadTestRun)("PUT updateTestResult (final)", {
|
|
183
|
+
if (this.finalizedExternalIds.has(externalId)) {
|
|
184
|
+
(0, utils_1.logTmsLoadTestRun)("Bulk import: skip sendTestResults (already finalized)", {
|
|
171
185
|
testRunId,
|
|
172
186
|
autoTestExternalId: externalId,
|
|
173
|
-
testResultId: existingId,
|
|
174
|
-
stepCount: (_b = (_a = result.stepResults) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
|
|
175
|
-
});
|
|
176
|
-
yield this.updateAutotestResultWithRetry(existingId, result).catch((err) => {
|
|
177
|
-
var _a, _b;
|
|
178
|
-
const normalized = (_b = (_a = err === null || err === void 0 ? void 0 : err.body) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.error) !== null && _b !== void 0 ? _b : err;
|
|
179
|
-
logger_1.default.error("[testit-js-commons:loadTestRun] FAILED to update final result", {
|
|
180
|
-
testRunId,
|
|
181
|
-
autoTestExternalId: externalId,
|
|
182
|
-
testResultId: existingId,
|
|
183
|
-
error: normalized,
|
|
184
|
-
});
|
|
185
187
|
});
|
|
186
188
|
continue;
|
|
187
189
|
}
|
|
@@ -192,9 +194,18 @@ class TestRunsService extends common_1.BaseService {
|
|
|
192
194
|
autoTestExternalId: autotestResult.autoTestExternalId,
|
|
193
195
|
statusType: autotestResult.statusType,
|
|
194
196
|
statusCode: autotestResult.statusCode,
|
|
195
|
-
stepCount: (
|
|
197
|
+
stepCount: (_b = (_a = autotestResult.stepResults) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
|
|
196
198
|
});
|
|
197
|
-
yield this.sendAutotestResultWithRetry(testRunId, autotestResult)
|
|
199
|
+
yield this.sendAutotestResultWithRetry(testRunId, autotestResult)
|
|
200
|
+
.then(() => {
|
|
201
|
+
this.finalizedExternalIds.add(externalId);
|
|
202
|
+
(0, utils_1.logTmsLoadTestRun)("Finalized test result via sendTestResults", {
|
|
203
|
+
testRunId,
|
|
204
|
+
autoTestExternalId: externalId,
|
|
205
|
+
testResultId: this.testResultIdsByExternalId.get(externalId),
|
|
206
|
+
});
|
|
207
|
+
})
|
|
208
|
+
.catch((err) => {
|
|
198
209
|
var _a, _b;
|
|
199
210
|
const normalized = (_b = (_a = err === null || err === void 0 ? void 0 : err.body) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.error) !== null && _b !== void 0 ? _b : err;
|
|
200
211
|
logger_1.default.error("[testit-js-commons:loadTestRun] FAILED to post final result", {
|
|
@@ -206,6 +217,44 @@ class TestRunsService extends common_1.BaseService {
|
|
|
206
217
|
}
|
|
207
218
|
});
|
|
208
219
|
}
|
|
220
|
+
updateSetupTeardown(results) {
|
|
221
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
223
|
+
for (const result of results) {
|
|
224
|
+
const hasSetup = Boolean((_a = result.setupResults) === null || _a === void 0 ? void 0 : _a.length);
|
|
225
|
+
const hasTeardown = Boolean((_b = result.teardownResults) === null || _b === void 0 ? void 0 : _b.length);
|
|
226
|
+
if (!hasSetup && !hasTeardown) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const testResultId = yield this.resolveExistingTestResultId(result.autoTestExternalId);
|
|
230
|
+
if (!testResultId) {
|
|
231
|
+
logger_1.default.warn("[testruns] skip setup/teardown PUT: test result id not found", {
|
|
232
|
+
autoTestExternalId: result.autoTestExternalId,
|
|
233
|
+
});
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
const model = this._converter.toOriginSetupTeardownUpdate(result);
|
|
237
|
+
if (!((_c = model.setupResults) === null || _c === void 0 ? void 0 : _c.length) && !((_d = model.teardownResults) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
(0, utils_1.escapeHtmlInObject)(model);
|
|
241
|
+
(0, utils_1.logTmsLoadTestRun)("PUT updateTestResult (setup/teardown only)", {
|
|
242
|
+
autoTestExternalId: result.autoTestExternalId,
|
|
243
|
+
testResultId,
|
|
244
|
+
setupCount: (_f = (_e = model.setupResults) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0,
|
|
245
|
+
teardownCount: (_h = (_g = model.teardownResults) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0,
|
|
246
|
+
});
|
|
247
|
+
yield this.updateSetupTeardownWithRetry(testResultId, result, model).catch((err) => {
|
|
248
|
+
var _a;
|
|
249
|
+
logger_1.default.error("[testit-js-commons:loadTestRun] FAILED to update setup/teardown", {
|
|
250
|
+
autoTestExternalId: result.autoTestExternalId,
|
|
251
|
+
testResultId,
|
|
252
|
+
error: (_a = err === null || err === void 0 ? void 0 : err.body) !== null && _a !== void 0 ? _a : err,
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
209
258
|
resolveExistingTestResultId(externalId) {
|
|
210
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
211
260
|
const cached = this.testResultIdsByExternalId.get(externalId);
|
|
@@ -247,12 +296,10 @@ class TestRunsService extends common_1.BaseService {
|
|
|
247
296
|
});
|
|
248
297
|
});
|
|
249
298
|
}
|
|
250
|
-
|
|
299
|
+
updateSetupTeardownWithRetry(testResultId, result, model) {
|
|
251
300
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
|
|
253
|
-
(
|
|
254
|
-
yield (0, utils_1.withHttpRetry)(() => this._testResults.updateTestResult(testResultId, model), { label: `updateTestResult:${result.autoTestExternalId}` });
|
|
255
|
-
logger_1.default.debug("[testruns] updateTestResult ok", {
|
|
301
|
+
yield (0, utils_1.withHttpRetry)(() => this._testResults.updateTestResult(testResultId, model), { label: `updateSetupTeardown:${result.autoTestExternalId}` });
|
|
302
|
+
logger_1.default.debug("[testruns] updateSetupTeardown ok", {
|
|
256
303
|
testResultId,
|
|
257
304
|
autoTestExternalId: result.autoTestExternalId,
|
|
258
305
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const testruns_service_1 = require("./testruns.service");
|
|
13
|
+
jest.mock("../../adapters-api/dist/index", () => ({
|
|
14
|
+
ApiClient: {
|
|
15
|
+
instance: {
|
|
16
|
+
basePath: "",
|
|
17
|
+
authentications: {
|
|
18
|
+
PrivateToken: { apiKeyPrefix: "", apiKey: "" },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
TestRunsApi: jest.fn().mockImplementation(() => ({
|
|
23
|
+
adaptersTestRunsIdTestResultsPost: jest.fn().mockResolvedValue(["result-id-1"]),
|
|
24
|
+
})),
|
|
25
|
+
}));
|
|
26
|
+
jest.mock("../testresults/testresults.service", () => ({
|
|
27
|
+
TestResultsService: jest.fn().mockImplementation(() => ({
|
|
28
|
+
findTestResultIdByExternalId: jest.fn().mockResolvedValue("existing-inprogress-id"),
|
|
29
|
+
updateTestResult: jest.fn().mockResolvedValue(undefined),
|
|
30
|
+
})),
|
|
31
|
+
}));
|
|
32
|
+
function makeConfig() {
|
|
33
|
+
return {
|
|
34
|
+
url: "http://localhost:8080",
|
|
35
|
+
privateToken: "token",
|
|
36
|
+
projectId: "11111111-1111-1111-1111-111111111111",
|
|
37
|
+
configurationId: "22222222-2222-2222-2222-222222222222",
|
|
38
|
+
testRunId: "33333333-3333-3333-3333-333333333333",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function makeResult(overrides = {}) {
|
|
42
|
+
return Object.assign({ autoTestExternalId: "ext-1", outcome: "Passed", stepResults: [{ title: "step-1" }] }, overrides);
|
|
43
|
+
}
|
|
44
|
+
describe("TestRunsService.loadAutotests", () => {
|
|
45
|
+
it("always POST final result even when in-progress id exists in cache", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const service = new testruns_service_1.TestRunsService(makeConfig());
|
|
47
|
+
const internal = service;
|
|
48
|
+
internal.testResultIdsByExternalId.set("ext-1", "existing-inprogress-id");
|
|
49
|
+
yield service.loadAutotests("run-1", [makeResult()]);
|
|
50
|
+
expect(internal._client.adaptersTestRunsIdTestResultsPost).toHaveBeenCalledTimes(1);
|
|
51
|
+
expect(internal._testResults.updateTestResult).not.toHaveBeenCalled();
|
|
52
|
+
expect(internal.finalizedExternalIds.has("ext-1")).toBe(true);
|
|
53
|
+
}));
|
|
54
|
+
it("skips duplicate POST for already finalized externalId", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const service = new testruns_service_1.TestRunsService(makeConfig());
|
|
56
|
+
const internal = service;
|
|
57
|
+
internal.finalizedExternalIds.add("ext-1");
|
|
58
|
+
yield service.loadAutotests("run-1", [makeResult()]);
|
|
59
|
+
expect(internal._client.adaptersTestRunsIdTestResultsPost).not.toHaveBeenCalled();
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
describe("TestRunsService.updateSetupTeardown", () => {
|
|
63
|
+
it("PUT only setup/teardown fields", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
const service = new testruns_service_1.TestRunsService(makeConfig());
|
|
65
|
+
const internal = service;
|
|
66
|
+
internal.testResultIdsByExternalId.set("ext-1", "result-id-1");
|
|
67
|
+
yield service.updateSetupTeardown([
|
|
68
|
+
makeResult({
|
|
69
|
+
setupResults: [{ title: "beforeAll" }],
|
|
70
|
+
teardownResults: [{ title: "afterAll" }],
|
|
71
|
+
stepResults: [{ title: "must-not-put" }],
|
|
72
|
+
}),
|
|
73
|
+
]);
|
|
74
|
+
expect(internal._testResults.updateTestResult).toHaveBeenCalledWith("result-id-1", expect.objectContaining({
|
|
75
|
+
setupResults: expect.any(Array),
|
|
76
|
+
teardownResults: expect.any(Array),
|
|
77
|
+
}));
|
|
78
|
+
const putBody = internal._testResults.updateTestResult.mock.calls[0][1];
|
|
79
|
+
expect(putBody.stepResults).toBeUndefined();
|
|
80
|
+
expect(putBody.outcome).toBeUndefined();
|
|
81
|
+
expect(putBody.statusType).toBeUndefined();
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
@@ -63,5 +63,7 @@ export interface ITestRunsService {
|
|
|
63
63
|
/** First TMS write as InProgress (mirrors Python realtime in-progress before final load). */
|
|
64
64
|
postInProgressAutotestResult(testRunId: string, result: AutotestResult): Promise<void>;
|
|
65
65
|
loadAutotests(testRunId: string, autotests: Array<AutotestResult>): Promise<void>;
|
|
66
|
+
/** PUT setup/teardown fixture steps onto an already finalized result (importRealtime session end). */
|
|
67
|
+
updateSetupTeardown(results: Array<AutotestResult>): Promise<void>;
|
|
66
68
|
}
|
|
67
69
|
export {};
|
|
@@ -14,6 +14,7 @@ export declare class BaseStrategy implements IStrategy {
|
|
|
14
14
|
loadAutotest(autotest: AutotestPost, status: string): Promise<void>;
|
|
15
15
|
private updateTestLinkToWorkItems;
|
|
16
16
|
loadTestRun(autotests: AutotestResult[]): Promise<void>;
|
|
17
|
+
updateSetupTeardown(autotests: AutotestResult[]): Promise<void>;
|
|
17
18
|
private tryStartSyncStorage;
|
|
18
19
|
protected updateTestRun(config: AdapterConfig): Promise<void>;
|
|
19
20
|
private getInProgressFirstGraceMs;
|
|
@@ -156,6 +156,11 @@ class BaseStrategy {
|
|
|
156
156
|
yield this.client.testRuns.loadAutotests(testRunId, autotests);
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
+
updateSetupTeardown(autotests) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
yield this.client.testRuns.updateSetupTeardown(autotests);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
159
164
|
tryStartSyncStorage(testRunId) {
|
|
160
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
166
|
if (!this.config.syncStorageEnabled) {
|
|
@@ -289,6 +289,9 @@ class ApiClient {
|
|
|
289
289
|
applyAuthToRequest(request, authNames) {
|
|
290
290
|
authNames.forEach(authName => {
|
|
291
291
|
var auth = this.authentications[authName];
|
|
292
|
+
if (!auth) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
292
295
|
switch (auth.type) {
|
|
293
296
|
case 'basic':
|
|
294
297
|
if (auth.username || auth.password) {
|