@elastic/synthetics 1.0.0-beta.24 → 1.0.0-beta.27
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 +2 -2
- package/dist/cli.js +51 -6
- 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 +16 -7
- 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/{reporters/reporter.d.ts → dsl/locations.d.ts} +12 -8
- package/dist/dsl/locations.d.ts.map +1 -0
- package/dist/dsl/locations.js +41 -0
- package/dist/dsl/locations.js.map +1 -0
- package/dist/dsl/monitor.d.ts +65 -0
- package/dist/dsl/monitor.d.ts.map +1 -0
- package/dist/dsl/monitor.js +63 -0
- package/dist/dsl/monitor.js.map +1 -0
- package/dist/generator/index.d.ts +20 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +158 -0
- package/dist/generator/index.js.map +1 -0
- package/{src/reporters/reporter.ts → dist/generator/utils.d.ts} +4 -11
- package/dist/generator/utils.d.ts.map +1 -0
- package/dist/generator/utils.js +57 -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 +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- 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 +7 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +66 -12
- 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 -245
- 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/dist/{reporters/reporter.js → push/index.d.ts} +4 -3
- 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/push/monitor.d.ts +32 -0
- package/dist/push/monitor.d.ts.map +1 -0
- package/dist/push/monitor.js +62 -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 +89 -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 -8
- package/src/cli.ts +81 -11
- package/src/common_types.ts +72 -14
- package/src/core/gatherer.ts +20 -12
- package/src/core/index.ts +15 -0
- package/src/core/runner.ts +87 -114
- package/src/dsl/journey.ts +18 -0
- package/src/dsl/locations.ts +38 -0
- package/src/dsl/monitor.ts +87 -0
- package/src/generator/index.ts +201 -0
- package/src/generator/utils.ts +54 -0
- package/src/helpers.ts +36 -52
- package/src/index.ts +9 -1
- package/src/loader.ts +4 -4
- package/src/options.ts +72 -15
- package/src/plugins/network.ts +218 -294
- 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 +68 -0
- package/src/push/plugin.ts +113 -0
- package/src/push/request.ts +116 -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 +26 -0
- package/CHANGELOG.md +0 -348
- package/NOTICE.txt +0 -250
- package/dist/reporters/reporter.d.ts.map +0 -1
- package/dist/reporters/reporter.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Experimental Synthetics Agent
|
|
4
4
|
|
|
5
5
|
Synthetic Monitoring with Real Browsers.
|
|
6
|
-
**Please note this is
|
|
6
|
+
**Please note this is project is in beta status. Expect things to break and change!**
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ npx @elastic/synthetics [options] [dir] [files] file
|
|
|
21
21
|
|
|
22
22
|
## Documentation
|
|
23
23
|
|
|
24
|
-
- [Introduction](https://www.elastic.co/guide/en/observability/current/
|
|
24
|
+
- [Introduction](https://www.elastic.co/guide/en/observability/current/monitor-uptime-synthetics.html#monitoring-synthetics)
|
|
25
25
|
- [CLI Options](https://www.elastic.co/guide/en/observability/current/synthetics-command-reference.html#elastic-synthetics-command)
|
|
26
26
|
- [Syntax](https://www.elastic.co/guide/en/observability/current/synthetics-create-test.html#synthetics-syntax)
|
|
27
27
|
- [Creating a Journey](https://www.elastic.co/guide/en/observability/current/synthetics-create-test.html#synthetics-create-journey)
|
package/dist/cli.js
CHANGED
|
@@ -27,10 +27,15 @@
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
const commander_1 = require("commander");
|
|
29
29
|
const reporters_1 = require("./reporters");
|
|
30
|
-
const helpers_1 = require("./helpers");
|
|
31
30
|
const options_1 = require("./options");
|
|
32
31
|
const loader_1 = require("./loader");
|
|
33
32
|
const _1 = require("./");
|
|
33
|
+
const core_1 = require("./core");
|
|
34
|
+
const monitor_1 = require("./dsl/monitor");
|
|
35
|
+
const push_1 = require("./push");
|
|
36
|
+
const path_1 = require("path");
|
|
37
|
+
const generator_1 = require("./generator");
|
|
38
|
+
const helpers_1 = require("./helpers");
|
|
34
39
|
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
|
|
35
40
|
const { name, version } = require('../package.json');
|
|
36
41
|
commander_1.program
|
|
@@ -43,7 +48,7 @@ commander_1.program
|
|
|
43
48
|
.option('--inline', 'Run inline journeys from heartbeat')
|
|
44
49
|
.option('-r, --require <modules...>', 'module(s) to preload')
|
|
45
50
|
.option('--no-headless', 'run browser in headful mode')
|
|
46
|
-
.option('--sandbox', 'enable chromium sandboxing'
|
|
51
|
+
.option('--sandbox', 'enable chromium sandboxing')
|
|
47
52
|
.option('--rich-events', 'Mimics a heartbeat run')
|
|
48
53
|
.option('--capability <features...>', 'Enable capabilities through feature flags')
|
|
49
54
|
.addOption(new commander_1.Option('--screenshots [flag]', 'take screenshots at end of each step')
|
|
@@ -57,7 +62,7 @@ commander_1.program
|
|
|
57
62
|
.option('--pause-on-error', 'pause on error until a keypress is made in the console. Useful during development')
|
|
58
63
|
.option('--ignore-https-errors', 'ignores any HTTPS errors in sites being tested, including ones related to unrecognized certs or signatures. This can be insecure!')
|
|
59
64
|
.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')
|
|
60
|
-
.option('--throttling <
|
|
65
|
+
.option('--throttling <config>', 'JSON object to throttle network conditions for download and upload throughput in megabits/second and latency in milliseconds. Ex: { "download": 10, "upload": 5, "latency": 200 }.', options_1.parseThrottling, {})
|
|
61
66
|
.option('--no-throttling', 'Turns off default network throttling.')
|
|
62
67
|
.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)
|
|
63
68
|
.version(version)
|
|
@@ -83,11 +88,51 @@ commander_1.program
|
|
|
83
88
|
process.exit(1);
|
|
84
89
|
}
|
|
85
90
|
});
|
|
91
|
+
// Push command
|
|
86
92
|
commander_1.program
|
|
87
93
|
.command('push')
|
|
88
|
-
.
|
|
89
|
-
.
|
|
90
|
-
|
|
94
|
+
.addArgument(new commander_1.Argument('[journeys...]', 'file path to journey directory and individual files').argRequired())
|
|
95
|
+
.description('Push journeys to create montors within Kibana monitor management UI')
|
|
96
|
+
.option('--schedule <time-in-minutes>', "schedule in minutes for the pushed monitors. Setting `10`, for example, configures monitors which don't have an interval defined to run every 10 minutes.", parseInt)
|
|
97
|
+
.addOption(new commander_1.Option('--locations <locations...>', 'default list of locations from which your monitors will run.').choices(monitor_1.SyntheticsLocations))
|
|
98
|
+
.requiredOption('--project <project-id>', 'id that will be used for logically grouping monitors')
|
|
99
|
+
.requiredOption('--url <url>', 'kibana URL to upload the monitors')
|
|
100
|
+
.requiredOption('--auth <auth>', 'API key used for Kibana authentication(https://www.elastic.co/guide/en/kibana/master/api-keys.html).')
|
|
101
|
+
.option('--space <space>', 'the target Kibana spaces for the pushed monitors — spaces help you organise pushed monitors.', 'default')
|
|
102
|
+
.option('--delete', 'automatically delete the stale monitors.')
|
|
103
|
+
.action(async (journeys, cmdOpts) => {
|
|
104
|
+
try {
|
|
105
|
+
await (0, loader_1.loadTestFiles)({ inline: false }, journeys);
|
|
106
|
+
const options = (0, options_1.normalizeOptions)({ ...commander_1.program.opts(), ...cmdOpts });
|
|
107
|
+
if (!options.schedule) {
|
|
108
|
+
throw (0, helpers_1.error)(`Set default schedule in minutes for all monitors via '--schedule <time-in-minutes>' OR
|
|
109
|
+
configure via Synthetics config file under 'monitors.schedule' field.`);
|
|
110
|
+
}
|
|
111
|
+
if (!options.locations) {
|
|
112
|
+
throw (0, helpers_1.error)(`Set default location for all monitors via CLI as '--locations <locations...>' OR
|
|
113
|
+
configure via Synthetics config file under 'monitors.locations' field.`);
|
|
114
|
+
}
|
|
115
|
+
const monitors = core_1.runner.buildMonitors(options);
|
|
116
|
+
await (0, push_1.push)(monitors, cmdOpts);
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
e && console.error(e);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
// Init command
|
|
124
|
+
commander_1.program
|
|
125
|
+
.command('init <project-dir>')
|
|
126
|
+
.description('Initalize Elastic synthetics project')
|
|
127
|
+
.action(async (dir) => {
|
|
128
|
+
try {
|
|
129
|
+
const generator = await new generator_1.Generator((0, path_1.resolve)(process.cwd(), dir));
|
|
130
|
+
await generator.setup();
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
e && (0, helpers_1.error)(e);
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
91
136
|
});
|
|
92
137
|
commander_1.program.parse(process.argv);
|
|
93
138
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,yCAAsD;AAEtD,2CAAwC;AACxC,uCAA8D;AAC9D,qCAAyC;AACzC,yBAAyB;AACzB,iCAAgC;AAChC,2CAAoD;AACpD,iCAA8B;AAC9B,+BAA+B;AAC/B,2CAAwC;AACxC,uCAAkC;AAElC,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,CACL,qBAAqB,EACrB,iDAAiD,CAClD;KACA,MAAM,CAAC,UAAU,EAAE,oCAAoC,CAAC;KACxD,MAAM,CAAC,4BAA4B,EAAE,sBAAsB,CAAC;KAC5D,MAAM,CAAC,eAAe,EAAE,6BAA6B,CAAC;KACtD,MAAM,CAAC,WAAW,EAAE,4BAA4B,CAAC;KACjD,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC;KACjD,MAAM,CACL,4BAA4B,EAC5B,2CAA2C,CAC5C;KACA,SAAS,CACR,IAAI,kBAAM,CAAC,sBAAsB,EAAE,sCAAsC,CAAC;KACvE,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O,CAAC,CAAC;QAC/C,MAAM,IAAA,WAAI,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAC/B;IAAC,OAAO,CAAC,EAAE;QACV,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,CAAC;AAEL,eAAe;AACf,mBAAO;KACJ,OAAO,CAAC,oBAAoB,CAAC;KAC7B,WAAW,CAAC,sCAAsC,CAAC;KACnD,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;IAC5B,IAAI;QACF,MAAM,SAAS,GAAG,MAAM,IAAI,qBAAS,CAAC,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;QACnE,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,CAAC,IAAI,IAAA,eAAK,EAAC,CAAC,CAAC,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/common_types.d.ts
CHANGED
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
import { BrowserContextOptions, LaunchOptions, CDPSession, ChromiumBrowser, ChromiumBrowserContext, Page } from 'playwright-chromium';
|
|
26
|
-
import { Protocol } from 'playwright-core/types/protocol';
|
|
27
26
|
import { Step } from './dsl';
|
|
28
|
-
import {
|
|
27
|
+
import { BuiltInReporterName, ReporterInstance } from './reporters';
|
|
28
|
+
import { MonitorConfig } from './dsl/monitor';
|
|
29
29
|
export declare type VoidCallback = () => void;
|
|
30
30
|
export declare type Location = {
|
|
31
31
|
file: string;
|
|
@@ -39,7 +39,6 @@ export declare type HooksArgs = {
|
|
|
39
39
|
};
|
|
40
40
|
export declare type HooksCallback = (args: HooksArgs) => void;
|
|
41
41
|
export declare type StatusValue = 'succeeded' | 'failed' | 'skipped';
|
|
42
|
-
export declare type Reporters = keyof typeof reporters;
|
|
43
42
|
export declare type NetworkConditions = {
|
|
44
43
|
offline: boolean;
|
|
45
44
|
downloadThroughput: number;
|
|
@@ -106,11 +105,9 @@ export declare type Request = {
|
|
|
106
105
|
};
|
|
107
106
|
export declare type Response = {
|
|
108
107
|
url?: string;
|
|
109
|
-
protocol?: string;
|
|
110
108
|
status: number;
|
|
111
109
|
statusText?: string;
|
|
112
|
-
mimeType
|
|
113
|
-
httpVersion?: string;
|
|
110
|
+
mimeType?: string;
|
|
114
111
|
headers: Record<string, string>;
|
|
115
112
|
bytes?: number;
|
|
116
113
|
body?: {
|
|
@@ -122,26 +119,23 @@ export declare type Response = {
|
|
|
122
119
|
remoteIPAddress?: string;
|
|
123
120
|
remotePort?: number;
|
|
124
121
|
fromServiceWorker?: boolean;
|
|
125
|
-
timing?: Protocol.Network.ResourceTiming;
|
|
126
122
|
};
|
|
127
123
|
export declare type NetworkInfo = {
|
|
128
124
|
url: string;
|
|
129
125
|
browser: BrowserInfo;
|
|
130
126
|
type: string;
|
|
131
127
|
request: Request;
|
|
132
|
-
response
|
|
128
|
+
response: Response;
|
|
133
129
|
isNavigationRequest: boolean;
|
|
134
130
|
requestSentTime: number;
|
|
135
131
|
loadEndTime: number;
|
|
136
132
|
responseReceivedTime: number;
|
|
137
133
|
resourceSize: number;
|
|
138
134
|
transferSize: number;
|
|
139
|
-
timings
|
|
135
|
+
timings: {
|
|
140
136
|
blocked: number;
|
|
141
|
-
queueing: number;
|
|
142
137
|
dns: number;
|
|
143
138
|
ssl: number;
|
|
144
|
-
proxy: number;
|
|
145
139
|
connect: number;
|
|
146
140
|
send: number;
|
|
147
141
|
wait: number;
|
|
@@ -149,6 +143,7 @@ export declare type NetworkInfo = {
|
|
|
149
143
|
total: number;
|
|
150
144
|
};
|
|
151
145
|
} & DefaultPluginOutput;
|
|
146
|
+
export declare type PageMetrics = Record<string, number>;
|
|
152
147
|
export declare type BrowserMessage = {
|
|
153
148
|
text: string;
|
|
154
149
|
type: string;
|
|
@@ -162,6 +157,11 @@ export declare type PluginOutput = {
|
|
|
162
157
|
metrics?: PerfMetrics;
|
|
163
158
|
};
|
|
164
159
|
export declare type ScreenshotOptions = 'on' | 'off' | 'only-on-failure';
|
|
160
|
+
export declare type ThrottlingOptions = {
|
|
161
|
+
download?: number;
|
|
162
|
+
upload?: number;
|
|
163
|
+
latency?: number;
|
|
164
|
+
};
|
|
165
165
|
declare type BaseArgs = {
|
|
166
166
|
params?: Params;
|
|
167
167
|
screenshots?: ScreenshotOptions;
|
|
@@ -174,10 +174,13 @@ declare type BaseArgs = {
|
|
|
174
174
|
ignoreHttpsErrors?: boolean;
|
|
175
175
|
playwrightOptions?: PlaywrightOptions;
|
|
176
176
|
quietExitCode?: boolean;
|
|
177
|
+
throttling?: ThrottlingOptions;
|
|
178
|
+
schedule?: MonitorConfig['schedule'];
|
|
179
|
+
locations?: MonitorConfig['locations'];
|
|
177
180
|
};
|
|
178
181
|
export declare type CliArgs = BaseArgs & {
|
|
179
182
|
config?: string;
|
|
180
|
-
reporter?:
|
|
183
|
+
reporter?: BuiltInReporterName;
|
|
181
184
|
pattern?: string;
|
|
182
185
|
inline?: boolean;
|
|
183
186
|
require?: Array<string>;
|
|
@@ -186,7 +189,7 @@ export declare type CliArgs = BaseArgs & {
|
|
|
186
189
|
richEvents?: boolean;
|
|
187
190
|
capability?: Array<string>;
|
|
188
191
|
ignoreHttpsErrors?: boolean;
|
|
189
|
-
throttling?: boolean |
|
|
192
|
+
throttling?: boolean | ThrottlingOptions;
|
|
190
193
|
};
|
|
191
194
|
export declare type RunOptions = BaseArgs & {
|
|
192
195
|
metrics?: boolean;
|
|
@@ -197,12 +200,57 @@ export declare type RunOptions = BaseArgs & {
|
|
|
197
200
|
environment?: string;
|
|
198
201
|
playwrightOptions?: PlaywrightOptions;
|
|
199
202
|
networkConditions?: NetworkConditions;
|
|
200
|
-
reporter?:
|
|
203
|
+
reporter?: BuiltInReporterName | ReporterInstance;
|
|
204
|
+
};
|
|
205
|
+
export declare type PushOptions = {
|
|
206
|
+
auth: string;
|
|
207
|
+
url: string;
|
|
208
|
+
project: string;
|
|
209
|
+
space: string;
|
|
210
|
+
delete: boolean;
|
|
211
|
+
schedule?: MonitorConfig['schedule'];
|
|
212
|
+
locations?: MonitorConfig['locations'];
|
|
201
213
|
};
|
|
202
214
|
export declare type PlaywrightOptions = LaunchOptions & BrowserContextOptions;
|
|
203
215
|
export declare type SyntheticsConfig = {
|
|
204
216
|
params?: Params;
|
|
205
217
|
playwrightOptions?: PlaywrightOptions;
|
|
218
|
+
monitor?: MonitorConfig;
|
|
219
|
+
};
|
|
220
|
+
/** Runner Payload types */
|
|
221
|
+
export declare type JourneyResult = {
|
|
222
|
+
status: StatusValue;
|
|
223
|
+
error?: Error;
|
|
224
|
+
networkinfo?: PluginOutput['networkinfo'];
|
|
225
|
+
browserconsole?: PluginOutput['browserconsole'];
|
|
226
|
+
};
|
|
227
|
+
export declare type StepResult = {
|
|
228
|
+
status: StatusValue;
|
|
229
|
+
url?: string;
|
|
230
|
+
error?: Error;
|
|
231
|
+
pagemetrics?: PageMetrics;
|
|
232
|
+
filmstrips?: PluginOutput['filmstrips'];
|
|
233
|
+
metrics?: PluginOutput['metrics'];
|
|
234
|
+
traces?: PluginOutput['traces'];
|
|
235
|
+
};
|
|
236
|
+
/** Reporter and Runner contract */
|
|
237
|
+
export declare type StartEvent = {
|
|
238
|
+
numJourneys: number;
|
|
239
|
+
networkConditions?: NetworkConditions;
|
|
240
|
+
};
|
|
241
|
+
export declare type JourneyStartResult = {
|
|
242
|
+
timestamp: number;
|
|
243
|
+
params?: Params;
|
|
244
|
+
};
|
|
245
|
+
export declare type JourneyEndResult = JourneyStartResult & JourneyResult & {
|
|
246
|
+
start: number;
|
|
247
|
+
end: number;
|
|
248
|
+
options: RunOptions;
|
|
249
|
+
timestamp: number;
|
|
250
|
+
};
|
|
251
|
+
export declare type StepEndResult = StepResult & {
|
|
252
|
+
start: number;
|
|
253
|
+
end: number;
|
|
206
254
|
};
|
|
207
255
|
export {};
|
|
208
256
|
//# sourceMappingURL=common_types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common_types.d.ts","sourceRoot":"","sources":["../src/common_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,IAAI,EACL,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"common_types.d.ts","sourceRoot":"","sources":["../src/common_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,IAAI,EACL,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,oBAAY,YAAY,GAAG,MAAM,IAAI,CAAC;AACtC,oBAAY,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACzC,oBAAY,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,oBAAY,aAAa,GAAG,CAAC,IAAI,EAAE,S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AK,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;CACjC,CAAC;AAEF,mCAAmC;AACnC,oBAAY,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,gBAAgB,GAAG,kBAAkB,GAC/C,aAAa,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEJ,oBAAY,aAAa,GAAG,UAAU,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
package/dist/core/gatherer.d.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { ChromiumBrowser, BrowserContext } from 'playwright-chromium';
|
|
26
26
|
import { PluginManager } from '../plugins';
|
|
27
|
-
import { Driver, RunOptions } from '../common_types';
|
|
27
|
+
import { Driver, NetworkConditions, RunOptions } from '../common_types';
|
|
28
28
|
/**
|
|
29
29
|
* Purpose of the Gatherer is to set up the necessary browser driver
|
|
30
30
|
* related capabilities for the runner to run all journeys
|
|
@@ -33,7 +33,7 @@ export declare class Gatherer {
|
|
|
33
33
|
static browser: ChromiumBrowser;
|
|
34
34
|
static setupDriver(options: RunOptions): Promise<Driver>;
|
|
35
35
|
static getUserAgent(userAgent?: string): Promise<string>;
|
|
36
|
-
static setNetworkConditions(context: BrowserContext, networkConditions:
|
|
36
|
+
static setNetworkConditions(context: BrowserContext, networkConditions: NetworkConditions): void;
|
|
37
37
|
/**
|
|
38
38
|
* Starts recording all events related to the v8 devtools protocol
|
|
39
39
|
* https://chromedevtools.github.io/devtools-protocol/v8/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.d.ts","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"gatherer.d.ts","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExE;;;GAGG;AACH,qBAAa,QAAQ;IACnB,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC;WAEnB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;WA6BjD,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM;IAS5C,MAAM,CAAC,oBAAoB,CACzB,OAAO,EAAE,cAAc,EACvB,iBAAiB,EAAE,iBAAiB;IAsBtC;;;OAGG;WACU,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;WAYlD,OAAO,CAAC,MAAM,EAAE,MAAM;WAItB,IAAI;CAMlB"}
|
package/dist/core/gatherer.js
CHANGED
|
@@ -55,25 +55,34 @@ class Gatherer {
|
|
|
55
55
|
...playwrightOptions,
|
|
56
56
|
userAgent: await Gatherer.getUserAgent(playwrightOptions?.userAgent),
|
|
57
57
|
});
|
|
58
|
-
|
|
58
|
+
Gatherer.setNetworkConditions(context, networkConditions);
|
|
59
59
|
const page = await context.newPage();
|
|
60
60
|
const client = await context.newCDPSession(page);
|
|
61
61
|
return { browser: Gatherer.browser, context, page, client };
|
|
62
62
|
}
|
|
63
63
|
static async getUserAgent(userAgent) {
|
|
64
|
-
const syntheticsIdentifier = ' Elastic/Synthetics';
|
|
65
64
|
if (!userAgent) {
|
|
66
65
|
const session = await Gatherer.browser.newBrowserCDPSession();
|
|
67
66
|
({ userAgent } = await session.send('Browser.getVersion'));
|
|
67
|
+
return userAgent + ' Elastic/Synthetics';
|
|
68
68
|
}
|
|
69
|
-
return userAgent
|
|
69
|
+
return userAgent;
|
|
70
70
|
}
|
|
71
|
-
static
|
|
71
|
+
static setNetworkConditions(context, networkConditions) {
|
|
72
72
|
if (networkConditions) {
|
|
73
|
-
context.on('page',
|
|
73
|
+
context.on('page', page => {
|
|
74
74
|
const context = page.context();
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const emulatePromise = context
|
|
76
|
+
.newCDPSession(page)
|
|
77
|
+
.then(client => client.send('Network.emulateNetworkConditions', networkConditions));
|
|
78
|
+
/**
|
|
79
|
+
* Guard against pages that gets closed before the emulation kicks to capture
|
|
80
|
+
* unhandled rejections from accessing the CDP session of closed page
|
|
81
|
+
*/
|
|
82
|
+
Promise.race([
|
|
83
|
+
new Promise(resolve => page.on('close', () => resolve())),
|
|
84
|
+
emulatePromise,
|
|
85
|
+
]);
|
|
77
86
|
});
|
|
78
87
|
}
|
|
79
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;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C,CAAC;QAC9D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAClE,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAc;QACjC,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,IAAI,QAAQ,CAAC,OAAO,EAAE;YACpB,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;SACzB;IACH,CAAC;CACF;AA3FD,4BA2FC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -25,9 +25,13 @@
|
|
|
25
25
|
import { Journey, JourneyCallback, JourneyOptions } from '../dsl';
|
|
26
26
|
import Runner from './runner';
|
|
27
27
|
import { VoidCallback, HooksCallback } from '../common_types';
|
|
28
|
+
import { MonitorConfig } from '../dsl/monitor';
|
|
28
29
|
export declare const runner: Runner;
|
|
29
30
|
export declare const journey: (options: string | JourneyOptions, callback: JourneyCallback) => Journey;
|
|
30
31
|
export declare const step: (name: string, callback: VoidCallback) => import("../dsl").Step;
|
|
32
|
+
export declare const monitor: {
|
|
33
|
+
use: (config: MonitorConfig) => void;
|
|
34
|
+
};
|
|
31
35
|
export declare const beforeAll: (callback: HooksCallback) => void;
|
|
32
36
|
export declare const afterAll: (callback: HooksCallback) => void;
|
|
33
37
|
export declare const before: (callback: HooksCallback) => void;
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAY,MAAM,iBAAiB,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAW/C,eAAO,MAAM,MAAM,EAAE,MAAkC,CAAC;AAExD,eAAO,MAAM,OAAO,0EAcnB,CAAC;AAEF,eAAO,MAAM,IAAI,iEAKhB,CAAC;AAEF,eAAO,MAAM,OAAO;;CAYnB,CAAC;AAEF,eAAO,MAAM,SAAS,aAAc,aAAa,SAEhD,CAAC;AAEF,eAAO,MAAM,QAAQ,aAAc,aAAa,SAE/C,CAAC;AAEF,eAAO,MAAM,MAAM,aAAc,aAAa,SAK7C,CAAC;AAEF,eAAO,MAAM,KAAK,aAAc,aAAa,SAK5C,CAAC"}
|
package/dist/core/index.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.after = exports.before = exports.afterAll = exports.beforeAll = exports.step = exports.journey = exports.runner = void 0;
|
|
30
|
+
exports.after = exports.before = exports.afterAll = exports.beforeAll = exports.monitor = exports.step = exports.journey = exports.runner = void 0;
|
|
31
31
|
const dsl_1 = require("../dsl");
|
|
32
32
|
const runner_1 = __importDefault(require("./runner"));
|
|
33
33
|
const helpers_1 = require("../helpers");
|
|
@@ -54,6 +54,20 @@ exports.step = (0, helpers_1.wrapFnWithLocation)((location, name, callback) => {
|
|
|
54
54
|
(0, logger_1.log)(`register step: ${name}`);
|
|
55
55
|
return exports.runner.currentJourney?.addStep(name, callback, location);
|
|
56
56
|
});
|
|
57
|
+
exports.monitor = {
|
|
58
|
+
use: (0, helpers_1.wrapFnWithLocation)((location, config) => {
|
|
59
|
+
/**
|
|
60
|
+
* If the context is inside journey, then set it to journey context
|
|
61
|
+
* otherwise set to the global monitor which will be used for all journeys
|
|
62
|
+
*/
|
|
63
|
+
if (exports.runner.currentJourney) {
|
|
64
|
+
exports.runner.currentJourney.updateMonitor(config);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
exports.runner.updateMonitor(config);
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
57
71
|
const beforeAll = (callback) => {
|
|
58
72
|
exports.runner.addHook('beforeAll', callback);
|
|
59
73
|
};
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,gCAAkE;AAClE,sDAA8B;AAE9B,wCAAgD;AAChD,qCAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,gCAAkE;AAClE,sDAA8B;AAE9B,wCAAgD;AAChD,qCAA+B;AAG/B;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;A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C;CACH,CAAC;AAEK,MAAM,SAAS,GAAG,CAAC,QAAuB,EAAE,EAAE;IACnD,cAAM,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACxC,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,QAAQ,GAAG,CAAC,QAAuB,EAAE,EAAE;IAClD,cAAM,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB;AAEK,MAAM,MAAM,GAAG,CAAC,QAAuB,EAAE,EAAE;IAChD,IAAI,CAAC,cAAM,CAAC,cAAc,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;KACpE;IACD,OAAO,cAAM,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AALW,QAAA,MAAM,UAKjB;AAEK,MAAM,KAAK,GAAG,CAAC,QAAuB,EAAE,EAAE;IAC/C,IAAI,CAAC,cAAM,CAAC,cAAc,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;KACnE;IACD,OAAO,cAAM,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC,CAAC;AALW,QAAA,KAAK,SAKhB"}
|
package/dist/core/runner.d.ts
CHANGED
|
@@ -22,12 +22,11 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
/// <reference types="node" />
|
|
26
|
-
import { EventEmitter } from 'events';
|
|
27
25
|
import { Journey } from '../dsl/journey';
|
|
28
26
|
import { Step } from '../dsl/step';
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
27
|
+
import { HooksCallback, Params, HooksArgs, Driver, RunOptions, JourneyResult, StepResult } from '../common_types';
|
|
28
|
+
import { PluginManager } from '../plugins';
|
|
29
|
+
import { Monitor, MonitorConfig } from '../dsl/monitor';
|
|
31
30
|
declare type HookType = 'beforeAll' | 'afterAll';
|
|
32
31
|
export declare type SuiteHooks = Record<HookType, Array<HooksCallback>>;
|
|
33
32
|
declare type JourneyContext = {
|
|
@@ -36,69 +35,21 @@ declare type JourneyContext = {
|
|
|
36
35
|
driver: Driver;
|
|
37
36
|
pluginManager: PluginManager;
|
|
38
37
|
};
|
|
39
|
-
declare type StepResult = {
|
|
40
|
-
status: StatusValue;
|
|
41
|
-
url?: string;
|
|
42
|
-
error?: Error;
|
|
43
|
-
pagemetrics?: PageMetrics;
|
|
44
|
-
filmstrips?: PluginOutput['filmstrips'];
|
|
45
|
-
metrics?: PluginOutput['metrics'];
|
|
46
|
-
traces?: PluginOutput['traces'];
|
|
47
|
-
};
|
|
48
|
-
declare type JourneyResult = {
|
|
49
|
-
status: StatusValue;
|
|
50
|
-
error?: Error;
|
|
51
|
-
networkinfo?: PluginOutput['networkinfo'];
|
|
52
|
-
browserconsole?: PluginOutput['browserconsole'];
|
|
53
|
-
};
|
|
54
38
|
declare type RunResult = Record<string, JourneyResult>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
journey: Journey;
|
|
58
|
-
}
|
|
59
|
-
interface JourneyEvent {
|
|
60
|
-
journey: Journey;
|
|
61
|
-
timestamp: number;
|
|
62
|
-
params?: Params;
|
|
63
|
-
}
|
|
64
|
-
interface Events {
|
|
65
|
-
start: {
|
|
66
|
-
numJourneys: number;
|
|
67
|
-
networkConditions?: NetworkConditions;
|
|
68
|
-
};
|
|
69
|
-
'journey:register': {
|
|
70
|
-
journey: Journey;
|
|
71
|
-
};
|
|
72
|
-
'journey:start': JourneyEvent;
|
|
73
|
-
'journey:end': JourneyEvent & JourneyResult & {
|
|
74
|
-
start: number;
|
|
75
|
-
end: number;
|
|
76
|
-
options: RunOptions;
|
|
77
|
-
timestamp: number;
|
|
78
|
-
};
|
|
79
|
-
'journey:end:reported': unknown;
|
|
80
|
-
'step:start': StepEvent;
|
|
81
|
-
'step:end': StepEvent & StepResult & {
|
|
82
|
-
start: number;
|
|
83
|
-
end: number;
|
|
84
|
-
};
|
|
85
|
-
end: unknown;
|
|
86
|
-
}
|
|
87
|
-
export default interface Runner {
|
|
88
|
-
on<K extends keyof Events>(name: K, listener: (v: Events[K]) => void): this;
|
|
89
|
-
emit<K extends keyof Events>(event: K, args: Events[K]): boolean;
|
|
90
|
-
}
|
|
91
|
-
export default class Runner extends EventEmitter {
|
|
92
|
-
active: boolean;
|
|
93
|
-
currentJourney?: Journey;
|
|
39
|
+
export default class Runner {
|
|
40
|
+
#private;
|
|
94
41
|
journeys: Journey[];
|
|
95
42
|
hooks: SuiteHooks;
|
|
96
43
|
hookError: Error | undefined;
|
|
44
|
+
monitor?: Monitor;
|
|
97
45
|
static screenshotPath: string;
|
|
98
46
|
static createContext(options: RunOptions): Promise<JourneyContext>;
|
|
99
47
|
captureScreenshot(page: Driver['page'], step: Step): Promise<void>;
|
|
48
|
+
get currentJourney(): Journey;
|
|
100
49
|
addHook(type: HookType, callback: HooksCallback): void;
|
|
50
|
+
updateMonitor(config: MonitorConfig): void;
|
|
101
51
|
addJourney(journey: Journey): void;
|
|
52
|
+
setReporter(options: RunOptions): void;
|
|
102
53
|
runBeforeAllHook(args: HooksArgs): Promise<void>;
|
|
103
54
|
runAfterAllHook(args: HooksArgs): Promise<void>;
|
|
104
55
|
runBeforeHook(journey: Journey, args: HooksArgs): Promise<void>;
|
|
@@ -113,6 +64,7 @@ export default class Runner extends EventEmitter {
|
|
|
113
64
|
runFakeJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
|
|
114
65
|
runJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
|
|
115
66
|
init(options: RunOptions): Promise<void>;
|
|
67
|
+
buildMonitors(options: RunOptions): Monitor[];
|
|
116
68
|
run(options: RunOptions): Promise<RunResult>;
|
|
117
69
|
reset(): Promise<void>;
|
|
118
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAWnC,OAAO,EACL,aAAa,EACb,MAAM,EACN,SAAS,EACT,MAAM,EAEN,UAAU,EACV,aAAa,EACb,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExD,aAAK,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;AACzC,oBAAY,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAEhE,aAAK,cAAc,GAAG;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,aAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,MAAM;;IAIzB,QAAQ,EAAE,OAAO,EAAE,CAAM;IACzB,KAAK,EAAE,UAAU,CAAmC;IACpD,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,cAAc,SAAmC;WAE3C,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAqBlE,iBAAi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