@elastic/synthetics 1.0.0-beta.23 → 1.0.0-beta.26
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 +1 -1
- package/dist/cli.js +42 -5
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +62 -14
- package/dist/common_types.d.ts.map +1 -1
- package/dist/core/gatherer.d.ts +2 -2
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +14 -5
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +15 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/runner.d.ts +10 -58
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +89 -50
- package/dist/core/runner.js.map +1 -1
- package/dist/dsl/journey.d.ts +3 -0
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +15 -0
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/monitor.d.ts +64 -0
- package/dist/dsl/monitor.d.ts.map +1 -0
- package/dist/dsl/monitor.js +62 -0
- package/dist/dsl/monitor.js.map +1 -0
- package/dist/formatter/javascript.d.ts +1 -1
- package/dist/formatter/javascript.d.ts.map +1 -1
- package/dist/formatter/javascript.js +1 -1
- package/dist/formatter/javascript.js.map +1 -1
- package/dist/generator/index.d.ts +13 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +123 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/{reporters/reporter.js → generator/utils.d.ts} +3 -3
- package/dist/generator/utils.d.ts.map +1 -0
- package/dist/generator/utils.js +44 -0
- package/dist/generator/utils.js.map +1 -0
- package/dist/helpers.d.ts +12 -6
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +33 -43
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +3 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/loader.js +4 -4
- package/dist/loader.js.map +1 -1
- package/dist/options.d.ts +12 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +66 -4
- package/dist/options.js.map +1 -1
- package/dist/plugins/network.d.ts +17 -30
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +179 -244
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +1 -16
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +2 -2
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +2 -2
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/push/bundler.d.ts +34 -0
- package/dist/push/bundler.d.ts.map +1 -0
- package/dist/push/bundler.js +119 -0
- package/dist/push/bundler.js.map +1 -0
- package/{src/reporters/reporter.ts → dist/push/index.d.ts} +4 -11
- package/dist/push/index.d.ts.map +1 -0
- package/dist/push/index.js +58 -0
- package/dist/push/index.js.map +1 -0
- package/dist/{reporters/reporter.d.ts → push/monitor.d.ts} +7 -8
- package/dist/push/monitor.d.ts.map +1 -0
- package/dist/push/monitor.js +67 -0
- package/dist/push/monitor.js.map +1 -0
- package/dist/push/plugin.d.ts +33 -0
- package/dist/push/plugin.d.ts.map +1 -0
- package/dist/push/plugin.js +123 -0
- package/dist/push/plugin.js.map +1 -0
- package/dist/push/request.d.ts +43 -0
- package/dist/push/request.d.ts.map +1 -0
- package/dist/push/request.js +95 -0
- package/dist/push/request.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 +45 -47
- 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 +7 -4
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +119 -137
- 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 +91 -86
- package/dist/reporters/junit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -9
- package/src/cli.ts +65 -9
- package/src/common_types.ts +72 -14
- package/src/core/gatherer.ts +18 -10
- package/src/core/index.ts +15 -0
- package/src/core/runner.ts +87 -114
- package/src/dsl/journey.ts +18 -0
- package/src/dsl/monitor.ts +83 -0
- package/src/formatter/javascript.ts +1 -1
- package/src/generator/index.ts +159 -0
- package/src/generator/utils.ts +41 -0
- package/src/helpers.ts +36 -52
- package/src/index.ts +10 -2
- package/src/loader.ts +4 -4
- package/src/options.ts +71 -8
- package/src/plugins/network.ts +218 -293
- package/src/plugins/performance.ts +1 -17
- package/src/plugins/plugin-manager.ts +2 -2
- package/src/push/bundler.ts +99 -0
- package/src/push/index.ts +63 -0
- package/src/push/monitor.ts +77 -0
- package/src/push/plugin.ts +113 -0
- package/src/push/request.ts +123 -0
- package/src/reporters/base.ts +57 -56
- package/src/reporters/index.ts +26 -3
- package/src/reporters/json.ts +154 -162
- package/src/reporters/junit.ts +98 -93
- package/templates/journeys/example.journey.ts +18 -0
- package/templates/synthetics.config.ts +19 -0
- package/CHANGELOG.md +0 -339
- package/NOTICE.txt +0 -250
- package/dist/reporters/reporter.d.ts.map +0 -1
- package/dist/reporters/reporter.js.map +0 -1
package/dist/options.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.normalizeOptions = void 0;
|
|
30
|
+
exports.parseThrottling = exports.getDefaultMonitorConfig = exports.normalizeOptions = void 0;
|
|
31
31
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
32
32
|
const config_1 = require("./config");
|
|
33
33
|
const helpers_1 = require("./helpers");
|
|
@@ -86,10 +86,13 @@ function normalizeOptions(cliArgs) {
|
|
|
86
86
|
const config = cliArgs.config || !cliArgs.inline
|
|
87
87
|
? (0, config_1.readConfig)(options.environment, cliArgs.config)
|
|
88
88
|
: {};
|
|
89
|
-
options.params = Object.freeze((0, deepmerge_1.default)(config.params, cliArgs.params || {}));
|
|
90
89
|
/**
|
|
91
|
-
*
|
|
90
|
+
* Order of preference for options that are used while running are
|
|
91
|
+
* 1. Local options configured via Runner API
|
|
92
|
+
* 2. CLI flags
|
|
93
|
+
* 3. Configuration file
|
|
92
94
|
*/
|
|
95
|
+
options.params = Object.freeze((0, deepmerge_1.default)(config.params, cliArgs.params || {}));
|
|
93
96
|
options.playwrightOptions = deepmerge_1.default.all([
|
|
94
97
|
config.playwrightOptions || {},
|
|
95
98
|
cliArgs.playwrightOptions || {},
|
|
@@ -99,10 +102,69 @@ function normalizeOptions(cliArgs) {
|
|
|
99
102
|
ignoreHTTPSErrors: cliArgs.ignoreHttpsErrors,
|
|
100
103
|
},
|
|
101
104
|
]);
|
|
105
|
+
const defaults = getDefaultMonitorConfig();
|
|
102
106
|
if (cliArgs.throttling) {
|
|
103
|
-
|
|
107
|
+
const throttleConfig = deepmerge_1.default.all([
|
|
108
|
+
defaults.throttling,
|
|
109
|
+
config.monitor?.throttling || {},
|
|
110
|
+
cliArgs.throttling,
|
|
111
|
+
]);
|
|
112
|
+
options.throttling = throttleConfig;
|
|
113
|
+
options.networkConditions = (0, helpers_1.getNetworkConditions)(throttleConfig);
|
|
104
114
|
}
|
|
115
|
+
else {
|
|
116
|
+
/**
|
|
117
|
+
* Do not apply throttling when `--no-throttling` flag is passed
|
|
118
|
+
*/
|
|
119
|
+
options.throttling = {};
|
|
120
|
+
}
|
|
121
|
+
options.locations =
|
|
122
|
+
cliArgs.locations ?? config.monitor?.locations ?? defaults.locations;
|
|
123
|
+
options.schedule =
|
|
124
|
+
cliArgs.schedule ?? config.monitor?.schedule ?? defaults.schedule;
|
|
105
125
|
return options;
|
|
106
126
|
}
|
|
107
127
|
exports.normalizeOptions = normalizeOptions;
|
|
128
|
+
/**
|
|
129
|
+
* Get the default monitor configuration for all journeys
|
|
130
|
+
*/
|
|
131
|
+
function getDefaultMonitorConfig() {
|
|
132
|
+
return {
|
|
133
|
+
throttling: helpers_1.DEFAULT_THROTTLING_OPTIONS,
|
|
134
|
+
locations: ['US East'],
|
|
135
|
+
schedule: 10,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
exports.getDefaultMonitorConfig = getDefaultMonitorConfig;
|
|
139
|
+
/**
|
|
140
|
+
* Parses the throttling CLI settings and also
|
|
141
|
+
* adapts to the format to keep the backwards compatability
|
|
142
|
+
* - Accepts old format `<5d/3u/20l>`
|
|
143
|
+
* - Processess new format otherwise `{download: 5, upload: 3, latency: 20}`
|
|
144
|
+
*/
|
|
145
|
+
function parseThrottling(value, prev) {
|
|
146
|
+
const THROTTLING_REGEX = /([0-9]{1,}u)|([0-9]{1,}d)|([0-9]{1,}l)/gm;
|
|
147
|
+
if (THROTTLING_REGEX.test(value)) {
|
|
148
|
+
const throttling = {};
|
|
149
|
+
const conditions = value.split('/');
|
|
150
|
+
conditions.forEach(condition => {
|
|
151
|
+
const setting = condition.slice(0, condition.length - 1);
|
|
152
|
+
const token = condition.slice(-1);
|
|
153
|
+
switch (token) {
|
|
154
|
+
case 'd':
|
|
155
|
+
throttling.download = Number(setting);
|
|
156
|
+
break;
|
|
157
|
+
case 'u':
|
|
158
|
+
throttling.upload = Number(setting);
|
|
159
|
+
break;
|
|
160
|
+
case 'l':
|
|
161
|
+
throttling.latency = Number(setting);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return throttling;
|
|
166
|
+
}
|
|
167
|
+
return JSON.parse(value || prev);
|
|
168
|
+
}
|
|
169
|
+
exports.parseThrottling = parseThrottling;
|
|
108
170
|
//# sourceMappingURL=options.js.map
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,0DAA8B;AAC9B,qCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"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"}
|
|
@@ -22,45 +22,32 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import { Protocol } from 'playwright-chromium/types/protocol';
|
|
26
25
|
import { NetworkInfo, Driver } from '../common_types';
|
|
27
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;
|
|
28
32
|
export declare class NetworkManager {
|
|
29
33
|
private driver;
|
|
30
34
|
private _browser;
|
|
31
|
-
private
|
|
35
|
+
private _barrierPromises;
|
|
32
36
|
results: Array<NetworkInfo>;
|
|
33
37
|
_currentStep: Partial<Step>;
|
|
34
38
|
constructor(driver: Driver);
|
|
35
|
-
start(): Promise<void>;
|
|
36
|
-
_findNetworkRecord(requestId: string): NetworkInfo;
|
|
37
|
-
_onRequestWillBeSent(event: Protocol.Network.requestWillBeSentPayload): void;
|
|
38
|
-
_onRequestWillBeSentExtraInfo(event: Protocol.Network.requestWillBeSentExtraInfoPayload): void;
|
|
39
|
-
_onDataReceived(event: Protocol.Network.dataReceivedPayload): void;
|
|
40
|
-
_onResponseReceived(event: Protocol.Network.responseReceivedPayload): void;
|
|
41
|
-
_onLoadingFinished(event: Protocol.Network.loadingFinishedPayload): void;
|
|
42
|
-
_onLoadingFailed(event: Protocol.Network.loadingFailedPayload): void;
|
|
43
|
-
_requestCompleted(requestId: string, endTime: number, encodedDataLength?: number): void;
|
|
44
39
|
/**
|
|
45
|
-
*
|
|
46
|
-
* response
|
|
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
|
|
47
44
|
*/
|
|
48
|
-
|
|
45
|
+
private _addBarrier;
|
|
46
|
+
start(): Promise<void>;
|
|
47
|
+
private _findNetworkEntry;
|
|
48
|
+
private _onRequest;
|
|
49
|
+
private _onResponse;
|
|
50
|
+
private _onRequestCompleted;
|
|
51
|
+
stop(): Promise<NetworkInfo[]>;
|
|
49
52
|
}
|
|
50
|
-
/**
|
|
51
|
-
* The timing calculations are based on the chrome devtools frontend
|
|
52
|
-
* https://github.com/ChromeDevTools/devtools-frontend/blob/7f5478d8ceb7586f23f4073ab5c2085dac1ec26a/front_end/network/RequestTimingView.js#L98-L193
|
|
53
|
-
*/
|
|
54
|
-
export declare function calculateTimings(record: NetworkInfo): {
|
|
55
|
-
blocked: number;
|
|
56
|
-
queueing: number;
|
|
57
|
-
dns: number;
|
|
58
|
-
ssl: number;
|
|
59
|
-
proxy: number;
|
|
60
|
-
connect: number;
|
|
61
|
-
send: number;
|
|
62
|
-
wait: number;
|
|
63
|
-
receive: number;
|
|
64
|
-
total: number;
|
|
65
|
-
};
|
|
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"}
|
package/dist/plugins/network.js
CHANGED
|
@@ -24,299 +24,234 @@
|
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.
|
|
27
|
+
exports.NetworkManager = exports.NETWORK_ENTRY_SUMBOL = void 0;
|
|
28
28
|
const helpers_1 = require("../helpers");
|
|
29
|
+
/**
|
|
30
|
+
* Kibana UI expects the requestStartTime and loadEndTime to be baseline
|
|
31
|
+
* in seconds as they have the logic to convert it to milliseconds before
|
|
32
|
+
* using for offset calculation
|
|
33
|
+
*/
|
|
34
|
+
function epochTimeInSeconds() {
|
|
35
|
+
return (0, helpers_1.getTimestamp)() / 1e6;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Used as a key in each Network Request to identify the
|
|
39
|
+
* associated request across distinct lifecycle events
|
|
40
|
+
*/
|
|
41
|
+
exports.NETWORK_ENTRY_SUMBOL = Symbol.for('NetworkEntry');
|
|
29
42
|
class NetworkManager {
|
|
30
43
|
constructor(driver) {
|
|
31
44
|
this.driver = driver;
|
|
32
|
-
this.
|
|
45
|
+
this._barrierPromises = new Set();
|
|
33
46
|
this.results = [];
|
|
34
47
|
this._currentStep = null;
|
|
35
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Adds a protection barrier aganist all asynchronous extract operations from
|
|
51
|
+
* request/response object that are happening during page lifecycle, If the
|
|
52
|
+
* page is closed during the extraction, the barrier enforces those operations
|
|
53
|
+
* to not result in exception
|
|
54
|
+
*/
|
|
55
|
+
_addBarrier(page, promise) {
|
|
56
|
+
if (!page)
|
|
57
|
+
return;
|
|
58
|
+
const race = Promise.race([
|
|
59
|
+
new Promise(resolve => page.on('close', () => {
|
|
60
|
+
this._barrierPromises.delete(race);
|
|
61
|
+
resolve();
|
|
62
|
+
})),
|
|
63
|
+
promise,
|
|
64
|
+
]);
|
|
65
|
+
this._barrierPromises.add(race);
|
|
66
|
+
race.then(() => this._barrierPromises.delete(race));
|
|
67
|
+
}
|
|
36
68
|
async start() {
|
|
37
|
-
const { client } = this.driver;
|
|
69
|
+
const { client, context } = this.driver;
|
|
38
70
|
const { product } = await client.send('Browser.getVersion');
|
|
39
71
|
const [name, version] = product.split('/');
|
|
40
72
|
this._browser = { name, version };
|
|
41
73
|
await client.send('Network.enable');
|
|
42
74
|
/**
|
|
43
|
-
* Listen for all network events
|
|
75
|
+
* Listen for all network events from PW context
|
|
44
76
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
client.on('Network.loadingFinished', this._onLoadingFinished.bind(this));
|
|
50
|
-
client.on('Network.loadingFailed', this._onLoadingFailed.bind(this));
|
|
77
|
+
context.on('request', this._onRequest.bind(this));
|
|
78
|
+
context.on('response', this._onResponse.bind(this));
|
|
79
|
+
context.on('requestfinished', this._onRequestCompleted.bind(this));
|
|
80
|
+
context.on('requestfailed', this._onRequestCompleted.bind(this));
|
|
51
81
|
}
|
|
52
|
-
|
|
53
|
-
return
|
|
82
|
+
_findNetworkEntry(request) {
|
|
83
|
+
return request[exports.NETWORK_ENTRY_SUMBOL];
|
|
54
84
|
}
|
|
55
|
-
|
|
56
|
-
const
|
|
85
|
+
_onRequest(request) {
|
|
86
|
+
const url = request.url();
|
|
57
87
|
/**
|
|
58
88
|
* Data URI should not show up as network requests
|
|
59
89
|
*/
|
|
60
90
|
if (url.startsWith('data:')) {
|
|
61
91
|
return;
|
|
62
92
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const record = this._findNetworkRecord(requestId);
|
|
66
|
-
/**
|
|
67
|
-
* On redirects, another `requestWillBeSent` event will be fired for the
|
|
68
|
-
* same requestId. We calculate the timings for the redirect request using
|
|
69
|
-
* the `redirectedResponse` from the redirected request.
|
|
70
|
-
*/
|
|
71
|
-
if (record) {
|
|
72
|
-
if (event.redirectResponse) {
|
|
73
|
-
record.response.redirectURL = url;
|
|
74
|
-
const response = event.redirectResponse;
|
|
75
|
-
const data = Object.assign(event, {
|
|
76
|
-
type: event.type,
|
|
77
|
-
response,
|
|
78
|
-
encodedDataLength: response.encodedDataLength,
|
|
79
|
-
});
|
|
80
|
-
this._onResponseReceived(data);
|
|
81
|
-
this._onLoadingFinished(data);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
/**
|
|
85
|
-
* Edge case, we handle it to proceed with next navigation
|
|
86
|
-
*/
|
|
87
|
-
this._onLoadingFailed(Object.assign(event, {
|
|
88
|
-
type: event.type,
|
|
89
|
-
errorText: 'redirectResponse data is not available',
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
const redirectedRecord = this._findNetworkRecord(requestId);
|
|
93
|
-
/**
|
|
94
|
-
* Rewrite the map with new redirect id to not reset
|
|
95
|
-
* the redirect request with original request
|
|
96
|
-
*/
|
|
97
|
-
this._InflightRequestMap.delete(requestId);
|
|
98
|
-
this._InflightRequestMap.set(`redirect:${timestamp}:${requestId}`, redirectedRecord);
|
|
99
|
-
}
|
|
100
|
-
this._InflightRequestMap.set(requestId, {
|
|
93
|
+
const timestamp = (0, helpers_1.getTimestamp)();
|
|
94
|
+
const networkEntry = {
|
|
101
95
|
browser: this._browser,
|
|
102
96
|
step: this._currentStep,
|
|
103
|
-
timestamp
|
|
97
|
+
timestamp,
|
|
104
98
|
url,
|
|
105
|
-
type,
|
|
99
|
+
type: request.resourceType(),
|
|
106
100
|
request: {
|
|
107
101
|
url,
|
|
108
|
-
method,
|
|
109
|
-
headers,
|
|
110
|
-
|
|
102
|
+
method: request.method(),
|
|
103
|
+
headers: {},
|
|
104
|
+
body: {
|
|
105
|
+
bytes: request.postDataBuffer()?.length || 0,
|
|
106
|
+
},
|
|
111
107
|
},
|
|
112
108
|
response: {
|
|
113
109
|
status: -1,
|
|
114
|
-
mimeType: 'x-unknown',
|
|
115
110
|
headers: {},
|
|
116
|
-
|
|
111
|
+
mimeType: 'x-unknown',
|
|
112
|
+
redirectURL: '',
|
|
117
113
|
},
|
|
118
|
-
isNavigationRequest,
|
|
119
|
-
requestSentTime:
|
|
120
|
-
responseReceivedTime: -1,
|
|
114
|
+
isNavigationRequest: request.isNavigationRequest(),
|
|
115
|
+
requestSentTime: epochTimeInSeconds(),
|
|
121
116
|
loadEndTime: -1,
|
|
117
|
+
responseReceivedTime: -1,
|
|
122
118
|
resourceSize: 0,
|
|
123
119
|
transferSize: 0,
|
|
124
120
|
timings: null,
|
|
125
|
-
}
|
|
121
|
+
};
|
|
122
|
+
if (request.redirectedFrom()) {
|
|
123
|
+
const fromEntry = this._findNetworkEntry(request.redirectedFrom());
|
|
124
|
+
if (fromEntry)
|
|
125
|
+
fromEntry.response.redirectURL = request.url();
|
|
126
|
+
}
|
|
127
|
+
request[exports.NETWORK_ENTRY_SUMBOL] = networkEntry;
|
|
128
|
+
this.results.push(networkEntry);
|
|
126
129
|
}
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
130
|
+
async _onResponse(response) {
|
|
131
|
+
const request = response.request();
|
|
132
|
+
const networkEntry = this._findNetworkEntry(request);
|
|
133
|
+
if (!networkEntry)
|
|
131
134
|
return;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
networkEntry.responseReceivedTime = epochTimeInSeconds();
|
|
136
|
+
networkEntry.response = {
|
|
137
|
+
url: response.url(),
|
|
138
|
+
status: response.status(),
|
|
139
|
+
statusText: response.statusText(),
|
|
140
|
+
headers: {},
|
|
141
|
+
mimeType: 'x-unknown',
|
|
142
|
+
redirectURL: networkEntry.response.redirectURL,
|
|
139
143
|
};
|
|
140
|
-
|
|
144
|
+
const page = request.frame().page();
|
|
145
|
+
this._addBarrier(page, request.allHeaders().then(reqHeaders => {
|
|
146
|
+
networkEntry.request.headers = reqHeaders;
|
|
147
|
+
networkEntry.request.referrer = reqHeaders?.referer;
|
|
148
|
+
}));
|
|
149
|
+
this._addBarrier(page, response.serverAddr().then(server => {
|
|
150
|
+
networkEntry.response.remoteIPAddress = server?.ipAddress;
|
|
151
|
+
networkEntry.response.remotePort = server?.port;
|
|
152
|
+
}));
|
|
153
|
+
this._addBarrier(page, response.securityDetails().then(details => {
|
|
154
|
+
if (details)
|
|
155
|
+
networkEntry.response.securityDetails = details;
|
|
156
|
+
}));
|
|
157
|
+
this._addBarrier(page, response.allHeaders().then(resHeaders => {
|
|
158
|
+
networkEntry.response.headers = resHeaders;
|
|
159
|
+
const contentType = resHeaders['content-type'];
|
|
160
|
+
if (contentType)
|
|
161
|
+
networkEntry.response.mimeType = contentType.split(';')[0];
|
|
162
|
+
}));
|
|
141
163
|
}
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
if (!record) {
|
|
164
|
+
async _onRequestCompleted(request) {
|
|
165
|
+
const networkEntry = this._findNetworkEntry(request);
|
|
166
|
+
if (!networkEntry)
|
|
146
167
|
return;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
168
|
+
networkEntry.loadEndTime = epochTimeInSeconds();
|
|
169
|
+
const timing = request.timing();
|
|
170
|
+
const { loadEndTime, requestSentTime } = networkEntry;
|
|
171
|
+
networkEntry.timings = {
|
|
172
|
+
blocked: -1,
|
|
173
|
+
dns: -1,
|
|
174
|
+
ssl: -1,
|
|
175
|
+
connect: -1,
|
|
176
|
+
send: -1,
|
|
177
|
+
wait: -1,
|
|
178
|
+
receive: -1,
|
|
179
|
+
total: -1,
|
|
180
|
+
};
|
|
181
|
+
const firstPositive = (numbers) => {
|
|
182
|
+
for (let i = 0; i < numbers.length; ++i) {
|
|
183
|
+
if (numbers[i] > 0) {
|
|
184
|
+
return numbers[i];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
};
|
|
189
|
+
const roundMilliSecs = (value) => {
|
|
190
|
+
return Math.floor(value * 1000) / 1000;
|
|
191
|
+
};
|
|
192
|
+
if (timing.startTime === 0) {
|
|
193
|
+
// Convert to milliseconds before round off
|
|
194
|
+
const total = roundMilliSecs((loadEndTime - requestSentTime) * 1000);
|
|
195
|
+
networkEntry.timings.total = total;
|
|
156
196
|
return;
|
|
157
197
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
198
|
+
const blocked = roundMilliSecs(firstPositive([
|
|
199
|
+
timing.domainLookupStart,
|
|
200
|
+
timing.connectStart,
|
|
201
|
+
timing.requestStart,
|
|
202
|
+
])) || -1;
|
|
203
|
+
const dns = timing.domainLookupEnd !== -1
|
|
204
|
+
? roundMilliSecs(timing.domainLookupEnd - timing.domainLookupStart)
|
|
205
|
+
: -1;
|
|
206
|
+
const connect = timing.connectEnd !== -1
|
|
207
|
+
? roundMilliSecs(timing.connectEnd - timing.connectStart)
|
|
208
|
+
: -1;
|
|
209
|
+
const ssl = timing.secureConnectionStart !== -1
|
|
210
|
+
? roundMilliSecs(timing.connectEnd - timing.secureConnectionStart)
|
|
211
|
+
: -1;
|
|
212
|
+
const wait = timing.responseStart !== -1
|
|
213
|
+
? roundMilliSecs(timing.responseStart - timing.requestStart)
|
|
214
|
+
: -1;
|
|
215
|
+
const receive = timing.responseEnd !== -1
|
|
216
|
+
? roundMilliSecs(timing.responseEnd - timing.responseStart)
|
|
217
|
+
: -1;
|
|
218
|
+
const total = [blocked, dns, connect, wait, receive].reduce((pre, cur) => (cur > 0 ? cur + pre : pre), 0);
|
|
219
|
+
networkEntry.timings = {
|
|
220
|
+
blocked,
|
|
221
|
+
dns,
|
|
222
|
+
connect,
|
|
223
|
+
ssl,
|
|
224
|
+
wait,
|
|
225
|
+
send: 0,
|
|
226
|
+
receive,
|
|
227
|
+
total,
|
|
172
228
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
229
|
+
const page = request.frame().page();
|
|
230
|
+
// For aborted/failed requests sizes will not be present
|
|
231
|
+
this._addBarrier(page, request.sizes().then(sizes => {
|
|
232
|
+
networkEntry.request.bytes =
|
|
233
|
+
sizes.requestHeadersSize + sizes.requestBodySize;
|
|
234
|
+
networkEntry.request.body = {
|
|
235
|
+
bytes: sizes.requestBodySize,
|
|
180
236
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this._requestCompleted(requestId, timestamp, encodedDataLength);
|
|
186
|
-
}
|
|
187
|
-
_onLoadingFailed(event) {
|
|
188
|
-
const { requestId, timestamp } = event;
|
|
189
|
-
this._requestCompleted(requestId, timestamp);
|
|
190
|
-
}
|
|
191
|
-
_requestCompleted(requestId, endTime, encodedDataLength) {
|
|
192
|
-
const record = this._findNetworkRecord(requestId);
|
|
193
|
-
if (!record) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (encodedDataLength >= 0) {
|
|
197
|
-
record.transferSize = encodedDataLength;
|
|
198
|
-
record.response.body = {
|
|
199
|
-
bytes: encodedDataLength,
|
|
237
|
+
networkEntry.response.bytes =
|
|
238
|
+
sizes.responseHeadersSize + sizes.responseBodySize;
|
|
239
|
+
networkEntry.response.body = {
|
|
240
|
+
bytes: sizes.responseBodySize,
|
|
200
241
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
record.timings = calculateTimings(record);
|
|
204
|
-
this.results.push(record);
|
|
205
|
-
/**
|
|
206
|
-
* When there is DNS failure, browsers keeps retrying requests which
|
|
207
|
-
* might result in incorrect timings so we get remove them to measure only once
|
|
208
|
-
*/
|
|
209
|
-
this._InflightRequestMap.delete(requestId);
|
|
242
|
+
networkEntry.transferSize = sizes.responseBodySize;
|
|
243
|
+
}));
|
|
210
244
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
245
|
+
async stop() {
|
|
246
|
+
await Promise.all(this._barrierPromises);
|
|
247
|
+
const context = this.driver.context;
|
|
248
|
+
context.off('request', this._onRequest.bind(this));
|
|
249
|
+
context.off('response', this._onResponse.bind(this));
|
|
250
|
+
context.off('requestfinished', this._onRequestCompleted.bind(this));
|
|
251
|
+
context.off('requestfailed', this._onRequestCompleted.bind(this));
|
|
252
|
+
this._barrierPromises.clear();
|
|
216
253
|
return this.results;
|
|
217
254
|
}
|
|
218
255
|
}
|
|
219
256
|
exports.NetworkManager = NetworkManager;
|
|
220
|
-
function getResponseReceivedTime(timing, responseReceivedTime) {
|
|
221
|
-
if (timing == null) {
|
|
222
|
-
return responseReceivedTime;
|
|
223
|
-
}
|
|
224
|
-
const startTime = timing.requestTime;
|
|
225
|
-
const headersReceivedTime = startTime + timing.receiveHeadersEnd / 1000;
|
|
226
|
-
if (responseReceivedTime < 0 || responseReceivedTime > headersReceivedTime) {
|
|
227
|
-
responseReceivedTime = headersReceivedTime;
|
|
228
|
-
}
|
|
229
|
-
if (startTime > responseReceivedTime) {
|
|
230
|
-
responseReceivedTime = startTime;
|
|
231
|
-
}
|
|
232
|
-
return responseReceivedTime;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* The timing calculations are based on the chrome devtools frontend
|
|
236
|
-
* https://github.com/ChromeDevTools/devtools-frontend/blob/7f5478d8ceb7586f23f4073ab5c2085dac1ec26a/front_end/network/RequestTimingView.js#L98-L193
|
|
237
|
-
*/
|
|
238
|
-
function calculateTimings(record) {
|
|
239
|
-
const result = {
|
|
240
|
-
blocked: -1,
|
|
241
|
-
queueing: -1,
|
|
242
|
-
proxy: -1,
|
|
243
|
-
dns: -1,
|
|
244
|
-
ssl: -1,
|
|
245
|
-
connect: -1,
|
|
246
|
-
send: -1,
|
|
247
|
-
wait: -1,
|
|
248
|
-
receive: -1,
|
|
249
|
-
total: -1,
|
|
250
|
-
};
|
|
251
|
-
const toMilliseconds = (time) => (time === -1 ? -1 : time * 1000);
|
|
252
|
-
const calculateDiffInMs = (name, start, end) => {
|
|
253
|
-
if (start < Number.MAX_VALUE && start <= end) {
|
|
254
|
-
result[name] = toMilliseconds(end - start);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
const firstPositive = (numbers) => {
|
|
258
|
-
for (let i = 0; i < numbers.length; ++i) {
|
|
259
|
-
if (numbers[i] > 0) {
|
|
260
|
-
return numbers[i];
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return null;
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* requestTime is baseline in seconds, rest of the timing data are ticks in milliseconds
|
|
267
|
-
* from the requestTime, so we calculate the offset from that
|
|
268
|
-
*/
|
|
269
|
-
const addOffsetRange = (name, start, end) => {
|
|
270
|
-
if (start >= 0 && end >= 0) {
|
|
271
|
-
calculateDiffInMs(name, startTime + start / 1000, startTime + end / 1000);
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
const { requestSentTime, loadEndTime, responseReceivedTime, response } = record;
|
|
275
|
-
const timing = response.timing;
|
|
276
|
-
const actResRcvdTime = getResponseReceivedTime(timing, responseReceivedTime);
|
|
277
|
-
const issueTime = requestSentTime;
|
|
278
|
-
const startTime = timing == null ? -1 : timing.requestTime;
|
|
279
|
-
const endTime = firstPositive([loadEndTime, actResRcvdTime]) || startTime;
|
|
280
|
-
if (timing == null) {
|
|
281
|
-
const start = issueTime !== -1 ? issueTime : startTime !== -1 ? startTime : 0;
|
|
282
|
-
const middle = actResRcvdTime === -1 ? Number.MAX_VALUE : actResRcvdTime;
|
|
283
|
-
const end = endTime === -1 ? Number.MAX_VALUE : endTime;
|
|
284
|
-
calculateDiffInMs('total', start, end);
|
|
285
|
-
calculateDiffInMs('blocked', start, middle);
|
|
286
|
-
calculateDiffInMs('receive', middle, end);
|
|
287
|
-
// Check if the request is blocked/stalled for the whole timeframe and
|
|
288
|
-
// calculate timings appropriately for that request
|
|
289
|
-
if (!isFinite(result['blocked'])) {
|
|
290
|
-
result['blocked'] = result['total'];
|
|
291
|
-
}
|
|
292
|
-
return result;
|
|
293
|
-
}
|
|
294
|
-
calculateDiffInMs('total', issueTime < startTime ? issueTime : startTime, endTime);
|
|
295
|
-
if (issueTime < startTime) {
|
|
296
|
-
calculateDiffInMs('queueing', issueTime, startTime);
|
|
297
|
-
}
|
|
298
|
-
const responseReceived = toMilliseconds(actResRcvdTime - startTime);
|
|
299
|
-
if (response.fromServiceWorker) {
|
|
300
|
-
addOffsetRange('blocked', 0, timing.workerStart);
|
|
301
|
-
addOffsetRange('wait', timing.sendEnd, responseReceived);
|
|
302
|
-
}
|
|
303
|
-
else if (!timing.pushStart) {
|
|
304
|
-
const blockingEnd = firstPositive([
|
|
305
|
-
timing.dnsStart,
|
|
306
|
-
timing.connectStart,
|
|
307
|
-
timing.sendStart,
|
|
308
|
-
responseReceived,
|
|
309
|
-
]) || 0;
|
|
310
|
-
addOffsetRange('blocked', 0, blockingEnd);
|
|
311
|
-
addOffsetRange('proxy', timing.proxyStart, timing.proxyEnd);
|
|
312
|
-
addOffsetRange('dns', timing.dnsStart, timing.dnsEnd);
|
|
313
|
-
addOffsetRange('connect', timing.connectStart, timing.connectEnd);
|
|
314
|
-
addOffsetRange('ssl', timing.sslStart, timing.sslEnd);
|
|
315
|
-
addOffsetRange('send', timing.sendStart, timing.sendEnd);
|
|
316
|
-
addOffsetRange('wait', Math.max(timing.sendEnd, timing.connectEnd, timing.dnsEnd, timing.proxyEnd, blockingEnd), responseReceived);
|
|
317
|
-
}
|
|
318
|
-
calculateDiffInMs('receive', actResRcvdTime, endTime);
|
|
319
|
-
return result;
|
|
320
|
-
}
|
|
321
|
-
exports.calculateTimings = calculateTimings;
|
|
322
257
|
//# sourceMappingURL=network.js.map
|