@elastic/synthetics 1.0.0-beta.4 → 1.0.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/cli.js +137 -160
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +161 -31
- package/dist/common_types.d.ts.map +1 -1
- package/dist/config.d.ts +3 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -6
- package/dist/config.js.map +1 -1
- package/dist/core/browser-service.d.ts +1 -1
- package/dist/core/browser-service.d.ts.map +1 -1
- package/dist/core/browser-service.js +7 -6
- package/dist/core/browser-service.js.map +1 -1
- package/dist/core/expect.d.ts +25 -25
- package/dist/core/expect.d.ts.map +1 -1
- package/dist/core/expect.js.map +1 -1
- package/dist/core/gatherer.d.ts +4 -8
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +53 -15
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +5 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +23 -11
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +0 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +3 -16
- package/dist/core/logger.js.map +1 -1
- package/dist/core/runner.d.ts +12 -63
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +156 -90
- package/dist/core/runner.js.map +1 -1
- package/dist/core/transform.d.ts +37 -0
- package/dist/core/transform.d.ts.map +1 -0
- package/dist/core/transform.js +148 -0
- package/dist/core/transform.js.map +1 -0
- package/dist/dsl/index.js +5 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/dsl/journey.d.ts +9 -4
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +37 -9
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/monitor.d.ts +83 -0
- package/dist/dsl/monitor.d.ts.map +1 -0
- package/dist/dsl/monitor.js +108 -0
- package/dist/dsl/monitor.js.map +1 -0
- package/dist/dsl/step.d.ts +3 -2
- package/dist/dsl/step.d.ts.map +1 -1
- package/dist/dsl/step.js +6 -1
- package/dist/dsl/step.js.map +1 -1
- package/dist/formatter/javascript.d.ts +98 -0
- package/dist/formatter/javascript.d.ts.map +1 -0
- package/dist/formatter/javascript.js +298 -0
- package/dist/formatter/javascript.js.map +1 -0
- package/dist/generator/index.d.ts +24 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +241 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/{reporters/reporter.js → generator/utils.d.ts} +5 -3
- package/dist/generator/utils.d.ts.map +1 -0
- package/dist/generator/utils.js +84 -0
- package/dist/generator/utils.js.map +1 -0
- package/dist/helpers.d.ts +28 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +152 -20
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -26
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +34 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +149 -0
- package/dist/loader.js.map +1 -0
- package/dist/locations/index.d.ts +45 -0
- package/dist/locations/index.d.ts.map +1 -0
- package/dist/locations/index.js +83 -0
- package/dist/locations/index.js.map +1 -0
- package/dist/{reporters/reporter.d.ts → locations/public-locations.d.ts} +12 -8
- package/dist/locations/public-locations.d.ts.map +1 -0
- package/dist/locations/public-locations.js +41 -0
- package/dist/locations/public-locations.js.map +1 -0
- package/dist/options.d.ts +41 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +198 -0
- package/dist/options.js.map +1 -0
- package/dist/plugins/browser-console.d.ts +5 -4
- package/dist/plugins/browser-console.d.ts.map +1 -1
- package/dist/plugins/browser-console.js +44 -24
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/index.js +5 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/network.d.ts +20 -33
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +177 -216
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +4 -19
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js +6 -5
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +9 -5
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +46 -30
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.d.ts +6 -6
- package/dist/plugins/tracing.d.ts.map +1 -1
- package/dist/plugins/tracing.js +10 -7
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/push/bundler.d.ts +35 -0
- package/dist/push/bundler.d.ts.map +1 -0
- package/dist/push/bundler.js +131 -0
- package/dist/push/bundler.js.map +1 -0
- package/dist/push/index.d.ts +9 -0
- package/dist/push/index.d.ts.map +1 -0
- package/dist/push/index.js +227 -0
- package/dist/push/index.js.map +1 -0
- package/dist/push/kibana_api.d.ts +56 -0
- package/dist/push/kibana_api.d.ts.map +1 -0
- package/dist/push/kibana_api.js +135 -0
- package/dist/push/kibana_api.js.map +1 -0
- package/dist/push/monitor.d.ts +51 -0
- package/dist/push/monitor.d.ts.map +1 -0
- package/dist/push/monitor.js +244 -0
- package/dist/push/monitor.js.map +1 -0
- package/dist/{parse_args.d.ts → push/plugin.d.ts} +9 -6
- package/dist/push/plugin.d.ts.map +1 -0
- package/dist/push/plugin.js +66 -0
- package/dist/push/plugin.js.map +1 -0
- package/dist/push/request.d.ts +45 -0
- package/dist/push/request.d.ts.map +1 -0
- package/dist/push/request.js +109 -0
- package/dist/push/request.js.map +1 -0
- package/dist/push/utils.d.ts +31 -0
- package/dist/push/utils.d.ts.map +1 -0
- package/dist/push/utils.js +64 -0
- package/dist/push/utils.js.map +1 -0
- package/dist/reporters/base.d.ts +14 -6
- package/dist/reporters/base.d.ts.map +1 -1
- package/dist/reporters/base.js +58 -50
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/index.d.ts +18 -8
- package/dist/reporters/index.d.ts.map +1 -1
- package/dist/reporters/index.js.map +1 -1
- package/dist/reporters/json.d.ts +17 -62
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +149 -179
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/junit.d.ts +7 -1
- package/dist/reporters/junit.d.ts.map +1 -1
- package/dist/reporters/junit.js +90 -95
- package/dist/reporters/junit.js.map +1 -1
- package/dist/sdk/lh-trace-processor.d.ts +35 -9
- package/dist/sdk/lh-trace-processor.d.ts.map +1 -1
- package/dist/sdk/lh-trace-processor.js +114 -53
- package/dist/sdk/lh-trace-processor.js.map +1 -1
- package/dist/sdk/trace-metrics.d.ts +4 -4
- package/dist/sdk/trace-metrics.d.ts.map +1 -1
- package/dist/sdk/trace-metrics.js +3 -4
- package/dist/sdk/trace-metrics.js.map +1 -1
- package/dist/sdk/trace-processor.d.ts +11 -3
- package/dist/sdk/trace-processor.d.ts.map +1 -1
- package/dist/sdk/trace-processor.js +17 -9
- package/dist/sdk/trace-processor.js.map +1 -1
- package/package.json +39 -24
- package/src/cli.ts +219 -151
- package/src/common_types.ts +193 -31
- package/src/config.ts +3 -6
- package/src/core/expect.ts +58 -24
- package/src/core/gatherer.ts +64 -24
- package/src/core/index.ts +36 -15
- package/src/core/logger.ts +1 -12
- package/src/core/runner.ts +151 -136
- package/src/core/transform.ts +160 -0
- package/src/dsl/journey.ts +39 -6
- package/src/dsl/monitor.ts +140 -0
- package/src/dsl/step.ts +9 -2
- package/src/formatter/javascript.ts +367 -0
- package/src/generator/index.ts +308 -0
- package/src/generator/utils.ts +84 -0
- package/src/helpers.ts +159 -13
- package/src/index.ts +22 -22
- package/src/loader.ts +167 -0
- package/src/locations/index.ts +95 -0
- package/src/{reporters/reporter.ts → locations/public-locations.ts} +12 -9
- package/src/options.ts +227 -0
- package/src/plugins/browser-console.ts +30 -8
- package/src/plugins/network.ts +208 -267
- package/src/plugins/performance.ts +6 -22
- package/src/plugins/plugin-manager.ts +49 -31
- package/src/plugins/tracing.ts +8 -9
- package/src/push/bundler.ts +112 -0
- package/src/push/index.ts +282 -0
- package/src/push/kibana_api.ts +191 -0
- package/src/push/monitor.ts +276 -0
- package/src/push/plugin.ts +66 -0
- package/src/push/request.ts +141 -0
- package/src/push/utils.ts +77 -0
- package/src/reporters/base.ts +63 -52
- package/src/reporters/index.ts +26 -3
- package/src/reporters/json.ts +183 -202
- package/src/reporters/junit.ts +98 -93
- package/src/sdk/lh-trace-processor.ts +132 -68
- package/src/sdk/trace-metrics.ts +8 -4
- package/src/sdk/trace-processor.ts +28 -13
- package/templates/.github/workflows/run-synthetics.yml +27 -0
- package/templates/README.md +21 -0
- package/templates/journeys/advanced-example-helpers.ts +54 -0
- package/templates/journeys/advanced-example.journey.ts +43 -0
- package/templates/journeys/example.journey.ts +18 -0
- package/templates/lightweight/heartbeat.yml +8 -0
- package/templates/synthetics.config.ts +35 -0
- package/CHANGELOG.md +0 -131
- package/NOTICE.txt +0 -221
- package/dist/parse_args.d.ts.map +0 -1
- package/dist/parse_args.js +0 -95
- package/dist/parse_args.js.map +0 -1
- package/dist/reporters/reporter.d.ts.map +0 -1
- package/dist/reporters/reporter.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1888
- package/src/parse_args.ts +0 -135
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.renderLocations = exports.groupLocations = exports.formatLocations = exports.getLocations = void 0;
|
|
28
|
+
const request_1 = require("../push/request");
|
|
29
|
+
const helpers_1 = require("../helpers");
|
|
30
|
+
const utils_1 = require("../push/utils");
|
|
31
|
+
const PRIVATE_KEYWORD = '(private)';
|
|
32
|
+
async function getLocations(options) {
|
|
33
|
+
const resp = await (0, request_1.sendReqAndHandleError)({
|
|
34
|
+
url: (0, utils_1.generateURL)(options, 'location'),
|
|
35
|
+
method: 'GET',
|
|
36
|
+
auth: options.auth,
|
|
37
|
+
});
|
|
38
|
+
return resp.locations;
|
|
39
|
+
}
|
|
40
|
+
exports.getLocations = getLocations;
|
|
41
|
+
function formatLocations(locations) {
|
|
42
|
+
const formatted = [];
|
|
43
|
+
for (const location of locations) {
|
|
44
|
+
let name = location.label;
|
|
45
|
+
if (location.isServiceManaged) {
|
|
46
|
+
[, name] = name.includes('-') ? name.split('-') : [, name];
|
|
47
|
+
name = name.toLowerCase().trim().split(' ').join('_');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
name = `${name}${PRIVATE_KEYWORD}`;
|
|
51
|
+
}
|
|
52
|
+
formatted.push(name);
|
|
53
|
+
}
|
|
54
|
+
return formatted;
|
|
55
|
+
}
|
|
56
|
+
exports.formatLocations = formatLocations;
|
|
57
|
+
function groupLocations(locations) {
|
|
58
|
+
const grouped = { locations: [], privateLocations: [] };
|
|
59
|
+
for (const loc of locations) {
|
|
60
|
+
if (loc.includes(PRIVATE_KEYWORD)) {
|
|
61
|
+
grouped.privateLocations.push(loc.replace(PRIVATE_KEYWORD, ''));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
grouped.locations.push(loc);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return grouped;
|
|
68
|
+
}
|
|
69
|
+
exports.groupLocations = groupLocations;
|
|
70
|
+
function renderLocations(locations) {
|
|
71
|
+
let outer = 'Available locations: \n';
|
|
72
|
+
let inner = '';
|
|
73
|
+
for (const location of locations) {
|
|
74
|
+
inner += `* ${location}\n`;
|
|
75
|
+
}
|
|
76
|
+
outer += (0, helpers_1.indent)(inner);
|
|
77
|
+
outer += `\nSet default location for monitors via
|
|
78
|
+
- Synthetics config file 'monitors.locations' | 'monitors.privateLocations' field
|
|
79
|
+
- Monitor API 'monitor.use({ locations: ["japan"], privateLocations: ["custom-location"] }')`;
|
|
80
|
+
(0, helpers_1.write)(outer);
|
|
81
|
+
}
|
|
82
|
+
exports.renderLocations = renderLocations;
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locations/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,6CAAwD;AACxD,wCAA2C;AAC3C,yCAA4C;AAiB5C,MAAM,eAAe,GAAG,WAAW,CAAC;AA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G,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;SACjE;aAAM;YACL,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAC7B;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAVD,wCAUC;AAED,SAAgB,eAAe,CAAC,SAAwB;IACtD,IAAI,KAAK,GAAG,yBAAyB,CAAC;IACtC,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC;KAC5B;IACD,KAAK,IAAI,IAAA,gBAAM,EAAC,KAAK,CAAC,CAAC;IACvB,KAAK,IAAI;;+FAEoF,CAAC;IAE9F,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;AACf,CAAC;AAZD,0CAYC"}
|
|
@@ -22,12 +22,16 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
export declare const LocationsMap: {
|
|
26
|
+
japan: string;
|
|
27
|
+
india: string;
|
|
28
|
+
singapore: string;
|
|
29
|
+
australia_east: string;
|
|
30
|
+
united_kingdom: string;
|
|
31
|
+
germany: string;
|
|
32
|
+
canada_east: string;
|
|
33
|
+
brazil: string;
|
|
34
|
+
us_east: string;
|
|
35
|
+
us_west: string;
|
|
29
36
|
};
|
|
30
|
-
|
|
31
|
-
new (runner: Runner, options: ReporterOptions): any;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=reporter.d.ts.map
|
|
37
|
+
//# sourceMappingURL=public-locations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-locations.d.ts","sourceRoot":"","sources":["../../src/locations/public-locations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWxB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.LocationsMap = void 0;
|
|
28
|
+
// DO NOT EDIT - UPDATE WITH `npm run build:locations`
|
|
29
|
+
exports.LocationsMap = {
|
|
30
|
+
japan: 'asia-northeast1-a',
|
|
31
|
+
india: 'asia-south1-a',
|
|
32
|
+
singapore: 'asia-southeast1-a',
|
|
33
|
+
australia_east: 'australia-southeast1-a',
|
|
34
|
+
united_kingdom: 'europe-west2-a',
|
|
35
|
+
germany: 'europe-west3-a',
|
|
36
|
+
canada_east: 'northamerica-northeast1-a',
|
|
37
|
+
brazil: 'southamerica-east1-a',
|
|
38
|
+
us_east: 'us-east4-a',
|
|
39
|
+
us_west: 'us-west1-a',
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=public-locations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-locations.js","sourceRoot":"","sources":["../../src/locations/public-locations.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,sDAAsD;AACzC,QAAA,YAAY,GAAG;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,mBAAmB;IAC9B,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,gBAAgB;IAChC,OAAO,EAAE,gBAAgB;IACzB,WAAW,EAAE,2BAA2B;IACxC,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;CACtB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
import type { CliArgs, RunOptions } from './common_types';
|
|
26
|
+
export declare function normalizeOptions(cliArgs: CliArgs): RunOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Parses the throttling CLI settings and also
|
|
29
|
+
* adapts to the format to keep the backwards compatability
|
|
30
|
+
* - Accepts old format `<5d/3u/20l>`
|
|
31
|
+
* - Processess new format otherwise `{download: 5, upload: 3, latency: 20}`
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseThrottling(value: string, prev?: string): any;
|
|
34
|
+
export declare function getCommonCommandOpts(): {
|
|
35
|
+
params: import("commander").Option;
|
|
36
|
+
playwrightOpts: import("commander").Option;
|
|
37
|
+
pattern: import("commander").Option;
|
|
38
|
+
tags: import("commander").Option;
|
|
39
|
+
match: import("commander").Option;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAqB,MAAM,gBAAgB,CAAC;AAW7E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CA+G7D;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,OAwB3D;AAED,wBAAgB,oBAAoB;;;;;;EAiCnC"}
|
package/dist/options.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.getCommonCommandOpts = exports.parseThrottling = exports.normalizeOptions = void 0;
|
|
31
|
+
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
32
|
+
const commander_1 = require("commander");
|
|
33
|
+
const config_1 = require("./config");
|
|
34
|
+
const helpers_1 = require("./helpers");
|
|
35
|
+
/**
|
|
36
|
+
* Set debug based on DEBUG ENV and -d flags
|
|
37
|
+
* namespace - synthetics
|
|
38
|
+
*/
|
|
39
|
+
const namespace = 'synthetics';
|
|
40
|
+
if (process.env.DEBUG && process.env.DEBUG.includes(namespace)) {
|
|
41
|
+
process.env.DEBUG = '1';
|
|
42
|
+
}
|
|
43
|
+
function normalizeOptions(cliArgs) {
|
|
44
|
+
const options = {
|
|
45
|
+
...cliArgs,
|
|
46
|
+
environment: process.env['NODE_ENV'] || 'development',
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Group all events that can be consumed by heartbeat and
|
|
50
|
+
* eventually by the Synthetics UI.
|
|
51
|
+
*/
|
|
52
|
+
if (cliArgs.richEvents) {
|
|
53
|
+
options.reporter = cliArgs.reporter ?? 'json';
|
|
54
|
+
options.ssblocks = true;
|
|
55
|
+
options.network = true;
|
|
56
|
+
options.trace = true;
|
|
57
|
+
options.quietExitCode = true;
|
|
58
|
+
}
|
|
59
|
+
if (cliArgs.capability) {
|
|
60
|
+
const supportedCapabilities = [
|
|
61
|
+
'trace',
|
|
62
|
+
'network',
|
|
63
|
+
'filmstrips',
|
|
64
|
+
'metrics',
|
|
65
|
+
'ssblocks',
|
|
66
|
+
];
|
|
67
|
+
/**
|
|
68
|
+
* trace - record chrome trace events(LCP, FCP, CLS, etc.) for all journeys
|
|
69
|
+
* network - capture network information for all journeys
|
|
70
|
+
* filmstrips - record detailed filmstrips for all journeys
|
|
71
|
+
* metrics - capture performance metrics (DOM Nodes, Heap size, etc.) for each step
|
|
72
|
+
* ssblocks - Dedupes the screenshots in to blocks to save storage space
|
|
73
|
+
*/
|
|
74
|
+
for (const flag of cliArgs.capability) {
|
|
75
|
+
if (supportedCapabilities.includes(flag)) {
|
|
76
|
+
options[flag] = true;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.warn(`Missing capability "${flag}", current supported capabilities are ${supportedCapabilities.join(', ')}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate and read synthetics config file
|
|
85
|
+
* based on the environment
|
|
86
|
+
*/
|
|
87
|
+
const config = cliArgs.config || !cliArgs.inline
|
|
88
|
+
? (0, config_1.readConfig)(options.environment, cliArgs.config)
|
|
89
|
+
: {};
|
|
90
|
+
/**
|
|
91
|
+
* Order of preference for options that are used while running are
|
|
92
|
+
* 1. Local options configured via Runner API
|
|
93
|
+
* 2. CLI flags
|
|
94
|
+
* 3. Configuration file
|
|
95
|
+
*/
|
|
96
|
+
options.params = Object.freeze((0, deepmerge_1.default)(config.params, cliArgs.params || {}));
|
|
97
|
+
/**
|
|
98
|
+
* Merge playwright options from CLI and Synthetics config
|
|
99
|
+
* and prefer individual options over other option
|
|
100
|
+
*/
|
|
101
|
+
const playwrightOpts = (0, deepmerge_1.default)(config.playwrightOptions, cliArgs.playwrightOptions || {});
|
|
102
|
+
options.playwrightOptions = {
|
|
103
|
+
...playwrightOpts,
|
|
104
|
+
headless: cliArgs.headless,
|
|
105
|
+
chromiumSandbox: cliArgs.sandbox ?? playwrightOpts?.chromiumSandbox,
|
|
106
|
+
ignoreHTTPSErrors: cliArgs.ignoreHttpsErrors ?? playwrightOpts?.ignoreHTTPSErrors,
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Get the default monitor config from synthetics.config.ts file
|
|
110
|
+
*/
|
|
111
|
+
const monitor = config.monitor;
|
|
112
|
+
if (cliArgs.throttling) {
|
|
113
|
+
const throttleConfig = deepmerge_1.default.all([
|
|
114
|
+
helpers_1.DEFAULT_THROTTLING_OPTIONS,
|
|
115
|
+
toObject(monitor?.throttling),
|
|
116
|
+
toObject(cliArgs.throttling),
|
|
117
|
+
]);
|
|
118
|
+
if (monitor?.throttling !== false) {
|
|
119
|
+
options.throttling = throttleConfig;
|
|
120
|
+
options.networkConditions = (0, helpers_1.getNetworkConditions)(throttleConfig);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
/**
|
|
124
|
+
* If the throttling is disabled via Project monitor config, use it a source
|
|
125
|
+
* of truth and disable it for pushing those monitors.
|
|
126
|
+
*/
|
|
127
|
+
options.throttling = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
/**
|
|
132
|
+
* Do not apply throttling when `--no-throttling` flag is passed
|
|
133
|
+
*/
|
|
134
|
+
options.throttling = false;
|
|
135
|
+
}
|
|
136
|
+
options.schedule = cliArgs.schedule ?? monitor?.schedule;
|
|
137
|
+
options.locations = cliArgs.locations ?? monitor?.locations;
|
|
138
|
+
options.privateLocations =
|
|
139
|
+
cliArgs.privateLocations ?? monitor?.privateLocations;
|
|
140
|
+
return options;
|
|
141
|
+
}
|
|
142
|
+
exports.normalizeOptions = normalizeOptions;
|
|
143
|
+
function toObject(value) {
|
|
144
|
+
const defaulVal = {};
|
|
145
|
+
if (typeof value === 'boolean') {
|
|
146
|
+
return defaulVal;
|
|
147
|
+
}
|
|
148
|
+
return value || defaulVal;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Parses the throttling CLI settings and also
|
|
152
|
+
* adapts to the format to keep the backwards compatability
|
|
153
|
+
* - Accepts old format `<5d/3u/20l>`
|
|
154
|
+
* - Processess new format otherwise `{download: 5, upload: 3, latency: 20}`
|
|
155
|
+
*/
|
|
156
|
+
function parseThrottling(value, prev) {
|
|
157
|
+
const THROTTLING_REGEX = /([0-9]{1,}u)|([0-9]{1,}d)|([0-9]{1,}l)/gm;
|
|
158
|
+
if (THROTTLING_REGEX.test(value)) {
|
|
159
|
+
const throttling = {};
|
|
160
|
+
const conditions = value.split('/');
|
|
161
|
+
conditions.forEach(condition => {
|
|
162
|
+
const setting = condition.slice(0, condition.length - 1);
|
|
163
|
+
const token = condition.slice(-1);
|
|
164
|
+
switch (token) {
|
|
165
|
+
case 'd':
|
|
166
|
+
throttling.download = Number(setting);
|
|
167
|
+
break;
|
|
168
|
+
case 'u':
|
|
169
|
+
throttling.upload = Number(setting);
|
|
170
|
+
break;
|
|
171
|
+
case 'l':
|
|
172
|
+
throttling.latency = Number(setting);
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return throttling;
|
|
177
|
+
}
|
|
178
|
+
return JSON.parse(value || prev);
|
|
179
|
+
}
|
|
180
|
+
exports.parseThrottling = parseThrottling;
|
|
181
|
+
function getCommonCommandOpts() {
|
|
182
|
+
const params = (0, commander_1.createOption)('-p, --params <jsonstring>', 'JSON object that gets injected to all journeys');
|
|
183
|
+
params.argParser(JSON.parse);
|
|
184
|
+
const playwrightOpts = (0, commander_1.createOption)('--playwright-options <jsonstring>', 'JSON object to pass in custom Playwright options for the agent. Options passed will be merged with Playwright options defined in your synthetics.config.js file.');
|
|
185
|
+
playwrightOpts.argParser(JSON.parse);
|
|
186
|
+
const pattern = (0, commander_1.createOption)('--pattern <pattern>', 'RegExp pattern to look for journey files that are different from the default (ex: /*.journey.(ts|js)$/)');
|
|
187
|
+
const tags = (0, commander_1.createOption)('--tags <name...>', 'run only journeys with a tag that matches the glob');
|
|
188
|
+
const match = (0, commander_1.createOption)('--match <name>', 'run only journeys with a name or tag that matches the glob');
|
|
189
|
+
return {
|
|
190
|
+
params,
|
|
191
|
+
playwrightOpts,
|
|
192
|
+
pattern,
|
|
193
|
+
tags,
|
|
194
|
+
match,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
exports.getCommonCommandOpts = getCommonCommandOpts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M,CAAC,OAAO,CAAC,CAAC;oBACtC,MAAM;gBACR,KAAK,GAAG;oBACN,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;oBACpC,MAAM;gBACR,KAAK,GAAG;oBACN,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;oBACrC,MAAM;aACT;QACH,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;KACnB;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;AACnC,CAAC;AAxBD,0CAwBC;AAED,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,IAAA,wBAAY,EACzB,2BAA2B,EAC3B,gDAAgD,CACjD,CAAC;IACF,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE7B,MAAM,cAAc,GAAG,IAAA,wBAAY,EACjC,mCAAmC,EACnC,kKAAkK,CACnK,CAAC;IACF,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAErC,MAAM,OAAO,GAAG,IAAA,wBAAY,EAC1B,qBAAqB,EACrB,yGAAyG,CAC1G,CAAC;IACF,MAAM,IAAI,GAAG,IAAA,wBAAY,EACvB,kBAAkB,EAClB,oDAAoD,CACrD,CAAC;IACF,MAAM,KAAK,GAAG,IAAA,wBAAY,EACxB,gBAAgB,EAChB,4DAA4D,CAC7D,CAAC;IAEF,OAAO;QACL,MAAM;QACN,cAAc;QACd,OAAO;QACP,IAAI;QACJ,KAAK;KACN,CAAC;AACJ,CAAC;AAjCD,oDAiCC"}
|
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
import { BrowserMessage } from '../common_types';
|
|
25
|
+
import { BrowserMessage, Driver } from '../common_types';
|
|
27
26
|
import { Step } from '../dsl';
|
|
28
27
|
export declare class BrowserConsole {
|
|
29
|
-
private
|
|
28
|
+
private driver;
|
|
30
29
|
private messages;
|
|
31
30
|
_currentStep: Partial<Step>;
|
|
31
|
+
constructor(driver: Driver);
|
|
32
32
|
private consoleEventListener;
|
|
33
|
-
|
|
33
|
+
private pageErrorEventListener;
|
|
34
|
+
private enforceMessagesLimit;
|
|
34
35
|
start(): void;
|
|
35
36
|
stop(): BrowserMessage[];
|
|
36
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-console.d.ts","sourceRoot":"","sources":["../../src/plugins/browser-console.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"browser-console.d.ts","sourceRoot":"","sources":["../../src/plugins/browser-console.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAK9B,qBAAa,cAAc;IAIb,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,QAAQ,CAAwB;IACxC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAQ;gBAEf,MAAM,EAAE,MAAM;IAElC,OAAO,CAAC,oBAAoB,CAgB1B;IAEF,OAAO,CAAC,sBAAsB,CAc5B;IAEF,OAAO,CAAC,oBAAoB;IAM5B,KAAK;IAKL,IAAI;CAKL"}
|
|
@@ -28,34 +28,54 @@ exports.BrowserConsole = void 0;
|
|
|
28
28
|
const helpers_1 = require("../helpers");
|
|
29
29
|
const defaultMessageLimit = 1000;
|
|
30
30
|
class BrowserConsole {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
driver;
|
|
32
|
+
messages = [];
|
|
33
|
+
_currentStep = null;
|
|
34
|
+
constructor(driver) {
|
|
35
|
+
this.driver = driver;
|
|
36
|
+
}
|
|
37
|
+
consoleEventListener = msg => {
|
|
38
|
+
if (!this._currentStep) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const type = msg.type();
|
|
42
|
+
if (type === 'error' || type === 'warning') {
|
|
43
|
+
const { name, index } = this._currentStep;
|
|
44
|
+
this.messages.push({
|
|
45
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
46
|
+
text: msg.text(),
|
|
47
|
+
type,
|
|
48
|
+
step: { name, index },
|
|
49
|
+
});
|
|
50
|
+
this.enforceMessagesLimit();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
pageErrorEventListener = (error) => {
|
|
54
|
+
if (!this._currentStep) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const { name, index } = this._currentStep;
|
|
58
|
+
this.messages.push({
|
|
59
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
60
|
+
text: error.message,
|
|
61
|
+
type: 'error',
|
|
62
|
+
step: { name, index },
|
|
63
|
+
error,
|
|
64
|
+
});
|
|
65
|
+
this.enforceMessagesLimit();
|
|
66
|
+
};
|
|
67
|
+
enforceMessagesLimit() {
|
|
68
|
+
if (this.messages.length > defaultMessageLimit) {
|
|
69
|
+
this.messages.splice(0, 1);
|
|
70
|
+
}
|
|
53
71
|
}
|
|
54
72
|
start() {
|
|
55
|
-
this.page.on('console', this.consoleEventListener);
|
|
73
|
+
this.driver.page.on('console', this.consoleEventListener);
|
|
74
|
+
this.driver.page.on('pageerror', this.pageErrorEventListener);
|
|
56
75
|
}
|
|
57
76
|
stop() {
|
|
58
|
-
this.page.off('console', this.consoleEventListener);
|
|
77
|
+
this.driver.page.off('console', this.consoleEventListener);
|
|
78
|
+
this.driver.page.off('pageerror', this.pageErrorEventListener);
|
|
59
79
|
return this.messages;
|
|
60
80
|
}
|
|
61
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-console.js","sourceRoot":"","sources":["../../src/plugins/browser-console.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;
|
|
1
|
+
{"version":3,"file":"browser-console.js","sourceRoot":"","sources":["../../src/plugins/browser-console.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAIH,wCAA0C;AAE1C,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAa,cAAc;IAIL;IAHZ,QAAQ,GAAqB,EAAE,CAAC;IACxC,YAAY,GAAkB,IAAI,CAAC;IAEnC,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE9B,oBAAoB,GAAG,GAAG,CAAC,EAAE;QACnC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,OAAO;SACR;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,SAAS,EAAE;YAC1C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;YAC1C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACjB,SAAS,EAAE,IAAA,sBAAY,GAAE;gBACzB,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE;gBAChB,IAAI;gBACJ,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;aACtB,CAAC,CAAC;YAEH,IAAI,CAAC,oBAAoB,EAAE,CAAC;SAC7B;IACH,CAAC,CAAC;IAEM,sBAAsB,GAAG,CAAC,KAAY,EAAE,EAAE;QAChD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,OAAO;SACR;QACD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,SAAS,EAAE,IAAA,sBAAY,GAAE;YACzB,IAAI,EAAE,KAAK,CAAC,OAAO;YACnB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YACrB,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC,CAAC;IAEM,oBAAoB;QAC1B,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE;YAC9C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC5B;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAChE,CAAC;IAED,IAAI;QACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAxDD,wCAwDC"}
|
package/dist/plugins/index.js
CHANGED
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
*/
|
|
26
26
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
27
|
if (k2 === undefined) k2 = k;
|
|
28
|
-
Object.
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
29
33
|
}) : (function(o, m, k, k2) {
|
|
30
34
|
if (k2 === undefined) k2 = k;
|
|
31
35
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;AAEH,mDAAiC;AACjC,4CAA0B;AAC1B,gDAA8B;AAC9B,4CAA0B;AAC1B,oDAAkC"}
|
|
@@ -22,45 +22,32 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
import { Protocol } from 'playwright-chromium/types/protocol';
|
|
27
|
-
import { NetworkInfo } from '../common_types';
|
|
25
|
+
import { NetworkInfo, Driver } from '../common_types';
|
|
28
26
|
import { Step } from '../dsl';
|
|
27
|
+
/**
|
|
28
|
+
* Used as a key in each Network Request to identify the
|
|
29
|
+
* associated request across distinct lifecycle events
|
|
30
|
+
*/
|
|
31
|
+
export declare const NETWORK_ENTRY_SUMBOL: unique symbol;
|
|
29
32
|
export declare class NetworkManager {
|
|
33
|
+
private driver;
|
|
30
34
|
private _browser;
|
|
31
|
-
private
|
|
35
|
+
private _barrierPromises;
|
|
32
36
|
results: Array<NetworkInfo>;
|
|
33
37
|
_currentStep: Partial<Step>;
|
|
34
|
-
|
|
35
|
-
_findNetworkRecord(requestId: string): NetworkInfo;
|
|
36
|
-
_onRequestWillBeSent(event: Protocol.Network.requestWillBeSentPayload): void;
|
|
37
|
-
_onRequestWillBeSentExtraInfo(event: Protocol.Network.requestWillBeSentExtraInfoPayload): void;
|
|
38
|
-
_onDataReceived(event: Protocol.Network.dataReceivedPayload): void;
|
|
39
|
-
_onResponseReceived(event: Protocol.Network.responseReceivedPayload): void;
|
|
40
|
-
_onLoadingFinished(event: Protocol.Network.loadingFinishedPayload): void;
|
|
41
|
-
_onLoadingFailed(event: Protocol.Network.loadingFailedPayload): void;
|
|
42
|
-
_requestCompleted(requestId: string, endTime: number, encodedDataLength?: number): void;
|
|
43
|
-
/**
|
|
44
|
-
* Account for missing response received event and also adjust the
|
|
45
|
-
* response received event based on when first byte event was recorded
|
|
46
|
-
*/
|
|
47
|
-
getResponseReceivedTime(timing: Protocol.Network.Response['timing'], responseReceivedTime: number): number;
|
|
38
|
+
constructor(driver: Driver);
|
|
48
39
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
40
|
+
* Adds a protection barrier aganist all asynchronous extract operations from
|
|
41
|
+
* request/response object that are happening during page lifecycle, If the
|
|
42
|
+
* page is closed during the extraction, the barrier enforces those operations
|
|
43
|
+
* to not result in exception
|
|
51
44
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
send: number;
|
|
60
|
-
wait: number;
|
|
61
|
-
receive: number;
|
|
62
|
-
total: number;
|
|
63
|
-
};
|
|
64
|
-
stop(): NetworkInfo[];
|
|
45
|
+
private _addBarrier;
|
|
46
|
+
start(): Promise<void>;
|
|
47
|
+
private _findNetworkEntry;
|
|
48
|
+
private _onRequest;
|
|
49
|
+
private _onResponse;
|
|
50
|
+
private _onRequestCompleted;
|
|
51
|
+
stop(): Promise<NetworkInfo[]>;
|
|
65
52
|
}
|
|
66
53
|
//# sourceMappingURL=network.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/plugins/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/plugins/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,WAAW,EAAe,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAY9B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,eAA6B,CAAC;AAM/D,qBAAa,cAAc;IAMb,OAAO,CAAC,MAAM;IAL1B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAM;IACjC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAQ;gBAEf,MAAM,EAAE,MAAM;IAElC;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAeb,KAAK;IAeX,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,UAAU;YAgDJ,WAAW;YAgDX,mBAAmB;IAoG3B,IAAI;CAUX"}
|