@elastic/synthetics 1.0.0-beta.22 → 1.0.0-beta.25
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 +23 -0
- package/NOTICE.txt +0 -29
- package/dist/cli.js +55 -184
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +43 -36
- package/dist/common_types.d.ts.map +1 -1
- package/dist/core/gatherer.d.ts +2 -3
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +17 -9
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -9
- package/dist/core/index.js.map +1 -1
- package/dist/core/runner.d.ts +1 -8
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +2 -3
- package/dist/core/runner.js.map +1 -1
- package/dist/dsl/journey.d.ts +4 -3
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +4 -3
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/step.d.ts +3 -2
- package/dist/dsl/step.d.ts.map +1 -1
- package/dist/dsl/step.js +2 -1
- package/dist/dsl/step.js.map +1 -1
- package/dist/formatter/javascript.d.ts +31 -6
- package/dist/formatter/javascript.d.ts.map +1 -1
- package/dist/formatter/javascript.js +45 -24
- package/dist/formatter/javascript.js.map +1 -1
- package/dist/helpers.d.ts +2 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +30 -1
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/{parse_args.d.ts → loader.d.ts} +2 -5
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +144 -0
- package/dist/loader.js.map +1 -0
- package/dist/options.d.ts +27 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +108 -0
- package/dist/options.js.map +1 -0
- package/dist/plugins/network.d.ts +17 -33
- 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/plugin-manager.d.ts +1 -1
- 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/reporters/json.d.ts +0 -1
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +5 -24
- package/dist/reporters/json.js.map +1 -1
- package/dist/sdk/trace-metrics.js +3 -4
- package/dist/sdk/trace-metrics.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/cli.ts +114 -188
- package/src/common_types.ts +47 -36
- package/src/core/gatherer.ts +17 -10
- package/src/core/index.ts +22 -16
- package/src/core/runner.ts +3 -23
- package/src/dsl/journey.ts +10 -4
- package/src/dsl/step.ts +9 -2
- package/src/formatter/javascript.ts +59 -22
- package/src/helpers.ts +40 -1
- package/src/index.ts +10 -16
- package/src/loader.ts +162 -0
- package/src/options.ts +116 -0
- package/src/plugins/network.ts +218 -293
- package/src/plugins/plugin-manager.ts +2 -2
- package/src/reporters/json.ts +1 -17
- package/dist/parse_args.d.ts.map +0 -1
- package/dist/parse_args.js +0 -103
- package/dist/parse_args.js.map +0 -1
- package/src/parse_args.ts +0 -158
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## v1.0.0-beta.23 (2021-03-23)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Add location metadata for journeys and step #474
|
|
10
|
+
- Export Action type from the Synthetics formatter #454
|
|
11
|
+
- Enhance the synthetics formatter to control when the step begins and ends #457
|
|
12
|
+
- Add ability to add subcommands to the cli in #475
|
|
13
|
+
|
|
14
|
+
## v1.0.0-beta.22 (2021-03-14)
|
|
15
|
+
|
|
16
|
+
### Bug fixes
|
|
17
|
+
|
|
18
|
+
- Empty the write buffer before exit the Node.js process #446
|
|
19
|
+
- Reduce the network information data by writing only the
|
|
20
|
+
necessary fields #466
|
|
21
|
+
|
|
22
|
+
## v1.0.0-beta.21 (2021-02-22)
|
|
23
|
+
|
|
24
|
+
### Bug fixes
|
|
25
|
+
|
|
26
|
+
- Do not override User agent string when doing device emulation #462
|
|
27
|
+
|
|
5
28
|
## v1.0.0-beta.20 (2021-02-16)
|
|
6
29
|
|
|
7
30
|
### Bug fixes
|
package/NOTICE.txt
CHANGED
|
@@ -219,32 +219,3 @@ This product relies on `expect`
|
|
|
219
219
|
*
|
|
220
220
|
*/
|
|
221
221
|
---------------------------------------------------------------------------
|
|
222
|
-
This product relies on `ChromeDevTools/devtools-frontend`
|
|
223
|
-
|
|
224
|
-
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
225
|
-
//
|
|
226
|
-
// Redistribution and use in source and binary forms, with or without
|
|
227
|
-
// modification, are permitted provided that the following conditions are
|
|
228
|
-
// met:
|
|
229
|
-
//
|
|
230
|
-
// * Redistributions of source code must retain the above copyright
|
|
231
|
-
// notice, this list of conditions and the following disclaimer.
|
|
232
|
-
// * Redistributions in binary form must reproduce the above
|
|
233
|
-
// copyright notice, this list of conditions and the following disclaimer
|
|
234
|
-
// in the documentation and/or other materials provided with the
|
|
235
|
-
// distribution.
|
|
236
|
-
// * Neither the name of Google Inc. nor the names of its
|
|
237
|
-
// contributors may be used to endorse or promote products derived from
|
|
238
|
-
// this software without specific prior written permission.
|
|
239
|
-
//
|
|
240
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
241
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
242
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
243
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
244
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
245
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
246
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
247
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
248
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
249
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
250
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/dist/cli.js
CHANGED
|
@@ -24,199 +24,70 @@
|
|
|
24
24
|
* THE SOFTWARE.
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
30
|
-
}) : (function(o, m, k, k2) {
|
|
31
|
-
if (k2 === undefined) k2 = k;
|
|
32
|
-
o[k2] = m[k];
|
|
33
|
-
}));
|
|
34
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
-
}) : function(o, v) {
|
|
37
|
-
o["default"] = v;
|
|
38
|
-
});
|
|
39
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
40
|
-
if (mod && mod.__esModule) return mod;
|
|
41
|
-
var result = {};
|
|
42
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
43
|
-
__setModuleDefault(result, mod);
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
53
|
-
const core_1 = require("./core");
|
|
54
|
-
const logger_1 = require("./core/logger");
|
|
55
|
-
const parse_args_1 = __importStar(require("./parse_args"));
|
|
56
|
-
const expect_1 = require("./core/expect");
|
|
28
|
+
const commander_1 = require("commander");
|
|
29
|
+
const reporters_1 = require("./reporters");
|
|
57
30
|
const helpers_1 = require("./helpers");
|
|
31
|
+
const options_1 = require("./options");
|
|
32
|
+
const loader_1 = require("./loader");
|
|
58
33
|
const _1 = require("./");
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
for (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const addSuite = absPath => {
|
|
96
|
-
(0, logger_1.log)(`Processing file: ${absPath}`);
|
|
97
|
-
suites.add(require.resolve(absPath));
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Match all files inside the directory with the
|
|
101
|
-
* .journey.{mjs|cjs|js|ts) extensions
|
|
102
|
-
*/
|
|
103
|
-
const pattern = parse_args_1.options.pattern
|
|
104
|
-
? new RegExp(parse_args_1.options.pattern, 'i')
|
|
105
|
-
: /.+\.journey\.([mc]js|[jt]s?)$/;
|
|
106
|
-
/**
|
|
107
|
-
* Ignore node_modules by default when running suites
|
|
108
|
-
*/
|
|
109
|
-
const ignored = /node_modules/i;
|
|
110
|
-
for (const input of inputs) {
|
|
111
|
-
const absPath = (0, path_1.resolve)(resolvedCwd, input);
|
|
34
|
+
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
|
|
35
|
+
const { name, version } = require('../package.json');
|
|
36
|
+
commander_1.program
|
|
37
|
+
.name(`npx ${name}`)
|
|
38
|
+
.usage('[options] [dir] [files] file')
|
|
39
|
+
.option('-c, --config <path>', 'configuration path (default: synthetics.config.js)')
|
|
40
|
+
.option('-p, --params <jsonstring>', 'JSON object that gets injected to all journeys', JSON.parse)
|
|
41
|
+
.addOption(new commander_1.Option('--reporter <value>', `output repoter format`).choices(Object.keys(reporters_1.reporters)))
|
|
42
|
+
.option('--pattern <pattern>', 'RegExp file patterns to search inside directory')
|
|
43
|
+
.option('--inline', 'Run inline journeys from heartbeat')
|
|
44
|
+
.option('-r, --require <modules...>', 'module(s) to preload')
|
|
45
|
+
.option('--no-headless', 'run browser in headful mode')
|
|
46
|
+
.option('--sandbox', 'enable chromium sandboxing', false)
|
|
47
|
+
.option('--rich-events', 'Mimics a heartbeat run')
|
|
48
|
+
.option('--capability <features...>', 'Enable capabilities through feature flags')
|
|
49
|
+
.addOption(new commander_1.Option('--screenshots [flag]', 'take screenshots at end of each step')
|
|
50
|
+
.choices(['on', 'off', 'only-on-failure'])
|
|
51
|
+
.default('on'))
|
|
52
|
+
.option('--dry-run', "don't actually execute anything, report only registered journeys")
|
|
53
|
+
.option('--match <name>', 'run only journeys with a name or tags that matches the glob')
|
|
54
|
+
.option('--tags <name...>', 'run only journeys with the given tag(s), or globs')
|
|
55
|
+
.option('--outfd <fd>', 'specify a file descriptor for logs. Default is stdout', parseInt)
|
|
56
|
+
.option('--ws-endpoint <endpoint>', 'Browser WebSocket endpoint to connect to')
|
|
57
|
+
.option('--pause-on-error', 'pause on error until a keypress is made in the console. Useful during development')
|
|
58
|
+
.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
|
+
.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 <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.', helpers_1.DEFAULT_NETWORK_CONDITIONS_ARG)
|
|
61
|
+
.option('--no-throttling', 'Turns off default network throttling.')
|
|
62
|
+
.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
|
+
.version(version)
|
|
64
|
+
.description('Run synthetic tests')
|
|
65
|
+
.action(async (cliArgs) => {
|
|
66
|
+
try {
|
|
67
|
+
await (0, loader_1.loadTestFiles)(cliArgs, commander_1.program.args);
|
|
68
|
+
const options = (0, options_1.normalizeOptions)(cliArgs);
|
|
69
|
+
const results = await (0, _1.run)(options);
|
|
112
70
|
/**
|
|
113
|
-
*
|
|
114
|
-
* the suites
|
|
71
|
+
* Exit with error status if any journey fails
|
|
115
72
|
*/
|
|
116
|
-
(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
addSuite(abs);
|
|
73
|
+
if (!options.quietExitCode) {
|
|
74
|
+
for (const result of Object.values(results)) {
|
|
75
|
+
if (result.status === 'failed') {
|
|
76
|
+
process.exit(1);
|
|
121
77
|
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
addSuite(absPath);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return suites.values();
|
|
129
|
-
}
|
|
130
|
-
(async () => {
|
|
131
|
-
/**
|
|
132
|
-
* Transform `.ts` files out of the box by invoking
|
|
133
|
-
* the `ts-node` via `transpile-only` mode that compiles
|
|
134
|
-
* TS files without doing any extensive type checks.
|
|
135
|
-
*
|
|
136
|
-
* We must register `ts-node` _before_ loading inline
|
|
137
|
-
* scripts too because otherwise we will not be able to
|
|
138
|
-
* require `.ts` configuration files.
|
|
139
|
-
*/
|
|
140
|
-
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
|
|
141
|
-
require('ts-node').register({
|
|
142
|
-
transpileOnly: true,
|
|
143
|
-
compilerOptions: {
|
|
144
|
-
esModuleInterop: true,
|
|
145
|
-
allowJs: true,
|
|
146
|
-
target: 'es2018',
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
if (parse_args_1.options.inline) {
|
|
150
|
-
const source = await readStdin();
|
|
151
|
-
loadInlineScript(source);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
/**
|
|
155
|
-
* Preload modules before running the suites
|
|
156
|
-
*/
|
|
157
|
-
const modules = [].concat(parse_args_1.options.require || []).filter(Boolean);
|
|
158
|
-
for (const name of modules) {
|
|
159
|
-
if ((0, helpers_1.isDepInstalled)(name)) {
|
|
160
|
-
require(name);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
throw new Error(`cannot find module '${name}'`);
|
|
164
78
|
}
|
|
165
79
|
}
|
|
166
|
-
/**
|
|
167
|
-
* Handle piped files by reading the STDIN
|
|
168
|
-
* ex: ls example/suites/*.js | npx @elastic/synthetics
|
|
169
|
-
*/
|
|
170
|
-
const files = parse_args_1.default.args.length > 0
|
|
171
|
-
? parse_args_1.default.args
|
|
172
|
-
: (await readStdin()).split('\n').filter(Boolean);
|
|
173
|
-
const suites = await prepareSuites(files);
|
|
174
|
-
requireSuites(suites);
|
|
175
80
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const environment = process.env['NODE_ENV'] || 'development';
|
|
180
|
-
/**
|
|
181
|
-
* Validate and handle configs
|
|
182
|
-
*/
|
|
183
|
-
const config = parse_args_1.options.config || !parse_args_1.options.inline
|
|
184
|
-
? (0, config_1.readConfig)(environment, parse_args_1.options.config)
|
|
185
|
-
: {};
|
|
186
|
-
const params = (0, deepmerge_1.default)(config.params, parse_args_1.options.params || {});
|
|
187
|
-
/**
|
|
188
|
-
* Favor playwright options passed via cli to inline playwright options
|
|
189
|
-
*/
|
|
190
|
-
const playwrightOptions = deepmerge_1.default.all([
|
|
191
|
-
config.playwrightOptions || {},
|
|
192
|
-
parse_args_1.options.playwrightOptions || {},
|
|
193
|
-
{
|
|
194
|
-
headless: parse_args_1.options.headless,
|
|
195
|
-
chromiumSandbox: parse_args_1.options.sandbox,
|
|
196
|
-
ignoreHTTPSErrors: parse_args_1.options.ignoreHttpsErrors,
|
|
197
|
-
},
|
|
198
|
-
]);
|
|
199
|
-
const results = await (0, _1.run)({
|
|
200
|
-
params: Object.freeze(params),
|
|
201
|
-
networkConditions: parse_args_1.options.throttling
|
|
202
|
-
? (0, helpers_1.parseNetworkConditions)(parse_args_1.options.throttling)
|
|
203
|
-
: undefined,
|
|
204
|
-
environment,
|
|
205
|
-
playwrightOptions,
|
|
206
|
-
...parse_args_1.options,
|
|
207
|
-
});
|
|
208
|
-
if (!parse_args_1.options.quietExitCode) {
|
|
209
|
-
/**
|
|
210
|
-
* Exit with error status if any journey fails
|
|
211
|
-
*/
|
|
212
|
-
for (const result of Object.values(results)) {
|
|
213
|
-
if (result.status === 'failed') {
|
|
214
|
-
process.exit(1);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
console.error(e);
|
|
83
|
+
process.exit(1);
|
|
217
84
|
}
|
|
218
|
-
})().catch(e => {
|
|
219
|
-
console.error(e);
|
|
220
|
-
process.exit(1);
|
|
221
85
|
});
|
|
86
|
+
commander_1.program
|
|
87
|
+
.command('push')
|
|
88
|
+
.description('Push monitors to create new montors with Kibana monitor management UI')
|
|
89
|
+
.action(() => {
|
|
90
|
+
throw new Error('TODO: Implement me');
|
|
91
|
+
});
|
|
92
|
+
commander_1.program.parse(process.argv);
|
|
222
93
|
//# 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
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,yCAA4C;AAE5C,2CAAwC;AACxC,uCAA2D;AAC3D,uCAA6C;AAC7C,qCAAyC;AACzC,yBAAyB;AAEzB,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,EAAE,KAAK,CAAC;KACxD,MAAM,CAAC,eA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,EAAE;gBAC3C,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE;oBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACjB;aACF;SACF;KACF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CACV,uEAAuE,CACxE;KACA,MAAM,CAAC,GAAG,EAAE;IACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/common_types.d.ts
CHANGED
|
@@ -23,17 +23,15 @@
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
import { BrowserContextOptions, LaunchOptions, CDPSession, ChromiumBrowser, ChromiumBrowserContext, Page } from 'playwright-chromium';
|
|
26
|
-
import { Protocol } from 'playwright-chromium/types/protocol';
|
|
27
26
|
import { Step } from './dsl';
|
|
28
|
-
import { reporters } from './reporters';
|
|
27
|
+
import { Reporter, reporters } from './reporters';
|
|
29
28
|
export declare type VoidCallback = () => void;
|
|
30
|
-
export declare type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
uploadThroughput: number;
|
|
35
|
-
latency: number;
|
|
29
|
+
export declare type Location = {
|
|
30
|
+
file: string;
|
|
31
|
+
line: number;
|
|
32
|
+
column: number;
|
|
36
33
|
};
|
|
34
|
+
export declare type Params = Record<string, any>;
|
|
37
35
|
export declare type HooksArgs = {
|
|
38
36
|
env: string;
|
|
39
37
|
params: Params;
|
|
@@ -41,6 +39,12 @@ export declare type HooksArgs = {
|
|
|
41
39
|
export declare type HooksCallback = (args: HooksArgs) => void;
|
|
42
40
|
export declare type StatusValue = 'succeeded' | 'failed' | 'skipped';
|
|
43
41
|
export declare type Reporters = keyof typeof reporters;
|
|
42
|
+
export declare type NetworkConditions = {
|
|
43
|
+
offline: boolean;
|
|
44
|
+
downloadThroughput: number;
|
|
45
|
+
uploadThroughput: number;
|
|
46
|
+
latency: number;
|
|
47
|
+
};
|
|
44
48
|
export declare type Driver = {
|
|
45
49
|
browser: ChromiumBrowser;
|
|
46
50
|
context: ChromiumBrowserContext;
|
|
@@ -101,11 +105,9 @@ export declare type Request = {
|
|
|
101
105
|
};
|
|
102
106
|
export declare type Response = {
|
|
103
107
|
url?: string;
|
|
104
|
-
protocol?: string;
|
|
105
108
|
status: number;
|
|
106
109
|
statusText?: string;
|
|
107
|
-
mimeType
|
|
108
|
-
httpVersion?: string;
|
|
110
|
+
mimeType?: string;
|
|
109
111
|
headers: Record<string, string>;
|
|
110
112
|
bytes?: number;
|
|
111
113
|
body?: {
|
|
@@ -117,26 +119,23 @@ export declare type Response = {
|
|
|
117
119
|
remoteIPAddress?: string;
|
|
118
120
|
remotePort?: number;
|
|
119
121
|
fromServiceWorker?: boolean;
|
|
120
|
-
timing?: Protocol.Network.ResourceTiming;
|
|
121
122
|
};
|
|
122
123
|
export declare type NetworkInfo = {
|
|
123
124
|
url: string;
|
|
124
125
|
browser: BrowserInfo;
|
|
125
126
|
type: string;
|
|
126
127
|
request: Request;
|
|
127
|
-
response
|
|
128
|
+
response: Response;
|
|
128
129
|
isNavigationRequest: boolean;
|
|
129
130
|
requestSentTime: number;
|
|
130
131
|
loadEndTime: number;
|
|
131
132
|
responseReceivedTime: number;
|
|
132
133
|
resourceSize: number;
|
|
133
134
|
transferSize: number;
|
|
134
|
-
timings
|
|
135
|
+
timings: {
|
|
135
136
|
blocked: number;
|
|
136
|
-
queueing: number;
|
|
137
137
|
dns: number;
|
|
138
138
|
ssl: number;
|
|
139
|
-
proxy: number;
|
|
140
139
|
connect: number;
|
|
141
140
|
send: number;
|
|
142
141
|
wait: number;
|
|
@@ -157,34 +156,42 @@ export declare type PluginOutput = {
|
|
|
157
156
|
metrics?: PerfMetrics;
|
|
158
157
|
};
|
|
159
158
|
export declare type ScreenshotOptions = 'on' | 'off' | 'only-on-failure';
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
config?: string;
|
|
163
|
-
outfd?: number;
|
|
164
|
-
headless?: boolean;
|
|
159
|
+
declare type BaseArgs = {
|
|
160
|
+
params?: Params;
|
|
165
161
|
screenshots?: ScreenshotOptions;
|
|
166
|
-
ssblocks?: boolean;
|
|
167
|
-
metrics?: boolean;
|
|
168
|
-
filmstrips?: boolean;
|
|
169
|
-
trace?: boolean;
|
|
170
162
|
dryRun?: boolean;
|
|
171
|
-
|
|
163
|
+
match?: string;
|
|
164
|
+
tags?: Array<string>;
|
|
165
|
+
outfd?: number;
|
|
166
|
+
wsEndpoint?: string;
|
|
172
167
|
pauseOnError?: boolean;
|
|
168
|
+
ignoreHttpsErrors?: boolean;
|
|
169
|
+
playwrightOptions?: PlaywrightOptions;
|
|
173
170
|
quietExitCode?: boolean;
|
|
171
|
+
};
|
|
172
|
+
export declare type CliArgs = BaseArgs & {
|
|
173
|
+
config?: string;
|
|
174
174
|
reporter?: Reporters;
|
|
175
|
-
wsEndpoint?: string;
|
|
176
|
-
sandbox?: boolean;
|
|
177
175
|
pattern?: string;
|
|
178
|
-
inline
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
inline?: boolean;
|
|
177
|
+
require?: Array<string>;
|
|
178
|
+
headless?: boolean;
|
|
179
|
+
sandbox?: boolean;
|
|
180
|
+
richEvents?: boolean;
|
|
181
|
+
capability?: Array<string>;
|
|
183
182
|
ignoreHttpsErrors?: boolean;
|
|
184
|
-
params?: Params;
|
|
185
183
|
throttling?: boolean | string;
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
};
|
|
185
|
+
export declare type RunOptions = BaseArgs & {
|
|
186
|
+
metrics?: boolean;
|
|
187
|
+
ssblocks?: boolean;
|
|
188
|
+
network?: boolean;
|
|
189
|
+
trace?: boolean;
|
|
190
|
+
filmstrips?: boolean;
|
|
191
|
+
environment?: string;
|
|
192
|
+
playwrightOptions?: PlaywrightOptions;
|
|
193
|
+
networkConditions?: NetworkConditions;
|
|
194
|
+
reporter?: CliArgs['reporter'] | Reporter;
|
|
188
195
|
};
|
|
189
196
|
export declare type PlaywrightOptions = LaunchOptions & BrowserContextOptions;
|
|
190
197
|
export declare type SyntheticsConfig = {
|
|
@@ -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,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,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;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CAAC;IACtC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;CAC3C,CAAC;AAEF,oBAAY,iBAAiB,GAAG,aAAa,GAAG,qBAAqB,CAAC;AACtE,oBAAY,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC,CAAC"}
|
package/dist/core/gatherer.d.ts
CHANGED
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { ChromiumBrowser, BrowserContext } from 'playwright-chromium';
|
|
26
26
|
import { PluginManager } from '../plugins';
|
|
27
|
-
import { RunOptions } from '
|
|
28
|
-
import { Driver } from '../common_types';
|
|
27
|
+
import { Driver, RunOptions } from '../common_types';
|
|
29
28
|
/**
|
|
30
29
|
* Purpose of the Gatherer is to set up the necessary browser driver
|
|
31
30
|
* related capabilities for the runner to run all journeys
|
|
@@ -34,7 +33,7 @@ export declare class Gatherer {
|
|
|
34
33
|
static browser: ChromiumBrowser;
|
|
35
34
|
static setupDriver(options: RunOptions): Promise<Driver>;
|
|
36
35
|
static getUserAgent(userAgent?: string): Promise<string>;
|
|
37
|
-
static setNetworkConditions(context: BrowserContext, networkConditions: RunOptions['networkConditions']):
|
|
36
|
+
static setNetworkConditions(context: BrowserContext, networkConditions: RunOptions['networkConditions']): void;
|
|
38
37
|
/**
|
|
39
38
|
* Starts recording all events related to the v8 devtools protocol
|
|
40
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;
|
|
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;AAErD;;;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,UAAU,CAAC,mBAAmB,CAAC;IAsBpD;;;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
|
@@ -34,7 +34,6 @@ const logger_1 = require("./logger");
|
|
|
34
34
|
*/
|
|
35
35
|
class Gatherer {
|
|
36
36
|
static async setupDriver(options) {
|
|
37
|
-
var _a;
|
|
38
37
|
(0, logger_1.log)('Gatherer: setup driver');
|
|
39
38
|
const { wsEndpoint, playwrightOptions, networkConditions } = options;
|
|
40
39
|
if (Gatherer.browser == null) {
|
|
@@ -46,17 +45,17 @@ class Gatherer {
|
|
|
46
45
|
Gatherer.browser = await playwright_chromium_1.chromium.launch({
|
|
47
46
|
...playwrightOptions,
|
|
48
47
|
args: [
|
|
49
|
-
...(
|
|
50
|
-
...(
|
|
48
|
+
...(playwrightOptions?.headless ? ['--disable-gpu'] : []),
|
|
49
|
+
...(playwrightOptions?.args ?? []),
|
|
51
50
|
],
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
const context = await Gatherer.browser.newContext({
|
|
56
55
|
...playwrightOptions,
|
|
57
|
-
userAgent: await Gatherer.getUserAgent(playwrightOptions
|
|
56
|
+
userAgent: await Gatherer.getUserAgent(playwrightOptions?.userAgent),
|
|
58
57
|
});
|
|
59
|
-
|
|
58
|
+
Gatherer.setNetworkConditions(context, networkConditions);
|
|
60
59
|
const page = await context.newPage();
|
|
61
60
|
const client = await context.newCDPSession(page);
|
|
62
61
|
return { browser: Gatherer.browser, context, page, client };
|
|
@@ -69,12 +68,21 @@ class Gatherer {
|
|
|
69
68
|
}
|
|
70
69
|
return userAgent + syntheticsIdentifier;
|
|
71
70
|
}
|
|
72
|
-
static
|
|
71
|
+
static setNetworkConditions(context, networkConditions) {
|
|
73
72
|
if (networkConditions) {
|
|
74
|
-
context.on('page',
|
|
73
|
+
context.on('page', page => {
|
|
75
74
|
const context = page.context();
|
|
76
|
-
const
|
|
77
|
-
|
|
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
|
+
]);
|
|
78
86
|
});
|
|
79
87
|
}
|
|
80
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,6DAAgF;AAChF,wCAA2C;
|
|
1
|
+
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../src/core/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AAG,OAAO,CAAC;QACrC,MAAM,aAAa,GAAG,IAAI,uBAAa,CAAC,MAAM,CAAC,CAAC;QAChD,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,OAAO,GAAG,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,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
|
@@ -26,7 +26,7 @@ import { Journey, JourneyCallback, JourneyOptions } from '../dsl';
|
|
|
26
26
|
import Runner from './runner';
|
|
27
27
|
import { VoidCallback, HooksCallback } from '../common_types';
|
|
28
28
|
export declare const runner: Runner;
|
|
29
|
-
export declare const journey: (options:
|
|
29
|
+
export declare const journey: (options: string | JourneyOptions, callback: JourneyCallback) => Journey;
|
|
30
30
|
export declare const step: (name: string, callback: VoidCallback) => import("../dsl").Step;
|
|
31
31
|
export declare const beforeAll: (callback: HooksCallback) => void;
|
|
32
32
|
export declare const afterAll: (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,
|
|
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;AAaxE,eAAO,MAAM,MAAM,EAAE,MAAkC,CAAC;AAExD,eAAO,MAAM,OAAO,0EAcnB,CAAC;AAEF,eAAO,MAAM,IAAI,iEAKhB,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"}
|