@loadmill/executer 0.1.161 → 0.1.163
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/ai-assertion/index.d.ts +3 -0
- package/dist/ai-assertion/index.js +113 -0
- package/dist/ai-assertion/index.js.map +1 -0
- package/dist/ai-assertion/prompts.d.ts +2 -0
- package/dist/ai-assertion/prompts.js +56 -0
- package/dist/ai-assertion/prompts.js.map +1 -0
- package/dist/ai-assertion/types.d.ts +16 -0
- package/dist/ai-assertion/types.js +3 -0
- package/dist/ai-assertion/types.js.map +1 -0
- package/dist/asserter.d.ts +4 -2
- package/dist/asserter.js +63 -47
- package/dist/asserter.js.map +1 -1
- package/dist/block-request.d.ts +1 -1
- package/dist/block-request.js +12 -22
- package/dist/block-request.js.map +1 -1
- package/dist/cookies.d.ts +1 -1
- package/dist/cookies.js +6 -8
- package/dist/cookies.js.map +1 -1
- package/dist/errors.js +2 -16
- package/dist/errors.js.map +1 -1
- package/dist/extraction-combiner.js +5 -43
- package/dist/extraction-combiner.js.map +1 -1
- package/dist/failures.js +3 -13
- package/dist/failures.js.map +1 -1
- package/dist/grpc.js +15 -72
- package/dist/grpc.js.map +1 -1
- package/dist/iteration-stats.js +5 -7
- package/dist/iteration-stats.js.map +1 -1
- package/dist/mill-version.js +1 -1
- package/dist/mill-version.js.map +1 -1
- package/dist/parameter-pools.js +6 -44
- package/dist/parameter-pools.js.map +1 -1
- package/dist/performance.js +2 -4
- package/dist/performance.js.map +1 -1
- package/dist/post-script/post-script-executor.js +7 -25
- package/dist/post-script/post-script-executor.js.map +1 -1
- package/dist/post-sequence.js +17 -55
- package/dist/post-sequence.js.map +1 -1
- package/dist/redact-data.js +9 -11
- package/dist/redact-data.js.map +1 -1
- package/dist/request-sequence-result.js +2 -12
- package/dist/request-sequence-result.js.map +1 -1
- package/dist/res-keeper.d.ts +1 -1
- package/dist/res-keeper.js +3 -21
- package/dist/res-keeper.js.map +1 -1
- package/dist/sampler.js +13 -75
- package/dist/sampler.js.map +1 -1
- package/dist/sequence-executor-like.d.ts +1 -1
- package/dist/sequence.d.ts +3 -1
- package/dist/sequence.js +272 -233
- package/dist/sequence.js.map +1 -1
- package/dist/single-runner.d.ts +2 -0
- package/dist/single-runner.js +12 -81
- package/dist/single-runner.js.map +1 -1
- package/dist/step-handlers/code-step-handler.js +6 -41
- package/dist/step-handlers/code-step-handler.js.map +1 -1
- package/dist/step-handlers/extract-step-handler.js +12 -43
- package/dist/step-handlers/extract-step-handler.js.map +1 -1
- package/dist/step-handlers/playwright/constants.js +3 -5
- package/dist/step-handlers/playwright/constants.js.map +1 -1
- package/dist/step-handlers/playwright/files-manager.js +13 -34
- package/dist/step-handlers/playwright/files-manager.js.map +1 -1
- package/dist/step-handlers/playwright/index.js +9 -44
- package/dist/step-handlers/playwright/index.js.map +1 -1
- package/dist/step-handlers/playwright/transformer.js +8 -8
- package/dist/step-handlers/playwright/transformer.js.map +1 -1
- package/dist/step-handlers/playwright-step-handler.js +11 -49
- package/dist/step-handlers/playwright-step-handler.js.map +1 -1
- package/dist/step-handlers/request-step-handler.js +6 -41
- package/dist/step-handlers/request-step-handler.js.map +1 -1
- package/dist/step-handlers/wait-step-handler.js +11 -46
- package/dist/step-handlers/wait-step-handler.js.map +1 -1
- package/dist/step-handlers/web-socket-step-handler.js +18 -75
- package/dist/step-handlers/web-socket-step-handler.js.map +1 -1
- package/dist/test-run-event-emitter.js +2 -4
- package/dist/test-run-event-emitter.js.map +1 -1
- package/dist/types/integrations.d.ts +4 -0
- package/dist/types/integrations.js +3 -0
- package/dist/types/integrations.js.map +1 -0
- package/dist/utils.js +2 -20
- package/dist/utils.js.map +1 -1
- package/dist/ws.js +20 -58
- package/dist/ws.js.map +1 -1
- package/package.json +3 -3
package/dist/sequence.js
CHANGED
|
@@ -1,105 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (_) try {
|
|
48
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
69
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70
|
-
to[j] = from[i];
|
|
71
|
-
return to;
|
|
72
|
-
};
|
|
73
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
74
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
75
|
-
};
|
|
76
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
3
|
exports.sequence = exports.reqIdParamName = void 0;
|
|
78
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var urijs_1 = tslib_1.__importDefault(require("urijs"));
|
|
79
6
|
var HTTPSAgent = require('agentkeepalive').HttpsAgent;
|
|
80
7
|
var HTTPAgent = require('agentkeepalive');
|
|
81
|
-
var randomstring_1 = __importDefault(require("randomstring"));
|
|
82
|
-
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
83
|
-
var flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
84
|
-
var clamp_1 = __importDefault(require("lodash/clamp"));
|
|
85
|
-
var find_1 = __importDefault(require("lodash/find"));
|
|
86
|
-
var map_1 = __importDefault(require("lodash/map"));
|
|
87
|
-
var filter_1 = __importDefault(require("lodash/filter"));
|
|
88
|
-
var cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
89
|
-
var isFunction_1 = __importDefault(require("lodash/isFunction"));
|
|
8
|
+
var randomstring_1 = tslib_1.__importDefault(require("randomstring"));
|
|
9
|
+
var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
10
|
+
var flatMap_1 = tslib_1.__importDefault(require("lodash/flatMap"));
|
|
11
|
+
var clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
|
|
12
|
+
var find_1 = tslib_1.__importDefault(require("lodash/find"));
|
|
13
|
+
var map_1 = tslib_1.__importDefault(require("lodash/map"));
|
|
14
|
+
var filter_1 = tslib_1.__importDefault(require("lodash/filter"));
|
|
15
|
+
var cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
16
|
+
var isFunction_1 = tslib_1.__importDefault(require("lodash/isFunction"));
|
|
90
17
|
var asserter_1 = require("./asserter");
|
|
91
18
|
var failures_1 = require("./failures");
|
|
92
19
|
var request_stats_1 = require("./request-stats");
|
|
93
20
|
var mill_version_1 = require("./mill-version");
|
|
94
21
|
var extraction_combiner_1 = require("./extraction-combiner");
|
|
95
22
|
var post_script_executor_1 = require("./post-script/post-script-executor");
|
|
96
|
-
var log_1 = __importDefault(require("@loadmill/universal/dist/log"));
|
|
97
|
-
var envUtils = __importStar(require("@loadmill/universal/dist/env-utils"));
|
|
98
|
-
var mathUtils = __importStar(require("@loadmill/universal/dist/math-utils"));
|
|
99
|
-
var uriUtils = __importStar(require("@loadmill/universal/dist/uri-utils"));
|
|
100
|
-
var promiseUtils = __importStar(require("@loadmill/universal/dist/promise-utils"));
|
|
101
|
-
var manipulationUtils = __importStar(require("@loadmill/universal/dist/manipulation-utils"));
|
|
23
|
+
var log_1 = tslib_1.__importDefault(require("@loadmill/universal/dist/log"));
|
|
24
|
+
var envUtils = tslib_1.__importStar(require("@loadmill/universal/dist/env-utils"));
|
|
25
|
+
var mathUtils = tslib_1.__importStar(require("@loadmill/universal/dist/math-utils"));
|
|
26
|
+
var uriUtils = tslib_1.__importStar(require("@loadmill/universal/dist/uri-utils"));
|
|
27
|
+
var promiseUtils = tslib_1.__importStar(require("@loadmill/universal/dist/promise-utils"));
|
|
28
|
+
var manipulationUtils = tslib_1.__importStar(require("@loadmill/universal/dist/manipulation-utils"));
|
|
102
29
|
var errors_1 = require("@loadmill/universal/dist/errors");
|
|
30
|
+
var array_utils_1 = require("@loadmill/universal/dist/array-utils");
|
|
103
31
|
var parameters_1 = require("@loadmill/core/dist/parameters");
|
|
104
32
|
var conf_1 = require("@loadmill/core/dist/conf");
|
|
105
33
|
var DEFAULT_CACHE_CONTROL = conf_1.confDefaults.DEFAULT_CACHE_CONTROL, DEFAULT_REQUEST_DELAY = conf_1.confDefaults.DEFAULT_REQUEST_DELAY;
|
|
@@ -139,8 +67,8 @@ exports.sequence = {
|
|
|
139
67
|
};
|
|
140
68
|
var SequenceExecutor = /** @class */ (function () {
|
|
141
69
|
function SequenceExecutor(httpAgent, parameters, domainsWhiteList, _a, protoFileRootPath) {
|
|
70
|
+
var increaseResSize = _a.increaseResSize, sequentialParameterPools = _a.sequentialParameterPools, sensitiveData = _a.sensitiveData, sensitiveKeys = _a.sensitiveKeys, executionBlockers = _a.executionBlockers, metricsKeys = _a.metricsKeys, xmlDecode = _a.xmlDecode, apiNoVerifyDomain = _a.apiNoVerifyDomain, integrations = _a.integrations;
|
|
142
71
|
var _this = this;
|
|
143
|
-
var increaseResSize = _a.increaseResSize, sequentialParameterPools = _a.sequentialParameterPools, sensitiveData = _a.sensitiveData, sensitiveKeys = _a.sensitiveKeys, executionBlockers = _a.executionBlockers, metricsKeys = _a.metricsKeys, xmlDecode = _a.xmlDecode, apiNoVerifyDomain = _a.apiNoVerifyDomain;
|
|
144
72
|
Object.defineProperty(this, "httpAgent", {
|
|
145
73
|
enumerable: true,
|
|
146
74
|
configurable: true,
|
|
@@ -291,6 +219,12 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
291
219
|
writable: true,
|
|
292
220
|
value: void 0
|
|
293
221
|
});
|
|
222
|
+
Object.defineProperty(this, "integrations", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
configurable: true,
|
|
225
|
+
writable: true,
|
|
226
|
+
value: {}
|
|
227
|
+
});
|
|
294
228
|
Object.defineProperty(this, "passStats", {
|
|
295
229
|
enumerable: true,
|
|
296
230
|
configurable: true,
|
|
@@ -331,7 +265,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
331
265
|
configurable: true,
|
|
332
266
|
writable: true,
|
|
333
267
|
value: function (url, reqIndex) {
|
|
334
|
-
var resolvedUrl = _this.resolve(url, function (e) { return failures_1.setParameterErrorHistogram(e, 'Failed to compute URL - '); });
|
|
268
|
+
var resolvedUrl = _this.resolve(url, function (e) { return (0, failures_1.setParameterErrorHistogram)(e, 'Failed to compute URL - '); });
|
|
335
269
|
_this.resolvedRequests[reqIndex].url = resolvedUrl;
|
|
336
270
|
return resolvedUrl;
|
|
337
271
|
}
|
|
@@ -342,7 +276,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
342
276
|
writable: true,
|
|
343
277
|
value: function (headers, reqIndex) {
|
|
344
278
|
var resolvedHeadersObj = {};
|
|
345
|
-
if (headers && !isEmpty_1.default(headers)) {
|
|
279
|
+
if (headers && !(0, isEmpty_1.default)(headers)) {
|
|
346
280
|
_this.resolveHeaders(headers)
|
|
347
281
|
.forEach(function (_a) {
|
|
348
282
|
var name = _a.name, value = _a.value;
|
|
@@ -362,9 +296,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
362
296
|
var mimeType = (postData === null || postData === void 0 ? void 0 : postData.mimeType) === request_1.WsMessageType.BINARY ? request_1.WsMessageType.BINARY : request_1.WsMessageType.TEXT;
|
|
363
297
|
if (postData) {
|
|
364
298
|
resolvedMessage = _this.resolve(postData.text, function (err) {
|
|
365
|
-
return failures_1.setParameterErrorHistogram(err, 'Failed to compute Websocket message - ');
|
|
299
|
+
return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to compute Websocket message - ');
|
|
366
300
|
});
|
|
367
|
-
if (resolvedMessage && resolvedMessage.length > utils_1.getMaxRequestBodySize()) {
|
|
301
|
+
if (resolvedMessage && resolvedMessage.length > (0, utils_1.getMaxRequestBodySize)()) {
|
|
368
302
|
throw new errors_2.RequestFailuresError('Websocket message size is too large');
|
|
369
303
|
}
|
|
370
304
|
_this.resolvedRequests[reqIndex].postData = {
|
|
@@ -395,7 +329,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
395
329
|
if (user && password) {
|
|
396
330
|
headers.push({
|
|
397
331
|
name: 'authorization',
|
|
398
|
-
value: 'Basic ' + Buffer.from(user
|
|
332
|
+
value: 'Basic ' + Buffer.from("".concat(user, ":").concat(password)).toString('base64'),
|
|
399
333
|
});
|
|
400
334
|
}
|
|
401
335
|
}
|
|
@@ -421,12 +355,12 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
421
355
|
var resolvedMessage = '';
|
|
422
356
|
if (grpc) {
|
|
423
357
|
resolvedMessage = _this.resolve(grpc.message, function (err) {
|
|
424
|
-
return failures_1.setParameterErrorHistogram(err, 'Failed to compute gRPC message - ');
|
|
358
|
+
return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to compute gRPC message - ');
|
|
425
359
|
});
|
|
426
|
-
if (resolvedMessage && resolvedMessage.length > utils_1.getMaxRequestBodySize()) {
|
|
360
|
+
if (resolvedMessage && resolvedMessage.length > (0, utils_1.getMaxRequestBodySize)()) {
|
|
427
361
|
throw new errors_2.RequestFailuresError('gRPC message size is too large');
|
|
428
362
|
}
|
|
429
|
-
_this.resolvedRequests[reqIndex].grpc = __assign(__assign({}, grpc), { message: resolvedMessage });
|
|
363
|
+
_this.resolvedRequests[reqIndex].grpc = tslib_1.__assign(tslib_1.__assign({}, grpc), { message: resolvedMessage });
|
|
430
364
|
}
|
|
431
365
|
_this.setVolatileParameters(parameters_1.BUILT_IN_VOLATILE_PARAMS.requestBody, resolvedMessage);
|
|
432
366
|
return { resolvedMessage: resolvedMessage };
|
|
@@ -450,9 +384,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
450
384
|
configurable: true,
|
|
451
385
|
writable: true,
|
|
452
386
|
value: function (extractions) {
|
|
453
|
-
return filter_1.default(extractions, function (extraction) { return extraction.header != null; }).map(function (extraction) {
|
|
387
|
+
return (0, filter_1.default)(extractions, function (extraction) { return extraction.header != null; }).map(function (extraction) {
|
|
454
388
|
return _this.resolve(extraction.header, function (err) {
|
|
455
|
-
return failures_1.setParameterErrorHistogram(err, "Failed to compute extraction header "
|
|
389
|
+
return (0, failures_1.setParameterErrorHistogram)(err, "Failed to compute extraction header ".concat(extraction.header, " - "));
|
|
456
390
|
});
|
|
457
391
|
});
|
|
458
392
|
}
|
|
@@ -485,6 +419,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
485
419
|
this.xmlDecode = xmlDecode;
|
|
486
420
|
this.executionBlockers = executionBlockers || [];
|
|
487
421
|
this.apiNoVerifyDomain = apiNoVerifyDomain;
|
|
422
|
+
this.integrations = integrations || {};
|
|
488
423
|
}
|
|
489
424
|
Object.defineProperty(SequenceExecutor.prototype, "startAndPass", {
|
|
490
425
|
enumerable: false,
|
|
@@ -499,7 +434,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
499
434
|
configurable: true,
|
|
500
435
|
writable: true,
|
|
501
436
|
value: function () {
|
|
502
|
-
return cookies_1.getCookies(this.httpAgent, this.resolvedRequests);
|
|
437
|
+
return (0, cookies_1.getCookies)(this.httpAgent, this.resolvedRequests);
|
|
503
438
|
}
|
|
504
439
|
});
|
|
505
440
|
Object.defineProperty(SequenceExecutor.prototype, "start", {
|
|
@@ -507,9 +442,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
507
442
|
configurable: true,
|
|
508
443
|
writable: true,
|
|
509
444
|
value: function (steps) {
|
|
510
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
445
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
511
446
|
var stepIndex, step, shouldApplyFlowControl, skipIndex, isLastStep, isPrevStepALoadmillRequest, error_1, reason, stack, message, unexpectedError;
|
|
512
|
-
return __generator(this, function (_a) {
|
|
447
|
+
return tslib_1.__generator(this, function (_a) {
|
|
513
448
|
switch (_a.label) {
|
|
514
449
|
case 0: return [4 /*yield*/, this.handleParameterPools()];
|
|
515
450
|
case 1:
|
|
@@ -545,7 +480,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
545
480
|
return [3 /*break*/, 7];
|
|
546
481
|
}
|
|
547
482
|
this.lastStartedIndex = stepIndex;
|
|
548
|
-
isPrevStepALoadmillRequest = stepIndex > 0 && type_guards_1.isLoadmillRequest(steps[stepIndex - 1]);
|
|
483
|
+
isPrevStepALoadmillRequest = stepIndex > 0 && (0, type_guards_1.isLoadmillRequest)(steps[stepIndex - 1]);
|
|
549
484
|
return [4 /*yield*/, this.executeStep(step, stepIndex, isPrevStepALoadmillRequest)];
|
|
550
485
|
case 5:
|
|
551
486
|
_a.sent();
|
|
@@ -558,7 +493,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
558
493
|
// Failures could be set before error was thrown,
|
|
559
494
|
// i.e. !error.histogram && !_.isEmpty(this.failures[reqIndex])
|
|
560
495
|
// CAN be true:
|
|
561
|
-
if (isEmpty_1.default(this.failures[stepIndex])) {
|
|
496
|
+
if ((0, isEmpty_1.default)(this.failures[stepIndex])) {
|
|
562
497
|
reason = 'Unexpected sampler error';
|
|
563
498
|
this.setSingleFailure(stepIndex, reason);
|
|
564
499
|
stack = error_1.stack, message = error_1.message;
|
|
@@ -599,7 +534,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
599
534
|
writable: true,
|
|
600
535
|
value: function () {
|
|
601
536
|
var postParameters = parameters_1.parameterUtils.getRunPostParameters(this.resolvedRequests);
|
|
602
|
-
post_sequence_1.publishMetrics(cloneDeep_1.default(postParameters), this.metricsKeys);
|
|
537
|
+
(0, post_sequence_1.publishMetrics)((0, cloneDeep_1.default)(postParameters), this.metricsKeys);
|
|
603
538
|
}
|
|
604
539
|
});
|
|
605
540
|
Object.defineProperty(SequenceExecutor.prototype, "cleanup", {
|
|
@@ -609,7 +544,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
609
544
|
value: function (stepIndex) {
|
|
610
545
|
this.wsHandler.closeAllConnections();
|
|
611
546
|
if (this.sensitiveData) {
|
|
612
|
-
redact_data_1.redactSensitiveData(this.resolvedRequests, this.sensitiveKeys);
|
|
547
|
+
(0, redact_data_1.redactSensitiveData)(this.resolvedRequests, this.sensitiveKeys);
|
|
613
548
|
}
|
|
614
549
|
if (stepIndex != null) {
|
|
615
550
|
this.removeVolatilePostParameters(stepIndex);
|
|
@@ -621,13 +556,13 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
621
556
|
configurable: true,
|
|
622
557
|
writable: true,
|
|
623
558
|
value: function () {
|
|
624
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
559
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
625
560
|
var newValues;
|
|
626
|
-
return __generator(this, function (_a) {
|
|
561
|
+
return tslib_1.__generator(this, function (_a) {
|
|
627
562
|
switch (_a.label) {
|
|
628
563
|
case 0:
|
|
629
564
|
if (!this.sequentialParameterPools) return [3 /*break*/, 2];
|
|
630
|
-
return [4 /*yield*/, parameter_pools_1.generateValuesForParameterPools(this.parameters.__testRunId)];
|
|
565
|
+
return [4 /*yield*/, (0, parameter_pools_1.generateValuesForParameterPools)(this.parameters.__testRunId)];
|
|
631
566
|
case 1:
|
|
632
567
|
newValues = _a.sent();
|
|
633
568
|
this.assignParameters(newValues);
|
|
@@ -673,8 +608,17 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
673
608
|
configurable: true,
|
|
674
609
|
writable: true,
|
|
675
610
|
value: function (index, loop) {
|
|
676
|
-
|
|
677
|
-
|
|
611
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
612
|
+
var asserter;
|
|
613
|
+
return tslib_1.__generator(this, function (_a) {
|
|
614
|
+
switch (_a.label) {
|
|
615
|
+
case 0:
|
|
616
|
+
asserter = new asserter_1.Asserter(this.parameters, this.integrations);
|
|
617
|
+
return [4 /*yield*/, this.evaluateAssertion(asserter, index, loop === null || loop === void 0 ? void 0 : loop.assert)];
|
|
618
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
});
|
|
678
622
|
}
|
|
679
623
|
});
|
|
680
624
|
Object.defineProperty(SequenceExecutor.prototype, "hasLoopingFailed", {
|
|
@@ -682,8 +626,22 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
682
626
|
configurable: true,
|
|
683
627
|
writable: true,
|
|
684
628
|
value: function (index, loop) {
|
|
685
|
-
|
|
686
|
-
|
|
629
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
630
|
+
var asserter, _a;
|
|
631
|
+
return tslib_1.__generator(this, function (_b) {
|
|
632
|
+
switch (_b.label) {
|
|
633
|
+
case 0:
|
|
634
|
+
asserter = new asserter_1.Asserter(this.parameters, this.integrations);
|
|
635
|
+
_a = loop && loop.assert;
|
|
636
|
+
if (!_a) return [3 /*break*/, 2];
|
|
637
|
+
return [4 /*yield*/, this.evaluateAssertion(asserter, index, loop === null || loop === void 0 ? void 0 : loop.assert)];
|
|
638
|
+
case 1:
|
|
639
|
+
_a = !(_b.sent());
|
|
640
|
+
_b.label = 2;
|
|
641
|
+
case 2: return [2 /*return*/, _a];
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
});
|
|
687
645
|
}
|
|
688
646
|
});
|
|
689
647
|
Object.defineProperty(SequenceExecutor.prototype, "isTruthyParameter", {
|
|
@@ -693,7 +651,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
693
651
|
value: function (conditionType, parameterName) {
|
|
694
652
|
var value = parameterName &&
|
|
695
653
|
parameters_1.parameterUtils.resolveParameter(parameterName, this.parameters, function (err) {
|
|
696
|
-
return failures_1.setParameterErrorHistogram(err, "Failed to compute "
|
|
654
|
+
return (0, failures_1.setParameterErrorHistogram)(err, "Failed to compute ".concat(conditionType, " condition - "));
|
|
697
655
|
});
|
|
698
656
|
return parameters_1.valueUtils.isTruthyParameterValue(value);
|
|
699
657
|
}
|
|
@@ -709,7 +667,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
709
667
|
var shouldSkip = this.isTruthyParameter('skip', condition);
|
|
710
668
|
if ((shouldSkip && !negate) || (!shouldSkip && negate)) {
|
|
711
669
|
if (goTo) {
|
|
712
|
-
return step_1.findStepIndex(steps, goTo);
|
|
670
|
+
return (0, step_1.findStepIndex)(steps, goTo);
|
|
713
671
|
}
|
|
714
672
|
else {
|
|
715
673
|
return reqIndex + 1;
|
|
@@ -723,9 +681,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
723
681
|
configurable: true,
|
|
724
682
|
writable: true,
|
|
725
683
|
value: function (step, shouldApplyFlowControl) {
|
|
726
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
684
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
727
685
|
var delay;
|
|
728
|
-
return __generator(this, function (_a) {
|
|
686
|
+
return tslib_1.__generator(this, function (_a) {
|
|
729
687
|
switch (_a.label) {
|
|
730
688
|
case 0:
|
|
731
689
|
delay = (shouldApplyFlowControl && step.delay) ? step.delay : DEFAULT_REQUEST_DELAY;
|
|
@@ -743,20 +701,20 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
743
701
|
configurable: true,
|
|
744
702
|
writable: true,
|
|
745
703
|
value: function (delay, key) {
|
|
746
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
704
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
747
705
|
var resolvedDelay, validationError;
|
|
748
|
-
return __generator(this, function (_a) {
|
|
706
|
+
return tslib_1.__generator(this, function (_a) {
|
|
749
707
|
switch (_a.label) {
|
|
750
708
|
case 0:
|
|
751
709
|
if (!delay) return [3 /*break*/, 2];
|
|
752
|
-
resolvedDelay = clamp_1.default(Math.round(Number(conf_1.isParameterCandidate(delay)
|
|
710
|
+
resolvedDelay = (0, clamp_1.default)(Math.round(Number((0, conf_1.isParameterCandidate)(delay)
|
|
753
711
|
? parameters_1.parameterUtils.resolveParameter(delay, this.parameters, function (err) {
|
|
754
|
-
return failures_1.setParameterErrorHistogram(err, "Failed to compute "
|
|
712
|
+
return (0, failures_1.setParameterErrorHistogram)(err, "Failed to compute ".concat(key === null || key === void 0 ? void 0 : key.toLowerCase(), " - "));
|
|
755
713
|
})
|
|
756
714
|
: delay)), MIN_REQUEST_DELAY, Infinity);
|
|
757
|
-
validationError = conf_1.validateIntegerDelay(resolvedDelay, false);
|
|
715
|
+
validationError = (0, conf_1.validateIntegerDelay)(resolvedDelay, false);
|
|
758
716
|
if (validationError) {
|
|
759
|
-
throw new errors_2.RequestFailuresError("Invalid "
|
|
717
|
+
throw new errors_2.RequestFailuresError("Invalid ".concat(key, ": ").concat(validationError));
|
|
760
718
|
}
|
|
761
719
|
return [4 /*yield*/, promiseUtils.delay(resolvedDelay)];
|
|
762
720
|
case 1:
|
|
@@ -773,7 +731,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
773
731
|
configurable: true,
|
|
774
732
|
writable: true,
|
|
775
733
|
value: function (index, histogram) {
|
|
776
|
-
this.failures[index] = failures_1.OneFailure(histogram);
|
|
734
|
+
this.failures[index] = (0, failures_1.OneFailure)(histogram);
|
|
777
735
|
}
|
|
778
736
|
});
|
|
779
737
|
Object.defineProperty(SequenceExecutor.prototype, "executeStep", {
|
|
@@ -782,10 +740,10 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
782
740
|
writable: true,
|
|
783
741
|
value: function (step, index, shouldOverrideLastResponseBody) {
|
|
784
742
|
var _a;
|
|
785
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
743
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
786
744
|
var failedAssertionsHistogram, resTime, res, loopIteration, maxIterations, handler, _b, timeout, message;
|
|
787
745
|
var _this = this;
|
|
788
|
-
return __generator(this, function (_c) {
|
|
746
|
+
return tslib_1.__generator(this, function (_c) {
|
|
789
747
|
switch (_c.label) {
|
|
790
748
|
case 0:
|
|
791
749
|
resTime = 0;
|
|
@@ -793,7 +751,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
793
751
|
maxIterations = getLoopIterations(step.loop);
|
|
794
752
|
_c.label = 1;
|
|
795
753
|
case 1:
|
|
796
|
-
if (!(loopIteration < maxIterations)) return [3 /*break*/,
|
|
754
|
+
if (!(loopIteration < maxIterations)) return [3 /*break*/, 11];
|
|
797
755
|
loopIteration++;
|
|
798
756
|
if (shouldOverrideLastResponseBody) {
|
|
799
757
|
this.lastResponseBody = this.parameters[parameters_1.BUILT_IN_VOLATILE_PARAMS.responseBody] || '';
|
|
@@ -801,21 +759,21 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
801
759
|
this.initVolatileParameters();
|
|
802
760
|
handler = this.handlers.find(function (h) { return h.canHandle(step); });
|
|
803
761
|
if (!handler) {
|
|
804
|
-
throw new Error("No handler found for step type: "
|
|
762
|
+
throw new Error("No handler found for step type: ".concat(step.type));
|
|
805
763
|
}
|
|
806
764
|
return [4 /*yield*/, handler.execute(step, index)];
|
|
807
765
|
case 2:
|
|
808
766
|
res = _c.sent();
|
|
809
767
|
// Setting now to avoid possible user overwrite:
|
|
810
768
|
resTime = Number(this.parameters.__responseTime);
|
|
811
|
-
if (type_guards_1.isTransportableStep(step)) {
|
|
769
|
+
if ((0, type_guards_1.isTransportableStep)(step)) {
|
|
812
770
|
_b = step.timeout, timeout = _b === void 0 ? request_1.DEFAULT_REQUEST_TIMEOUT : _b;
|
|
813
771
|
if (resTime > timeout) {
|
|
814
772
|
if (step.expectedStatus === request_1.ALLOWED_RESPONSE_STATUSES.ANY) {
|
|
815
|
-
log_1.default.warn("Response received after timeout of "
|
|
773
|
+
log_1.default.warn("Response received after timeout of ".concat(timeout, "ms exceeded, but expectedStatus is ANY"));
|
|
816
774
|
}
|
|
817
775
|
else {
|
|
818
|
-
throw new errors_2.RequestFailuresError("Response received after timeout of "
|
|
776
|
+
throw new errors_2.RequestFailuresError("Response received after timeout of ".concat(timeout, "ms exceeded"));
|
|
819
777
|
}
|
|
820
778
|
}
|
|
821
779
|
res.wsExtractionData = { getMessages: function () { return _this.wsHandler.getMessages(); }, timeLimit: timeout - resTime };
|
|
@@ -824,22 +782,25 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
824
782
|
case 3:
|
|
825
783
|
failedAssertionsHistogram = _c.sent();
|
|
826
784
|
this.resolvedRequests[index].retried = loopIteration > 1 ? loopIteration - 1 : undefined;
|
|
827
|
-
if (!(loopIteration < maxIterations)) return [3 /*break*/,
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
785
|
+
if (!(loopIteration < maxIterations)) return [3 /*break*/, 8];
|
|
786
|
+
return [4 /*yield*/, this.shouldStopLooping(index, step.loop)];
|
|
787
|
+
case 4:
|
|
788
|
+
if (!_c.sent()) return [3 /*break*/, 5];
|
|
789
|
+
return [3 /*break*/, 11];
|
|
790
|
+
case 5: return [4 /*yield*/, promiseUtils.delay(((_a = step.loop) === null || _a === void 0 ? void 0 : _a.wait) || DEFAULT_LOOP_WAIT)];
|
|
791
|
+
case 6:
|
|
832
792
|
_c.sent();
|
|
833
|
-
_c.label =
|
|
834
|
-
case
|
|
835
|
-
case
|
|
836
|
-
if (this.hasLoopingFailed(index, step.loop)) {
|
|
837
|
-
throw new errors_2.RequestFailuresError(errors_1.createLoopErrorMessage(maxIterations));
|
|
838
|
-
}
|
|
839
|
-
_c.label = 8;
|
|
840
|
-
case 8: return [3 /*break*/, 1];
|
|
793
|
+
_c.label = 7;
|
|
794
|
+
case 7: return [3 /*break*/, 10];
|
|
795
|
+
case 8: return [4 /*yield*/, this.hasLoopingFailed(index, step.loop)];
|
|
841
796
|
case 9:
|
|
842
|
-
if (
|
|
797
|
+
if (_c.sent()) {
|
|
798
|
+
throw new errors_2.RequestFailuresError((0, errors_1.createLoopErrorMessage)(maxIterations));
|
|
799
|
+
}
|
|
800
|
+
_c.label = 10;
|
|
801
|
+
case 10: return [3 /*break*/, 1];
|
|
802
|
+
case 11:
|
|
803
|
+
if (!(0, isEmpty_1.default)(failedAssertionsHistogram)) {
|
|
843
804
|
message = 'Request failed due to assertions.';
|
|
844
805
|
log_1.default.debug(message, {
|
|
845
806
|
failedAssertionsHistogram: failedAssertionsHistogram,
|
|
@@ -865,7 +826,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
865
826
|
this.avgResTime = mathUtils.calcAvg(this.avgResTime, this.successfulHits, resTime, 1);
|
|
866
827
|
++this.successfulHits;
|
|
867
828
|
}
|
|
868
|
-
request_stats_1.setReqStats(this.requestStats, index, excludeInAvgStats, resTime);
|
|
829
|
+
(0, request_stats_1.setReqStats)(this.requestStats, index, excludeInAvgStats, resTime);
|
|
869
830
|
}
|
|
870
831
|
});
|
|
871
832
|
Object.defineProperty(SequenceExecutor.prototype, "initVolatileParameters", {
|
|
@@ -896,7 +857,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
896
857
|
var _a;
|
|
897
858
|
var postParams = (_a = _this.resolvedRequests[idx]) === null || _a === void 0 ? void 0 : _a.postParameters;
|
|
898
859
|
if (postParams) {
|
|
899
|
-
var toRemove = postParams.findIndex(function (param) { return !isEmpty_1.default(param[parameterName]); });
|
|
860
|
+
var toRemove = postParams.findIndex(function (param) { return !(0, isEmpty_1.default)(param[parameterName]); });
|
|
900
861
|
toRemove >= 0 && postParams.splice(toRemove, 1);
|
|
901
862
|
}
|
|
902
863
|
});
|
|
@@ -908,11 +869,11 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
908
869
|
writable: true,
|
|
909
870
|
value: function (request, reqIndex) {
|
|
910
871
|
var _a;
|
|
911
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
872
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
912
873
|
var res, reqId, redirectHeaders, requestStartTime, beforeTime, error_2, status_1, message, code, prefix, reportedReason, response, failure;
|
|
913
874
|
var _b, _c;
|
|
914
875
|
var _this = this;
|
|
915
|
-
return __generator(this, function (_d) {
|
|
876
|
+
return tslib_1.__generator(this, function (_d) {
|
|
916
877
|
switch (_d.label) {
|
|
917
878
|
case 0:
|
|
918
879
|
redirectHeaders = [];
|
|
@@ -935,8 +896,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
935
896
|
return [4 /*yield*/, request.ok(function (res, isExpectedStatus) {
|
|
936
897
|
if (isExpectedStatus === void 0) { isExpectedStatus = isExpectedHttpStatus; }
|
|
937
898
|
var status = res.status;
|
|
938
|
-
if (_this.xmlDecode && is_xml_1.isXML(res.type) && res.text) {
|
|
939
|
-
res.text = decode_1.decodePriorityResponse(res.text);
|
|
899
|
+
if (_this.xmlDecode && (0, is_xml_1.isXML)(res.type) && res.text) {
|
|
900
|
+
res.text = (0, decode_1.decodePriorityResponse)(res.text);
|
|
940
901
|
}
|
|
941
902
|
_this.setTimeParams(requestStartTime, beforeTime);
|
|
942
903
|
_this.setResolvedResponse(reqIndex, {
|
|
@@ -956,7 +917,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
956
917
|
error_2 = _d.sent();
|
|
957
918
|
log_1.default.debug('Request failed:', error_2);
|
|
958
919
|
status_1 = error_2.status, message = error_2.message, code = error_2.code;
|
|
959
|
-
prefix = status_1 ? "HTTP status "
|
|
920
|
+
prefix = status_1 ? "HTTP status ".concat(status_1, " - ") : '';
|
|
960
921
|
reportedReason = prefix + message;
|
|
961
922
|
if (!(message === errors_1.superagentCorsError)) return [3 /*break*/, 8];
|
|
962
923
|
if (!(typeof loadmillGetResponse === 'function')) return [3 /*break*/, 7];
|
|
@@ -970,7 +931,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
970
931
|
? errors_1.corsPreFlightErrorStatusPrefix
|
|
971
932
|
: errors_1.corsErrorStatusPrefix) + response.status;
|
|
972
933
|
this.resolvedRequests[reqIndex].headers = manipulationUtils.objToSingletonArray(response.requestHeaders);
|
|
973
|
-
this.setResolvedResponse(reqIndex, __assign(__assign({}, response), { type: response.headers['content-type'] }));
|
|
934
|
+
this.setResolvedResponse(reqIndex, tslib_1.__assign(tslib_1.__assign({}, response), { type: response.headers['content-type'] }));
|
|
974
935
|
return [3 /*break*/, 8];
|
|
975
936
|
case 7:
|
|
976
937
|
reportedReason = errors_1.unknownStatusCorsError;
|
|
@@ -1064,7 +1025,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1064
1025
|
writable: true,
|
|
1065
1026
|
value: function (_a) {
|
|
1066
1027
|
var url = _a.url;
|
|
1067
|
-
var resolvedUrl = this.resolve(url, function (e) { return failures_1.setParameterErrorHistogram(e, 'Failed to compute URL - '); });
|
|
1028
|
+
var resolvedUrl = this.resolve(url, function (e) { return (0, failures_1.setParameterErrorHistogram)(e, 'Failed to compute URL - '); });
|
|
1068
1029
|
return resolvedUrl.startsWith('ws://') || resolvedUrl.startsWith('wss://');
|
|
1069
1030
|
}
|
|
1070
1031
|
});
|
|
@@ -1074,7 +1035,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1074
1035
|
writable: true,
|
|
1075
1036
|
value: function (_a) {
|
|
1076
1037
|
var url = _a.url;
|
|
1077
|
-
var resolvedUrl = this.resolve(url, function (e) { return failures_1.setParameterErrorHistogram(e, 'Failed to compute URL - '); });
|
|
1038
|
+
var resolvedUrl = this.resolve(url, function (e) { return (0, failures_1.setParameterErrorHistogram)(e, 'Failed to compute URL - '); });
|
|
1078
1039
|
return resolvedUrl.startsWith('grpc://');
|
|
1079
1040
|
}
|
|
1080
1041
|
});
|
|
@@ -1085,8 +1046,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1085
1046
|
value: function (requestConf, reqIndex) {
|
|
1086
1047
|
var _this = this;
|
|
1087
1048
|
var _a;
|
|
1088
|
-
var urlObj = new urijs_1.default(request_1.resolveUrl(requestConf.url, this.parameters, function (err) {
|
|
1089
|
-
return failures_1.setParameterErrorHistogram(err, 'Failed to compute URL - ');
|
|
1049
|
+
var urlObj = new urijs_1.default((0, request_1.resolveUrl)(requestConf.url, this.parameters, function (err) {
|
|
1050
|
+
return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to compute URL - ');
|
|
1090
1051
|
}));
|
|
1091
1052
|
// these are empty strings when missing!
|
|
1092
1053
|
var user = urlObj.username();
|
|
@@ -1116,8 +1077,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1116
1077
|
}
|
|
1117
1078
|
this.preparePostData(requestConf, request, reqIndex);
|
|
1118
1079
|
// todo itay: instead we should collect from all extractions but some kind of `defer` flag to header extractors:
|
|
1119
|
-
var extractionHeaders = flatMap_1.default(requestConf.extract, this.collectExtractionHeaders).filter(isNonSimpleResponseHeader);
|
|
1120
|
-
if (!isEmpty_1.default(extractionHeaders)) {
|
|
1080
|
+
var extractionHeaders = (0, flatMap_1.default)(requestConf.extract, this.collectExtractionHeaders).filter(isNonSimpleResponseHeader);
|
|
1081
|
+
if (!(0, isEmpty_1.default)(extractionHeaders)) {
|
|
1121
1082
|
// this is not required in a node environment but also does not matter
|
|
1122
1083
|
// thus we prefer to keep it in order to reduce dissimilarities:
|
|
1123
1084
|
//todo itay: allow users to overwrite / disable this headers?
|
|
@@ -1173,7 +1134,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1173
1134
|
}
|
|
1174
1135
|
this.resolvedRequests[reqIndex].headers = manipulationUtils.objToSingletonArray(request.header);
|
|
1175
1136
|
request.expectedStatus = requestConf.expectedStatus || request_1.ALLOWED_RESPONSE_STATUSES.SUCCESS;
|
|
1176
|
-
block_request_1.enforceExecutionBlockers(this.executionBlockers, request);
|
|
1137
|
+
(0, block_request_1.enforceExecutionBlockers)(this.executionBlockers, request);
|
|
1177
1138
|
return request;
|
|
1178
1139
|
}
|
|
1179
1140
|
});
|
|
@@ -1183,7 +1144,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1183
1144
|
writable: true,
|
|
1184
1145
|
value: function (headers, request, filter) {
|
|
1185
1146
|
if (filter === void 0) { filter = function (_h) { return true; }; }
|
|
1186
|
-
if (headers && !isEmpty_1.default(headers)) {
|
|
1147
|
+
if (headers && !(0, isEmpty_1.default)(headers)) {
|
|
1187
1148
|
this.resolveHeaders(headers)
|
|
1188
1149
|
.filter(filter)
|
|
1189
1150
|
.forEach(function (_a) {
|
|
@@ -1233,13 +1194,13 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1233
1194
|
data = this.prepareUrlEncoded(postData.params);
|
|
1234
1195
|
}
|
|
1235
1196
|
else {
|
|
1236
|
-
data = this.resolve(postData.text, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to compute request body - '); });
|
|
1197
|
+
data = this.resolve(postData.text, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to compute request body - '); });
|
|
1237
1198
|
}
|
|
1238
|
-
if (data && data.length > utils_1.getMaxRequestBodySize()) {
|
|
1199
|
+
if (data && data.length > (0, utils_1.getMaxRequestBodySize)()) {
|
|
1239
1200
|
throw new errors_2.RequestFailuresError('Request body size is too large');
|
|
1240
1201
|
}
|
|
1241
|
-
if (this.xmlDecode && is_xml_1.isXML(mimeType)) {
|
|
1242
|
-
data = encode_1.encodeXMLRequestBody(data);
|
|
1202
|
+
if (this.xmlDecode && (0, is_xml_1.isXML)(mimeType)) {
|
|
1203
|
+
data = (0, encode_1.encodeXMLRequestBody)(data);
|
|
1243
1204
|
}
|
|
1244
1205
|
// This invocation will behave differently according to different types set on the request:
|
|
1245
1206
|
request.send(data);
|
|
@@ -1257,21 +1218,21 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1257
1218
|
value: function (postFormData, request, reqIndex) {
|
|
1258
1219
|
var resolvedPostFormData = [];
|
|
1259
1220
|
var size = 0;
|
|
1260
|
-
var MAX_BODY_SIZE = utils_1.getMaxRequestBodySize();
|
|
1221
|
+
var MAX_BODY_SIZE = (0, utils_1.getMaxRequestBodySize)();
|
|
1261
1222
|
for (var _i = 0, postFormData_1 = postFormData; _i < postFormData_1.length; _i++) {
|
|
1262
1223
|
var entry = postFormData_1[_i];
|
|
1263
1224
|
var name_1 = entry.name, value = entry.value, fileName = entry.fileName;
|
|
1264
|
-
var resolvedName = this.resolve(name_1, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve form-data key - '); });
|
|
1225
|
+
var resolvedName = this.resolve(name_1, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve form-data key - '); });
|
|
1265
1226
|
size += resolvedName.length;
|
|
1266
1227
|
if (fileName) {
|
|
1267
|
-
var resolvedFileName = this.resolve(fileName, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve form-data fileName - '); });
|
|
1228
|
+
var resolvedFileName = this.resolve(fileName, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve form-data fileName - '); });
|
|
1268
1229
|
size += (resolvedFileName.length + value.length);
|
|
1269
1230
|
var buffer = Buffer.from(value, 'binary');
|
|
1270
1231
|
request.attach(resolvedName, buffer, resolvedFileName);
|
|
1271
1232
|
resolvedPostFormData.push({ name: resolvedName, value: value, fileName: resolvedFileName });
|
|
1272
1233
|
}
|
|
1273
1234
|
else {
|
|
1274
|
-
var resolvedValue = this.resolve(value, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve form-data value - '); });
|
|
1235
|
+
var resolvedValue = this.resolve(value, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve form-data value - '); });
|
|
1275
1236
|
size += resolvedValue.length;
|
|
1276
1237
|
request.field(resolvedName, resolvedValue);
|
|
1277
1238
|
resolvedPostFormData.push({ name: resolvedName, value: resolvedValue });
|
|
@@ -1293,9 +1254,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1293
1254
|
for (var _i = 0, params_1 = params; _i < params_1.length; _i++) {
|
|
1294
1255
|
var param = params_1[_i];
|
|
1295
1256
|
var name_2 = param.name, value = param.value;
|
|
1296
|
-
var resolvedName = this.resolve(name_2, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve params key - '); });
|
|
1297
|
-
var resolvedValue = this.resolve(value, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve params value - '); });
|
|
1298
|
-
resolvedParams.push(resolvedName
|
|
1257
|
+
var resolvedName = this.resolve(name_2, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve params key - '); });
|
|
1258
|
+
var resolvedValue = this.resolve(value, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve params value - '); });
|
|
1259
|
+
resolvedParams.push("".concat(resolvedName, "=").concat(resolvedValue));
|
|
1299
1260
|
}
|
|
1300
1261
|
return resolvedParams.join('&');
|
|
1301
1262
|
}
|
|
@@ -1308,8 +1269,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1308
1269
|
var query = _a.query, operationName = _a.operationName, variables = _a.variables;
|
|
1309
1270
|
var mimeType = request_1.ConfMimeTypes.APPLICATION_JSON;
|
|
1310
1271
|
request.type(mimeType);
|
|
1311
|
-
var data = JSON.stringify(__assign(__assign(__assign({}, (query && { query: this.resolve(query, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve graphql query - '); }) })), (operationName && { operationName: this.resolve(operationName, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve graphql operationName - '); }) })), (variables && { variables: this.prepareGraphqlVariables(variables) })));
|
|
1312
|
-
if (data.length > utils_1.getMaxRequestBodySize()) {
|
|
1272
|
+
var data = JSON.stringify(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (query && { query: this.resolve(query, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve graphql query - '); }) })), (operationName && { operationName: this.resolve(operationName, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve graphql operationName - '); }) })), (variables && { variables: this.prepareGraphqlVariables(variables) })));
|
|
1273
|
+
if (data.length > (0, utils_1.getMaxRequestBodySize)()) {
|
|
1313
1274
|
throw new errors_2.RequestFailuresError('Request body size is too large');
|
|
1314
1275
|
}
|
|
1315
1276
|
request.send(data);
|
|
@@ -1325,7 +1286,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1325
1286
|
configurable: true,
|
|
1326
1287
|
writable: true,
|
|
1327
1288
|
value: function (variables) {
|
|
1328
|
-
var resolvedVariables = this.resolve(variables, function (err) { return failures_1.setParameterErrorHistogram(err, 'Failed to resolve graphql variables - '); });
|
|
1289
|
+
var resolvedVariables = this.resolve(variables, function (err) { return (0, failures_1.setParameterErrorHistogram)(err, 'Failed to resolve graphql variables - '); });
|
|
1329
1290
|
try {
|
|
1330
1291
|
resolvedVariables = JSON.parse(resolvedVariables);
|
|
1331
1292
|
}
|
|
@@ -1363,16 +1324,16 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1363
1324
|
value: function (domain, requestType) {
|
|
1364
1325
|
var _a, _b, _c;
|
|
1365
1326
|
if (requestType === void 0) { requestType = constants_1.RequestType.HTTP; }
|
|
1366
|
-
if (isEmpty_1.default(domain)) {
|
|
1367
|
-
var message = requestType
|
|
1327
|
+
if ((0, isEmpty_1.default)(domain)) {
|
|
1328
|
+
var message = "".concat(requestType, " request domain name is empty");
|
|
1368
1329
|
throw new errors_2.RequestFailuresError(message, (_a = {}, _a[message] = 1, _a));
|
|
1369
1330
|
}
|
|
1370
1331
|
if (conf_1.validate.isUrl(domain)) {
|
|
1371
|
-
var message = requestType
|
|
1332
|
+
var message = "".concat(requestType, " request domain name [").concat(domain, "] is not valid");
|
|
1372
1333
|
throw new errors_2.RequestFailuresError(message, (_b = {}, _b[message] = 1, _b));
|
|
1373
1334
|
}
|
|
1374
1335
|
else if (!this.apiNoVerifyDomain && !uriUtils.isVerified(domain, this.domainsWhiteList)) {
|
|
1375
|
-
var message = requestType
|
|
1336
|
+
var message = "".concat(requestType, " request domain name [").concat(domain, "] is not on white list");
|
|
1376
1337
|
throw new errors_2.RequestFailuresError(message, (_c = {}, _c[message] = 1, _c));
|
|
1377
1338
|
}
|
|
1378
1339
|
}
|
|
@@ -1383,7 +1344,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1383
1344
|
writable: true,
|
|
1384
1345
|
value: function (service) {
|
|
1385
1346
|
var _a;
|
|
1386
|
-
if (isEmpty_1.default(service)) {
|
|
1347
|
+
if ((0, isEmpty_1.default)(service)) {
|
|
1387
1348
|
var message = 'gRPC request service name is empty';
|
|
1388
1349
|
throw new errors_2.RequestFailuresError(message, (_a = {}, _a[message] = 1, _a));
|
|
1389
1350
|
}
|
|
@@ -1404,11 +1365,11 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1404
1365
|
writable: true,
|
|
1405
1366
|
value: function (headers) {
|
|
1406
1367
|
var _this = this;
|
|
1407
|
-
return flatMap_1.default(headers, function (aHeaders) {
|
|
1408
|
-
return map_1.default(aHeaders, function (value, name) { return ({
|
|
1368
|
+
return (0, flatMap_1.default)(headers, function (aHeaders) {
|
|
1369
|
+
return (0, map_1.default)(aHeaders, function (value, name) { return ({
|
|
1409
1370
|
name: name,
|
|
1410
1371
|
value: _this.resolve(value, function (err) {
|
|
1411
|
-
return failures_1.setParameterErrorHistogram(err, "Failed to compute "
|
|
1372
|
+
return (0, failures_1.setParameterErrorHistogram)(err, "Failed to compute ".concat(name, " header value - "));
|
|
1412
1373
|
}),
|
|
1413
1374
|
}); });
|
|
1414
1375
|
});
|
|
@@ -1419,8 +1380,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1419
1380
|
configurable: true,
|
|
1420
1381
|
writable: true,
|
|
1421
1382
|
value: function (reqIndex, requestConf, res) {
|
|
1422
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1423
|
-
return __generator(this, function (_a) {
|
|
1383
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1384
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1424
1385
|
switch (_a.label) {
|
|
1425
1386
|
case 0:
|
|
1426
1387
|
this.setVolatileParameters(parameters_1.BUILT_IN_VOLATILE_PARAMS.responseBody, res.text);
|
|
@@ -1433,7 +1394,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1433
1394
|
this.handlePostScript(requestConf, res, reqIndex);
|
|
1434
1395
|
}
|
|
1435
1396
|
this.setPostParameters(reqIndex);
|
|
1436
|
-
return [
|
|
1397
|
+
return [4 /*yield*/, this.handleAssertions(reqIndex, requestConf)];
|
|
1398
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
1437
1399
|
}
|
|
1438
1400
|
});
|
|
1439
1401
|
});
|
|
@@ -1444,10 +1406,19 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1444
1406
|
configurable: true,
|
|
1445
1407
|
writable: true,
|
|
1446
1408
|
value: function (reqIndex, step) {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1409
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1410
|
+
var _a, evaluatedAssertions, evaluatedDisabledAssertions;
|
|
1411
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1412
|
+
switch (_b.label) {
|
|
1413
|
+
case 0: return [4 /*yield*/, this.evaluateAssertions(step)];
|
|
1414
|
+
case 1:
|
|
1415
|
+
_a = _b.sent(), evaluatedAssertions = _a.evaluatedAssertions, evaluatedDisabledAssertions = _a.evaluatedDisabledAssertions;
|
|
1416
|
+
this.handleDisabledAssertions(reqIndex, evaluatedDisabledAssertions);
|
|
1417
|
+
log_1.default.trace('Assertion results: ', evaluatedAssertions);
|
|
1418
|
+
return [2 /*return*/, _evaluatedAssertionsToFailuresHistogram(evaluatedAssertions)];
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
});
|
|
1451
1422
|
}
|
|
1452
1423
|
});
|
|
1453
1424
|
Object.defineProperty(SequenceExecutor.prototype, "setPostParameters", {
|
|
@@ -1457,8 +1428,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1457
1428
|
value: function (reqIndex) {
|
|
1458
1429
|
this.resolvedRequests[reqIndex].postParameters =
|
|
1459
1430
|
manipulationUtils.objToSingletonArray(this.parameters)
|
|
1460
|
-
.filter(function (p) { return !isEmpty_1.default(p); })
|
|
1461
|
-
.filter(function (p) { return !isFunction_1.default(parameters_1.parameterUtils.getParameterValue(p)); });
|
|
1431
|
+
.filter(function (p) { return !(0, isEmpty_1.default)(p); })
|
|
1432
|
+
.filter(function (p) { return !(0, isFunction_1.default)(parameters_1.parameterUtils.getParameterValue(p)); });
|
|
1462
1433
|
}
|
|
1463
1434
|
});
|
|
1464
1435
|
Object.defineProperty(SequenceExecutor.prototype, "handleExtractions", {
|
|
@@ -1466,9 +1437,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1466
1437
|
configurable: true,
|
|
1467
1438
|
writable: true,
|
|
1468
1439
|
value: function (requestConf, res) {
|
|
1469
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1440
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1470
1441
|
var _i, _a, extractions;
|
|
1471
|
-
return __generator(this, function (_b) {
|
|
1442
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1472
1443
|
switch (_b.label) {
|
|
1473
1444
|
case 0:
|
|
1474
1445
|
_i = 0, _a = (requestConf.extract || []);
|
|
@@ -1494,9 +1465,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1494
1465
|
configurable: true,
|
|
1495
1466
|
writable: true,
|
|
1496
1467
|
value: function (res, extractions) {
|
|
1497
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1468
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1498
1469
|
var contextParameters, extractionCombiner, _i, _a, _b, name_3, extraction;
|
|
1499
|
-
return __generator(this, function (_c) {
|
|
1470
|
+
return tslib_1.__generator(this, function (_c) {
|
|
1500
1471
|
switch (_c.label) {
|
|
1501
1472
|
case 0:
|
|
1502
1473
|
contextParameters = Object.assign({}, this.parameters);
|
|
@@ -1524,9 +1495,9 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1524
1495
|
configurable: true,
|
|
1525
1496
|
writable: true,
|
|
1526
1497
|
value: function (parameterName, extraction, extractionCombiner) {
|
|
1527
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1498
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1528
1499
|
var result, combinedExtractor, error_3, genericMessage, prettyMessage, publicMessage, reqIndex;
|
|
1529
|
-
return __generator(this, function (_a) {
|
|
1500
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1530
1501
|
switch (_a.label) {
|
|
1531
1502
|
case 0:
|
|
1532
1503
|
log_1.default.trace('Parameter extraction start: ', { parameterName: parameterName, extraction: extraction });
|
|
@@ -1542,11 +1513,11 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1542
1513
|
return [3 /*break*/, 5];
|
|
1543
1514
|
case 4:
|
|
1544
1515
|
error_3 = _a.sent();
|
|
1545
|
-
genericMessage = "Failed to extract value for parameter \""
|
|
1516
|
+
genericMessage = "Failed to extract value for parameter \"".concat(parameterName, "\"");
|
|
1546
1517
|
log_1.default.debug(genericMessage, error_3);
|
|
1547
1518
|
prettyMessage = error_3.prettyMessage;
|
|
1548
1519
|
publicMessage = prettyMessage
|
|
1549
|
-
? genericMessage
|
|
1520
|
+
? "".concat(genericMessage, " - ").concat(prettyMessage)
|
|
1550
1521
|
: genericMessage;
|
|
1551
1522
|
if (error_3 instanceof errors_1.WebsocketError) {
|
|
1552
1523
|
reqIndex = this.resolvedRequests.length - 1;
|
|
@@ -1633,7 +1604,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1633
1604
|
configurable: true,
|
|
1634
1605
|
writable: true,
|
|
1635
1606
|
value: function (reqIndex, stdout) {
|
|
1636
|
-
if (!isEmpty_1.default(stdout)) {
|
|
1607
|
+
if (!(0, isEmpty_1.default)(stdout)) {
|
|
1637
1608
|
(this.resolvedRequests[reqIndex].stdout = stdout);
|
|
1638
1609
|
}
|
|
1639
1610
|
}
|
|
@@ -1657,16 +1628,59 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1657
1628
|
configurable: true,
|
|
1658
1629
|
writable: true,
|
|
1659
1630
|
value: function (step) {
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1631
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1632
|
+
var asserter, evaluatedAssertions, evaluatedDisabledAssertions, index, assertion, _a, _b, _c, _d, _e, _f;
|
|
1633
|
+
return tslib_1.__generator(this, function (_g) {
|
|
1634
|
+
switch (_g.label) {
|
|
1635
|
+
case 0:
|
|
1636
|
+
asserter = new asserter_1.Asserter(this.parameters, this.integrations);
|
|
1637
|
+
evaluatedAssertions = [], evaluatedDisabledAssertions = [];
|
|
1638
|
+
if (!(0, array_utils_1.isNonEmptyArray)(step.assert)) return [3 /*break*/, 7];
|
|
1639
|
+
index = 0;
|
|
1640
|
+
_g.label = 1;
|
|
1641
|
+
case 1:
|
|
1642
|
+
if (!(index < step.assert.length)) return [3 /*break*/, 7];
|
|
1643
|
+
assertion = step.assert[index];
|
|
1644
|
+
if (this.shouldTreatAssertionAsDisabled(assertion)) {
|
|
1645
|
+
assertion.disabled = true;
|
|
1646
|
+
evaluatedDisabledAssertions.push(false);
|
|
1647
|
+
return [3 /*break*/, 6];
|
|
1648
|
+
}
|
|
1649
|
+
_b = (_a = evaluatedAssertions).push;
|
|
1650
|
+
_c = assertion.disabled;
|
|
1651
|
+
if (_c) return [3 /*break*/, 3];
|
|
1652
|
+
return [4 /*yield*/, this.evaluateAssertion(asserter, index, assertion)];
|
|
1653
|
+
case 2:
|
|
1654
|
+
_c = (_g.sent());
|
|
1655
|
+
_g.label = 3;
|
|
1656
|
+
case 3:
|
|
1657
|
+
_b.apply(_a, [_c]);
|
|
1658
|
+
_e = (_d = evaluatedDisabledAssertions).push;
|
|
1659
|
+
_f = !assertion.disabled;
|
|
1660
|
+
if (_f) return [3 /*break*/, 5];
|
|
1661
|
+
return [4 /*yield*/, this.evaluateDisabledAssertion(asserter, assertion)];
|
|
1662
|
+
case 4:
|
|
1663
|
+
_f = (_g.sent());
|
|
1664
|
+
_g.label = 5;
|
|
1665
|
+
case 5:
|
|
1666
|
+
_e.apply(_d, [_f]);
|
|
1667
|
+
_g.label = 6;
|
|
1668
|
+
case 6:
|
|
1669
|
+
index++;
|
|
1670
|
+
return [3 /*break*/, 1];
|
|
1671
|
+
case 7: return [2 /*return*/, { evaluatedAssertions: evaluatedAssertions, evaluatedDisabledAssertions: evaluatedDisabledAssertions }];
|
|
1672
|
+
}
|
|
1667
1673
|
});
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
Object.defineProperty(SequenceExecutor.prototype, "shouldTreatAssertionAsDisabled", {
|
|
1678
|
+
enumerable: false,
|
|
1679
|
+
configurable: true,
|
|
1680
|
+
writable: true,
|
|
1681
|
+
value: function (assertion) {
|
|
1682
|
+
var _a;
|
|
1683
|
+
return !!(assertion.AIVerify && ((_a = this.integrations.openai) === null || _a === void 0 ? void 0 : _a.apiKey) && !this.integrations.openai.enabled);
|
|
1670
1684
|
}
|
|
1671
1685
|
});
|
|
1672
1686
|
Object.defineProperty(SequenceExecutor.prototype, "evaluateAssertion", {
|
|
@@ -1674,13 +1688,29 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1674
1688
|
configurable: true,
|
|
1675
1689
|
writable: true,
|
|
1676
1690
|
value: function (asserter, reqIndex, assertion) {
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1691
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1692
|
+
var _a, e_1;
|
|
1693
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1694
|
+
switch (_b.label) {
|
|
1695
|
+
case 0:
|
|
1696
|
+
_b.trys.push([0, 3, , 4]);
|
|
1697
|
+
_a = !!assertion;
|
|
1698
|
+
if (!_a) return [3 /*break*/, 2];
|
|
1699
|
+
return [4 /*yield*/, asserter.assert(assertion)];
|
|
1700
|
+
case 1:
|
|
1701
|
+
_a = (_b.sent());
|
|
1702
|
+
_b.label = 2;
|
|
1703
|
+
case 2: return [2 /*return*/, _a];
|
|
1704
|
+
case 3:
|
|
1705
|
+
e_1 = _b.sent();
|
|
1706
|
+
if (!(e_1 instanceof errors_2.RequestFailuresError)) {
|
|
1707
|
+
(0, failures_1.setParameterErrorHistogram)(e_1, "Failed to compute ${".concat(assertion === null || assertion === void 0 ? void 0 : assertion.check, "} (assertion #").concat(reqIndex + 1, ") - "));
|
|
1708
|
+
}
|
|
1709
|
+
throw e_1;
|
|
1710
|
+
case 4: return [2 /*return*/];
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
});
|
|
1684
1714
|
}
|
|
1685
1715
|
});
|
|
1686
1716
|
Object.defineProperty(SequenceExecutor.prototype, "evaluateDisabledAssertion", {
|
|
@@ -1688,12 +1718,21 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1688
1718
|
configurable: true,
|
|
1689
1719
|
writable: true,
|
|
1690
1720
|
value: function (asserter, assertion) {
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1721
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1722
|
+
var _a;
|
|
1723
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1724
|
+
switch (_b.label) {
|
|
1725
|
+
case 0:
|
|
1726
|
+
_b.trys.push([0, 2, , 3]);
|
|
1727
|
+
return [4 /*yield*/, asserter.assert(assertion)];
|
|
1728
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
1729
|
+
case 2:
|
|
1730
|
+
_a = _b.sent();
|
|
1731
|
+
return [2 /*return*/, false];
|
|
1732
|
+
case 3: return [2 /*return*/];
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1735
|
+
});
|
|
1697
1736
|
}
|
|
1698
1737
|
});
|
|
1699
1738
|
Object.defineProperty(SequenceExecutor.prototype, "setRequestCookies", {
|
|
@@ -1720,8 +1759,8 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1720
1759
|
writable: true,
|
|
1721
1760
|
value: function (reqIndex, evaluatedAssertions) {
|
|
1722
1761
|
var failuresHistogram = _evaluatedAssertionsToFailuresHistogram(evaluatedAssertions);
|
|
1723
|
-
if (!isEmpty_1.default(failuresHistogram)) {
|
|
1724
|
-
this.evaluatingFailures[reqIndex] = failures_1.OneFailure(failuresHistogram);
|
|
1762
|
+
if (!(0, isEmpty_1.default)(failuresHistogram)) {
|
|
1763
|
+
this.evaluatingFailures[reqIndex] = (0, failures_1.OneFailure)(failuresHistogram);
|
|
1725
1764
|
}
|
|
1726
1765
|
}
|
|
1727
1766
|
});
|
|
@@ -1730,7 +1769,7 @@ var SequenceExecutor = /** @class */ (function () {
|
|
|
1730
1769
|
configurable: true,
|
|
1731
1770
|
writable: true,
|
|
1732
1771
|
value: function (cookies) {
|
|
1733
|
-
cookies_1.setCookies(this.httpAgent, cookies);
|
|
1772
|
+
(0, cookies_1.setCookies)(this.httpAgent, cookies);
|
|
1734
1773
|
}
|
|
1735
1774
|
});
|
|
1736
1775
|
Object.defineProperty(SequenceExecutor.prototype, "setHtmlReport", {
|
|
@@ -1771,7 +1810,7 @@ function isSimpleRequest(headers) {
|
|
|
1771
1810
|
return false;
|
|
1772
1811
|
}
|
|
1773
1812
|
}
|
|
1774
|
-
return !find_1.default(headers, function (_, key) {
|
|
1813
|
+
return !(0, find_1.default)(headers, function (_, key) {
|
|
1775
1814
|
return key !== 'accept' &&
|
|
1776
1815
|
key !== 'accept-language' &&
|
|
1777
1816
|
key !== 'content-language' &&
|
|
@@ -1783,9 +1822,9 @@ var getLoopIterations = function (LoopConf) {
|
|
|
1783
1822
|
return Math.min(MAX_REQUEST_LOOPS_ITERATIONS, declared);
|
|
1784
1823
|
};
|
|
1785
1824
|
var extendResponseHeaders = function (headers, redirectHeaders) {
|
|
1786
|
-
if (!isEmpty_1.default(redirectHeaders) && headers) {
|
|
1825
|
+
if (!(0, isEmpty_1.default)(redirectHeaders) && headers) {
|
|
1787
1826
|
redirectHeaders.forEach(function (loc, idx) {
|
|
1788
|
-
headers["location_"
|
|
1827
|
+
headers["location_".concat(idx + 1)] = loc;
|
|
1789
1828
|
});
|
|
1790
1829
|
headers.location = redirectHeaders[redirectHeaders.length - 1]; // stroe the last one as location
|
|
1791
1830
|
}
|
|
@@ -1827,8 +1866,8 @@ var setTCPReuse = function (request, agent, sslAgent) {
|
|
|
1827
1866
|
this.agent(agent);
|
|
1828
1867
|
}
|
|
1829
1868
|
// then continue with superagent logic
|
|
1830
|
-
_oldRequest.apply.apply(_oldRequest, __spreadArray([this], args));
|
|
1869
|
+
_oldRequest.apply.apply(_oldRequest, tslib_1.__spreadArray([this], args, false));
|
|
1831
1870
|
};
|
|
1832
1871
|
};
|
|
1833
|
-
var _shouldExcludeResTimeInAvg = function (step) { return !type_guards_1.isLoadmillRequest(step); };
|
|
1872
|
+
var _shouldExcludeResTimeInAvg = function (step) { return !(0, type_guards_1.isLoadmillRequest)(step); };
|
|
1834
1873
|
//# sourceMappingURL=sequence.js.map
|