@elastic/synthetics 1.0.0-beta.2 → 1.0.0-beta.22
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/CHANGELOG.md +235 -0
- package/NOTICE.txt +250 -0
- package/README.md +2 -1
- package/dist/cli.js +87 -56
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +116 -14
- package/dist/common_types.d.ts.map +1 -1
- package/dist/config.d.ts +2 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -5
- package/dist/config.js.map +1 -1
- package/dist/core/browser-service.js +5 -5
- package/dist/core/browser-service.js.map +1 -1
- package/dist/core/expect.d.ts +177 -0
- package/dist/core/expect.d.ts.map +1 -0
- package/dist/core/expect.js +33 -0
- package/dist/core/expect.js.map +1 -0
- package/dist/core/gatherer.d.ts +4 -7
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +39 -12
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- 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 +54 -45
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +181 -71
- package/dist/core/runner.js.map +1 -1
- package/dist/dsl/journey.d.ts +13 -4
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +40 -1
- package/dist/dsl/journey.js.map +1 -1
- package/dist/formatter/javascript.d.ts +73 -0
- package/dist/formatter/javascript.d.ts.map +1 -0
- package/dist/formatter/javascript.js +274 -0
- package/dist/formatter/javascript.js.map +1 -0
- package/dist/helpers.d.ts +33 -12
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +108 -54
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/parse_args.d.ts +5 -2
- package/dist/parse_args.d.ts.map +1 -1
- package/dist/parse_args.js +59 -16
- package/dist/parse_args.js.map +1 -1
- package/dist/plugins/browser-console.d.ts +5 -8
- package/dist/plugins/browser-console.d.ts.map +1 -1
- package/dist/plugins/browser-console.js +27 -8
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/network.d.ts +23 -20
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +149 -124
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +5 -5
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js +5 -5
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +11 -11
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +40 -24
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.d.ts +10 -25
- package/dist/plugins/tracing.d.ts.map +1 -1
- package/dist/plugins/tracing.js +40 -26
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/reporters/base.d.ts +0 -1
- package/dist/reporters/base.d.ts.map +1 -1
- package/dist/reporters/base.js +34 -32
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/json.d.ts +46 -59
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +188 -70
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/junit.d.ts.map +1 -1
- package/dist/reporters/junit.js +7 -7
- package/dist/reporters/junit.js.map +1 -1
- package/dist/sdk/lh-trace-processor.d.ts +304 -0
- package/dist/sdk/lh-trace-processor.d.ts.map +1 -0
- package/dist/sdk/lh-trace-processor.js +832 -0
- package/dist/sdk/lh-trace-processor.js.map +1 -0
- package/dist/sdk/trace-metrics.d.ts +61 -0
- package/dist/sdk/trace-metrics.d.ts.map +1 -0
- package/dist/sdk/trace-metrics.js +252 -0
- package/dist/sdk/trace-metrics.js.map +1 -0
- package/dist/sdk/trace-processor.d.ts +106 -0
- package/dist/sdk/trace-processor.d.ts.map +1 -0
- package/dist/sdk/trace-processor.js +74 -0
- package/dist/sdk/trace-processor.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1575
- package/package.json +27 -16
- package/src/cli.ts +68 -45
- package/src/common_types.ts +138 -14
- package/src/config.ts +2 -5
- package/src/core/expect.ts +187 -0
- package/src/core/gatherer.ts +48 -24
- package/src/core/index.ts +6 -6
- package/src/core/logger.ts +1 -12
- package/src/core/runner.ts +259 -112
- package/src/dsl/journey.ts +28 -6
- package/src/formatter/javascript.ts +330 -0
- package/src/helpers.ts +114 -24
- package/src/index.ts +7 -6
- package/src/parse_args.ts +97 -22
- package/src/plugins/browser-console.ts +30 -13
- package/src/plugins/network.ts +175 -159
- package/src/plugins/performance.ts +7 -7
- package/src/plugins/plugin-manager.ts +47 -36
- package/src/plugins/tracing.ts +43 -54
- package/src/reporters/base.ts +29 -23
- package/src/reporters/json.ts +259 -80
- package/src/reporters/junit.ts +1 -1
- package/src/sdk/lh-trace-processor.ts +1033 -0
- package/src/sdk/trace-metrics.ts +287 -0
- package/src/sdk/trace-processor.ts +147 -0
package/dist/index.d.ts
CHANGED
|
@@ -27,9 +27,15 @@ export declare function run(options: RunOptions): Promise<{
|
|
|
27
27
|
[x: string]: {
|
|
28
28
|
status: import("./common_types").StatusValue;
|
|
29
29
|
error?: Error;
|
|
30
|
+
networkinfo?: import("./common_types").NetworkInfo[];
|
|
31
|
+
browserconsole?: import("./common_types").BrowserMessage[];
|
|
30
32
|
};
|
|
31
33
|
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Export all core module functions
|
|
36
|
+
*/
|
|
32
37
|
export { beforeAll, afterAll, journey, step, before, after } from './core';
|
|
38
|
+
export { expect } from './core/expect';
|
|
33
39
|
/**
|
|
34
40
|
* Export all the driver related types to be consumed
|
|
35
41
|
* and used by suites
|
|
@@ -40,4 +46,6 @@ export type { Page, ChromiumBrowser, ChromiumBrowserContext, CDPSession, } from
|
|
|
40
46
|
*/
|
|
41
47
|
export type { default as Runner } from './core/runner';
|
|
42
48
|
export type { Reporter, ReporterOptions } from './reporters';
|
|
49
|
+
export type { SyntheticsConfig } from './common_types';
|
|
50
|
+
export type { ActionInContext } from './formatter/javascript';
|
|
43
51
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU;;;;;;;GAc5C;AAED;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC;;;GAGG;AACH,YAAY,EACV,IAAI,EACJ,eAAe,EACf,sBAAsB,EACtB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,YAAY,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,9 +27,8 @@ 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.after = exports.before = exports.step = exports.journey = exports.afterAll = exports.beforeAll = exports.run = void 0;
|
|
30
|
+
exports.expect = exports.after = exports.before = exports.step = exports.journey = exports.afterAll = exports.beforeAll = exports.run = void 0;
|
|
31
31
|
const core_1 = require("./core");
|
|
32
|
-
const logger_1 = require("./core/logger");
|
|
33
32
|
const source_map_support_1 = __importDefault(require("source-map-support"));
|
|
34
33
|
async function run(options) {
|
|
35
34
|
/**
|
|
@@ -38,11 +37,6 @@ async function run(options) {
|
|
|
38
37
|
source_map_support_1.default.install({
|
|
39
38
|
environment: 'node',
|
|
40
39
|
});
|
|
41
|
-
/**
|
|
42
|
-
* set up logger with appropriate file descriptor
|
|
43
|
-
* to capture all the DEBUG logs when run through heartbeat
|
|
44
|
-
*/
|
|
45
|
-
logger_1.setLogger(options.outfd);
|
|
46
40
|
try {
|
|
47
41
|
return await core_1.runner.run(options);
|
|
48
42
|
}
|
|
@@ -52,6 +46,9 @@ async function run(options) {
|
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
48
|
exports.run = run;
|
|
49
|
+
/**
|
|
50
|
+
* Export all core module functions
|
|
51
|
+
*/
|
|
55
52
|
var core_2 = require("./core");
|
|
56
53
|
Object.defineProperty(exports, "beforeAll", { enumerable: true, get: function () { return core_2.beforeAll; } });
|
|
57
54
|
Object.defineProperty(exports, "afterAll", { enumerable: true, get: function () { return core_2.afterAll; } });
|
|
@@ -59,4 +56,6 @@ Object.defineProperty(exports, "journey", { enumerable: true, get: function () {
|
|
|
59
56
|
Object.defineProperty(exports, "step", { enumerable: true, get: function () { return core_2.step; } });
|
|
60
57
|
Object.defineProperty(exports, "before", { enumerable: true, get: function () { return core_2.before; } });
|
|
61
58
|
Object.defineProperty(exports, "after", { enumerable: true, get: function () { return core_2.after; } });
|
|
59
|
+
var expect_1 = require("./core/expect");
|
|
60
|
+
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return expect_1.expect; } });
|
|
62
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,iCAAgC;AAEhC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,iCAAgC;AAEhC,4EAAkD;AAE3C,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C;;OAEG;IACH,4BAAgB,CAAC,OAAO,CAAC;QACvB,WAAW,EAAE,MAAM;KACpB,CAAC,CAAC;IAEH,IAAI;QACF,OAAO,MAAM,aAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KAClC;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAdD,kBAcC;AAED;;GAEG;AACH,+BAA2E;AAAlE,iGAAA,SAAS,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAAE,+FAAA,OAAO,OAAA;AAAE,4FAAA,IAAI,OAAA;AAAE,8FAAA,MAAM,OAAA;AAAE,6FAAA,KAAK,OAAA;AAC1D,wCAAuC;AAA9B,gGAAA,MAAM,OAAA"}
|
package/dist/parse_args.d.ts
CHANGED
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
import { CliArgs } from './common_types';
|
|
26
|
+
declare const command: import("commander").Command;
|
|
27
|
+
declare const options: CliArgs;
|
|
28
|
+
export { options };
|
|
29
|
+
export default command;
|
|
27
30
|
//# sourceMappingURL=parse_args.d.ts.map
|
package/dist/parse_args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_args.d.ts","sourceRoot":"","sources":["../src/parse_args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"parse_args.d.ts","sourceRoot":"","sources":["../src/parse_args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAuFzC,QAAA,MAAM,OAAO,6BAA8B,CAAC;AAC5C,QAAA,MAAM,OAAO,SAA4B,CAAC;AA0C1C,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,eAAe,OAAO,CAAC"}
|
package/dist/parse_args.js
CHANGED
|
@@ -23,38 +23,81 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
+
var _a;
|
|
26
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.options = void 0;
|
|
27
29
|
const commander_1 = require("commander");
|
|
28
30
|
const reporters_1 = require("./reporters");
|
|
29
|
-
const
|
|
30
|
-
.map(r => String(r))
|
|
31
|
-
.join();
|
|
31
|
+
const helpers_1 = require("./helpers");
|
|
32
32
|
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
|
|
33
33
|
const { name, version } = require('../package.json');
|
|
34
34
|
commander_1.program
|
|
35
35
|
.name(`npx ${name}`)
|
|
36
36
|
.usage('[options] [dir] [files] file')
|
|
37
37
|
.option('-c, --config <path>', 'configuration path (default: synthetics.config.js)')
|
|
38
|
-
.option('-
|
|
39
|
-
.
|
|
40
|
-
.option('-j, --json', 'output newline delimited JSON')
|
|
41
|
-
.option('--reporter <reporter>', `output repoter format, can be one of ${availableReporters}`)
|
|
38
|
+
.option('-p, --params <jsonstring>', 'JSON object that gets injected to all journeys', JSON.parse)
|
|
39
|
+
.addOption(new commander_1.Option('--reporter <value>', `output repoter format`).choices(Object.keys(reporters_1.reporters)))
|
|
42
40
|
.option('-d, --debug', 'print debug logs info')
|
|
43
41
|
.option('--pattern <pattern>', 'RegExp file patterns to search inside directory')
|
|
44
42
|
.option('--inline', 'Run inline journeys from heartbeat')
|
|
45
43
|
.option('-r, --require <modules...>', 'module(s) to preload')
|
|
46
44
|
.option('--no-headless', 'run browser in headful mode')
|
|
47
|
-
.option('--sandbox', 'enable chromium sandboxing')
|
|
48
|
-
.option('--
|
|
49
|
-
.option('--
|
|
50
|
-
.
|
|
51
|
-
.
|
|
52
|
-
.
|
|
53
|
-
.option('--metrics', 'capture performance metrics for each step')
|
|
45
|
+
.option('--sandbox', 'enable chromium sandboxing', false)
|
|
46
|
+
.option('--rich-events', 'Mimics a heartbeat run')
|
|
47
|
+
.option('--capability <features...>', 'Enable capabilities through feature flags')
|
|
48
|
+
.addOption(new commander_1.Option('--screenshots [flag]', 'take screenshots at end of each step')
|
|
49
|
+
.choices(['on', 'off', 'only-on-failure'])
|
|
50
|
+
.default('on'))
|
|
54
51
|
.option('--dry-run', "don't actually execute anything, report only registered journeys")
|
|
55
|
-
.option('--
|
|
52
|
+
.option('--match <name>', 'run only journeys with a name or tags that matches the glob')
|
|
53
|
+
.option('--tags <name...>', 'run only journeys with the given tag(s), or globs')
|
|
56
54
|
.option('--outfd <fd>', 'specify a file descriptor for logs. Default is stdout', parseInt)
|
|
55
|
+
.option('--ws-endpoint <endpoint>', 'Browser WebSocket endpoint to connect to')
|
|
56
|
+
.option('--pause-on-error', 'pause on error until a keypress is made in the console. Useful during development')
|
|
57
|
+
.option('--ignore-https-errors', 'ignores any HTTPS errors in sites being tested, including ones related to unrecognized certs or signatures. This can be insecure!')
|
|
58
|
+
.option('--quiet-exit-code', 'always return 0 as an exit code status, regardless of test pass / fail. Only return > 0 exit codes on internal errors where the suite could not be run')
|
|
59
|
+
.addOption(new commander_1.Option('--throttling <d/u/l>', 'List of options to throttle network conditions for download throughput (d) in megabits/second, upload throughput (u) in megabits/second and latency (l) in milliseconds.').default(helpers_1.DEFAULT_NETWORK_CONDITIONS_ARG))
|
|
60
|
+
.option('--no-throttling', 'Turns off default network throttling.')
|
|
61
|
+
.option('--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. Options defined via --playwright-options take precedence.', JSON.parse)
|
|
57
62
|
.version(version)
|
|
58
63
|
.description('Run synthetic tests');
|
|
59
|
-
|
|
64
|
+
const command = commander_1.program.parse(process.argv);
|
|
65
|
+
const options = command.opts();
|
|
66
|
+
exports.options = options;
|
|
67
|
+
/**
|
|
68
|
+
* Group all events that can be consumed by heartbeat and
|
|
69
|
+
* eventually by the Synthetics UI.
|
|
70
|
+
*/
|
|
71
|
+
if (options.richEvents) {
|
|
72
|
+
options.reporter = (_a = options.reporter) !== null && _a !== void 0 ? _a : 'json';
|
|
73
|
+
options.ssblocks = true;
|
|
74
|
+
options.network = true;
|
|
75
|
+
options.quietExitCode = true;
|
|
76
|
+
options.trace = true;
|
|
77
|
+
}
|
|
78
|
+
if (options.capability) {
|
|
79
|
+
const supportedCapabilities = [
|
|
80
|
+
'trace',
|
|
81
|
+
'network',
|
|
82
|
+
'filmstrips',
|
|
83
|
+
'metrics',
|
|
84
|
+
'ssblocks',
|
|
85
|
+
];
|
|
86
|
+
/**
|
|
87
|
+
* trace - record chrome trace events(LCP, FCP, CLS, etc.) for all journeys
|
|
88
|
+
* network - capture network information for all journeys
|
|
89
|
+
* filmstrips - record detailed filmstrips for all journeys
|
|
90
|
+
* metrics - capture performance metrics (DOM Nodes, Heap size, etc.) for each step
|
|
91
|
+
* ssblocks - Dedupes the screenshots in to blocks to save storage space
|
|
92
|
+
*/
|
|
93
|
+
for (const flag of options.capability) {
|
|
94
|
+
if (supportedCapabilities.includes(flag)) {
|
|
95
|
+
options[flag] = true;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
console.warn(`Missing capability "${flag}", current supported capabilities are ${supportedCapabilities.join(', ')}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.default = command;
|
|
60
103
|
//# sourceMappingURL=parse_args.js.map
|
package/dist/parse_args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_args.js","sourceRoot":"","sources":["../src/parse_args.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"parse_args.js","sourceRoot":"","sources":["../src/parse_args.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;AAEH,yCAA4C;AAE5C,2CAAwC;AACxC,uCAA2D;AAE3D,iEAAiE;AACjE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAErD,mBAAO;KACJ,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;KACnB,KAAK,CAAC,8BAA8B,CAAC;KACrC,MAAM,CACL,qBAAqB,EACrB,oDAAoD,CACrD;KACA,MAAM,CACL,2BAA2B,EAC3B,gDAAgD,EAChD,IAAI,CAAC,KAAK,CACX;KACA,SAAS,CACR,IAAI,kBAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,CAAC,OAAO,CAC/D,MAAM,CAAC,IAAI,CAAC,qBAAS,CAAC,CACvB,CACF;KACA,MAAM,CAAC,aAAa,EAAE,uBAAuB,CAAC;KAC9C,MAAM,CACL,qBAAqB,EACrB,iDAAiD,CAClD;KACA,MAAM,CAAC,UAAU,EAAE,oCAAoC,CAAC;KACxD,MAAM,CAAC,4BAA4B,EAAE,sBAAsB,CAAC;KAC5D,MAAM,CAAC,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,MAAA,OAAO,CAAC,QAAQ,mCAAI,MAAM,CAAC;IAC9C,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CACtB;AAED,IAAI,OAAO,CAAC,UAAU,EAAE;IACtB,MAAM,qBAAqB,GAAG;QAC5B,OAAO;QACP,SAAS;QACT,YAAY;QACZ,SAAS;QACT,UAAU;KACX,CAAC;IACF;;;;;;OAMG;IACH,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE;QACrC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACxC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;SACtB;aAAM;YACL,OAAO,CAAC,IAAI,CACV,uBAAuB,IAAI,yCAAyC,qBAAqB,CAAC,IAAI,CAC5F,IAAI,CACL,EAAE,CACJ,CAAC;SACH;KACF;CACF;AAGD,kBAAe,OAAO,CAAC"}
|
|
@@ -22,19 +22,16 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
import { DefaultPluginOutput } from '../common_types';
|
|
25
|
+
import { BrowserMessage, Driver } from '../common_types';
|
|
27
26
|
import { Step } from '../dsl';
|
|
28
|
-
export declare type BrowserMessage = {
|
|
29
|
-
text: string;
|
|
30
|
-
type: string;
|
|
31
|
-
} & DefaultPluginOutput;
|
|
32
27
|
export declare class BrowserConsole {
|
|
33
|
-
private
|
|
28
|
+
private driver;
|
|
34
29
|
private messages;
|
|
35
30
|
_currentStep: Partial<Step>;
|
|
31
|
+
constructor(driver: Driver);
|
|
36
32
|
private consoleEventListener;
|
|
37
|
-
|
|
33
|
+
private pageErrorEventListener;
|
|
34
|
+
private enforceMessagesLimit;
|
|
38
35
|
start(): void;
|
|
39
36
|
stop(): BrowserMessage[];
|
|
40
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,8 +28,8 @@ exports.BrowserConsole = void 0;
|
|
|
28
28
|
const helpers_1 = require("../helpers");
|
|
29
29
|
const defaultMessageLimit = 1000;
|
|
30
30
|
class BrowserConsole {
|
|
31
|
-
constructor(
|
|
32
|
-
this.
|
|
31
|
+
constructor(driver) {
|
|
32
|
+
this.driver = driver;
|
|
33
33
|
this.messages = [];
|
|
34
34
|
this._currentStep = null;
|
|
35
35
|
this.consoleEventListener = msg => {
|
|
@@ -40,22 +40,41 @@ class BrowserConsole {
|
|
|
40
40
|
if (type === 'error' || type === 'warning') {
|
|
41
41
|
const { name, index } = this._currentStep;
|
|
42
42
|
this.messages.push({
|
|
43
|
-
timestamp: helpers_1.getTimestamp(),
|
|
43
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
44
44
|
text: msg.text(),
|
|
45
45
|
type,
|
|
46
46
|
step: { name, index },
|
|
47
47
|
});
|
|
48
|
-
|
|
49
|
-
this.messages.splice(0, 1);
|
|
50
|
-
}
|
|
48
|
+
this.enforceMessagesLimit();
|
|
51
49
|
}
|
|
52
50
|
};
|
|
51
|
+
this.pageErrorEventListener = (error) => {
|
|
52
|
+
if (!this._currentStep) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const { name, index } = this._currentStep;
|
|
56
|
+
this.messages.push({
|
|
57
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
58
|
+
text: error.message,
|
|
59
|
+
type: 'error',
|
|
60
|
+
step: { name, index },
|
|
61
|
+
error,
|
|
62
|
+
});
|
|
63
|
+
this.enforceMessagesLimit();
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
enforceMessagesLimit() {
|
|
67
|
+
if (this.messages.length > defaultMessageLimit) {
|
|
68
|
+
this.messages.splice(0, 1);
|
|
69
|
+
}
|
|
53
70
|
}
|
|
54
71
|
start() {
|
|
55
|
-
this.page.on('console', this.consoleEventListener);
|
|
72
|
+
this.driver.page.on('console', this.consoleEventListener);
|
|
73
|
+
this.driver.page.on('pageerror', this.pageErrorEventListener);
|
|
56
74
|
}
|
|
57
75
|
stop() {
|
|
58
|
-
this.page.off('console', this.consoleEventListener);
|
|
76
|
+
this.driver.page.off('console', this.consoleEventListener);
|
|
77
|
+
this.driver.page.off('pageerror', this.pageErrorEventListener);
|
|
59
78
|
return this.messages;
|
|
60
79
|
}
|
|
61
80
|
}
|
|
@@ -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;;;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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"}
|
|
@@ -22,16 +22,17 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import { CDPSession } from 'playwright-chromium';
|
|
26
25
|
import { Protocol } from 'playwright-chromium/types/protocol';
|
|
27
|
-
import { NetworkInfo } from '../common_types';
|
|
26
|
+
import { NetworkInfo, Driver } from '../common_types';
|
|
28
27
|
import { Step } from '../dsl';
|
|
29
28
|
export declare class NetworkManager {
|
|
29
|
+
private driver;
|
|
30
30
|
private _browser;
|
|
31
31
|
private _InflightRequestMap;
|
|
32
32
|
results: Array<NetworkInfo>;
|
|
33
33
|
_currentStep: Partial<Step>;
|
|
34
|
-
|
|
34
|
+
constructor(driver: Driver);
|
|
35
|
+
start(): Promise<void>;
|
|
35
36
|
_findNetworkRecord(requestId: string): NetworkInfo;
|
|
36
37
|
_onRequestWillBeSent(event: Protocol.Network.requestWillBeSentPayload): void;
|
|
37
38
|
_onRequestWillBeSentExtraInfo(event: Protocol.Network.requestWillBeSentExtraInfoPayload): void;
|
|
@@ -44,23 +45,25 @@ export declare class NetworkManager {
|
|
|
44
45
|
* Account for missing response received event and also adjust the
|
|
45
46
|
* response received event based on when first byte event was recorded
|
|
46
47
|
*/
|
|
47
|
-
getResponseReceivedTime(timing: Protocol.Network.Response['timing'], responseReceivedTime: number): number;
|
|
48
|
-
/**
|
|
49
|
-
* The timing calculations are based on the chrome devtools frontend
|
|
50
|
-
* https://github.com/ChromeDevTools/devtools-frontend/blob/7f5478d8ceb7586f23f4073ab5c2085dac1ec26a/front_end/network/RequestTimingView.js#L98-L193
|
|
51
|
-
*/
|
|
52
|
-
calculateTimings(record: NetworkInfo): {
|
|
53
|
-
blocked: number;
|
|
54
|
-
queueing: number;
|
|
55
|
-
dns: number;
|
|
56
|
-
ssl: number;
|
|
57
|
-
proxy: number;
|
|
58
|
-
connect: number;
|
|
59
|
-
send: number;
|
|
60
|
-
wait: number;
|
|
61
|
-
receive: number;
|
|
62
|
-
total: number;
|
|
63
|
-
};
|
|
64
48
|
stop(): NetworkInfo[];
|
|
65
49
|
}
|
|
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
|
+
* Rewrite the map with new redirect id to not reset
|
|
59
|
+
* the redirect request with original request
|
|
60
|
+
*/
|
|
61
|
+
ssl: number;
|
|
62
|
+
proxy: number;
|
|
63
|
+
connect: number;
|
|
64
|
+
send: number;
|
|
65
|
+
wait: number;
|
|
66
|
+
receive: number;
|
|
67
|
+
total: number;
|
|
68
|
+
};
|
|
66
69
|
//# sourceMappingURL=network.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/plugins/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/plugins/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAe,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,qBAAa,cAAc;IAMb,OAAO,CAAC,MAAM;IAL1B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,mBAAmB,CAAkC;IAC7D,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAM;IACjC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAQ;gBAEf,MAAM,EAAE,MAAM;IAE5B,KAAK;IAuBX,kBAAkB,CAAC,SAAS,EAAE,MAAM;IAIpC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,wBAAwB;IA8ErE,6BAA6B,CAC3B,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,iCAAiC;IAiB3D,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,mBAAmB;IAU3D,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,uBAAuB;IAiCnE,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,sBAAsB;IAKjE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,oBAAoB;IAK7D,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,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