@elastic/synthetics 1.0.0-beta.22 → 1.0.0-beta.23
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 +14 -0
- package/dist/cli.js +55 -184
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +40 -27
- package/dist/common_types.d.ts.map +1 -1
- package/dist/core/gatherer.d.ts +1 -2
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +3 -4
- 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 +1 -2
- 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 +30 -5
- package/dist/formatter/javascript.d.ts.map +1 -1
- package/dist/formatter/javascript.js +44 -23
- 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 +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -18
- 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 +1 -4
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +2 -3
- package/dist/plugins/network.js.map +1 -1
- package/dist/reporters/json.js +5 -6
- 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 +3 -3
- package/src/cli.ts +114 -188
- package/src/common_types.ts +44 -27
- package/src/core/gatherer.ts +1 -2
- package/src/core/index.ts +22 -16
- package/src/core/runner.ts +2 -22
- package/src/dsl/journey.ts +10 -4
- package/src/dsl/step.ts +9 -2
- package/src/formatter/javascript.ts +58 -21
- 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/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,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## v1.0.0-beta.22 (2021-03-14)
|
|
6
|
+
|
|
7
|
+
### Bug fixes
|
|
8
|
+
|
|
9
|
+
- Empty the write buffer before exit the Node.js process #446
|
|
10
|
+
- Reduce the network information data by writing only the
|
|
11
|
+
necessary fields #466
|
|
12
|
+
|
|
13
|
+
## v1.0.0-beta.21 (2021-02-22)
|
|
14
|
+
|
|
15
|
+
### Bug fixes
|
|
16
|
+
|
|
17
|
+
- Do not override User agent string when doing device emulation #462
|
|
18
|
+
|
|
5
19
|
## v1.0.0-beta.20 (2021-02-16)
|
|
6
20
|
|
|
7
21
|
### Bug fixes
|
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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,CAAC;KAClE,MAAM,CACL,mCAAmC,EACnC,4NAA4N,EAC5N,IAAI,CAAC,KAAK,CACX;KACA,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,qBAAqB,CAAC;KAClC,MAAM,CAAC,KAAK,EAAE,OAAgB,EAAE,EAAE;IACjC,IAAI;QACF,MAAM,IAAA,sBAAa,EAAC,OAAO,EAAE,mBAAO,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,MAAM,IAAA,MAAG,EAAC,OAAO,CAAC,CAAC;QACnC;;WAEG;QACH,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YAC1B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,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
|
@@ -25,15 +25,14 @@
|
|
|
25
25
|
import { BrowserContextOptions, LaunchOptions, CDPSession, ChromiumBrowser, ChromiumBrowserContext, Page } from 'playwright-chromium';
|
|
26
26
|
import { Protocol } from 'playwright-chromium/types/protocol';
|
|
27
27
|
import { Step } from './dsl';
|
|
28
|
-
import { reporters } from './reporters';
|
|
28
|
+
import { Reporter, reporters } from './reporters';
|
|
29
29
|
export declare type VoidCallback = () => void;
|
|
30
|
-
export declare type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
uploadThroughput: number;
|
|
35
|
-
latency: number;
|
|
30
|
+
export declare type Location = {
|
|
31
|
+
file: string;
|
|
32
|
+
line: number;
|
|
33
|
+
column: number;
|
|
36
34
|
};
|
|
35
|
+
export declare type Params = Record<string, any>;
|
|
37
36
|
export declare type HooksArgs = {
|
|
38
37
|
env: string;
|
|
39
38
|
params: Params;
|
|
@@ -41,6 +40,12 @@ export declare type HooksArgs = {
|
|
|
41
40
|
export declare type HooksCallback = (args: HooksArgs) => void;
|
|
42
41
|
export declare type StatusValue = 'succeeded' | 'failed' | 'skipped';
|
|
43
42
|
export declare type Reporters = keyof typeof reporters;
|
|
43
|
+
export declare type NetworkConditions = {
|
|
44
|
+
offline: boolean;
|
|
45
|
+
downloadThroughput: number;
|
|
46
|
+
uploadThroughput: number;
|
|
47
|
+
latency: number;
|
|
48
|
+
};
|
|
44
49
|
export declare type Driver = {
|
|
45
50
|
browser: ChromiumBrowser;
|
|
46
51
|
context: ChromiumBrowserContext;
|
|
@@ -157,34 +162,42 @@ export declare type PluginOutput = {
|
|
|
157
162
|
metrics?: PerfMetrics;
|
|
158
163
|
};
|
|
159
164
|
export declare type ScreenshotOptions = 'on' | 'off' | 'only-on-failure';
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
config?: string;
|
|
163
|
-
outfd?: number;
|
|
164
|
-
headless?: boolean;
|
|
165
|
+
declare type BaseArgs = {
|
|
166
|
+
params?: Params;
|
|
165
167
|
screenshots?: ScreenshotOptions;
|
|
166
|
-
ssblocks?: boolean;
|
|
167
|
-
metrics?: boolean;
|
|
168
|
-
filmstrips?: boolean;
|
|
169
|
-
trace?: boolean;
|
|
170
168
|
dryRun?: boolean;
|
|
171
|
-
|
|
169
|
+
match?: string;
|
|
170
|
+
tags?: Array<string>;
|
|
171
|
+
outfd?: number;
|
|
172
|
+
wsEndpoint?: string;
|
|
172
173
|
pauseOnError?: boolean;
|
|
174
|
+
ignoreHttpsErrors?: boolean;
|
|
175
|
+
playwrightOptions?: PlaywrightOptions;
|
|
173
176
|
quietExitCode?: boolean;
|
|
177
|
+
};
|
|
178
|
+
export declare type CliArgs = BaseArgs & {
|
|
179
|
+
config?: string;
|
|
174
180
|
reporter?: Reporters;
|
|
175
|
-
wsEndpoint?: string;
|
|
176
|
-
sandbox?: boolean;
|
|
177
181
|
pattern?: string;
|
|
178
|
-
inline
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
inline?: boolean;
|
|
183
|
+
require?: Array<string>;
|
|
184
|
+
headless?: boolean;
|
|
185
|
+
sandbox?: boolean;
|
|
186
|
+
richEvents?: boolean;
|
|
187
|
+
capability?: Array<string>;
|
|
183
188
|
ignoreHttpsErrors?: boolean;
|
|
184
|
-
params?: Params;
|
|
185
189
|
throttling?: boolean | string;
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
};
|
|
191
|
+
export declare type RunOptions = BaseArgs & {
|
|
192
|
+
metrics?: boolean;
|
|
193
|
+
ssblocks?: boolean;
|
|
194
|
+
network?: boolean;
|
|
195
|
+
trace?: boolean;
|
|
196
|
+
filmstrips?: boolean;
|
|
197
|
+
environment?: string;
|
|
198
|
+
playwrightOptions?: PlaywrightOptions;
|
|
199
|
+
networkConditions?: NetworkConditions;
|
|
200
|
+
reporter?: CliArgs['reporter'] | Reporter;
|
|
188
201
|
};
|
|
189
202
|
export declare type PlaywrightOptions = LaunchOptions & BrowserContextOptions;
|
|
190
203
|
export declare type SyntheticsConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common_types.d.ts","sourceRoot":"","sources":["../src/common_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAE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,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
|
|
@@ -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;WAS/B,oBAAoB,CAC/B,OAAO,EAAE,cAAc,EACvB,iBAAiB,EAAE,UAAU,CAAC,mBAAmB,CAAC;IAcpD;;;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,15 +45,15 @@ 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
|
await Gatherer.setNetworkConditions(context, networkConditions);
|
|
60
59
|
const page = await context.newPage();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;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W,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;AAnFD,4BAmFC"}
|
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"}
|
package/dist/core/index.js
CHANGED
|
@@ -30,6 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
exports.after = exports.before = exports.afterAll = exports.beforeAll = exports.step = exports.journey = exports.runner = void 0;
|
|
31
31
|
const dsl_1 = require("../dsl");
|
|
32
32
|
const runner_1 = __importDefault(require("./runner"));
|
|
33
|
+
const helpers_1 = require("../helpers");
|
|
33
34
|
const logger_1 = require("./logger");
|
|
34
35
|
/**
|
|
35
36
|
* Use a gloabl Runner which would be accessed by the runtime and
|
|
@@ -40,22 +41,19 @@ if (!global[SYNTHETICS_RUNNER]) {
|
|
|
40
41
|
global[SYNTHETICS_RUNNER] = new runner_1.default();
|
|
41
42
|
}
|
|
42
43
|
exports.runner = global[SYNTHETICS_RUNNER];
|
|
43
|
-
|
|
44
|
+
exports.journey = (0, helpers_1.wrapFnWithLocation)((location, options, callback) => {
|
|
44
45
|
(0, logger_1.log)(`register journey: ${JSON.stringify(options)}`);
|
|
45
46
|
if (typeof options === 'string') {
|
|
46
47
|
options = { name: options, id: options };
|
|
47
48
|
}
|
|
48
|
-
const j = new dsl_1.Journey(options, callback);
|
|
49
|
+
const j = new dsl_1.Journey(options, callback, location);
|
|
49
50
|
exports.runner.addJourney(j);
|
|
50
51
|
return j;
|
|
51
|
-
};
|
|
52
|
-
exports.
|
|
53
|
-
const step = (name, callback) => {
|
|
54
|
-
var _a;
|
|
52
|
+
});
|
|
53
|
+
exports.step = (0, helpers_1.wrapFnWithLocation)((location, name, callback) => {
|
|
55
54
|
(0, logger_1.log)(`register step: ${name}`);
|
|
56
|
-
return
|
|
57
|
-
};
|
|
58
|
-
exports.step = step;
|
|
55
|
+
return exports.runner.currentJourney?.addStep(name, callback, location);
|
|
56
|
+
});
|
|
59
57
|
const beforeAll = (callback) => {
|
|
60
58
|
exports.runner.addHook('beforeAll', callback);
|
|
61
59
|
};
|
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,qCAA+B;AAE/B;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAC1D,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE;IAC9B,MAAM,CAAC,iBAAiB,CAAC,GAAG,IAAI,gBAAM,EAAE,CAAC;CAC1C;AAEY,QAAA,MAAM,GAAW,MAAM,CAAC,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"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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
|
@@ -26,15 +26,8 @@
|
|
|
26
26
|
import { EventEmitter } from 'events';
|
|
27
27
|
import { Journey } from '../dsl/journey';
|
|
28
28
|
import { Step } from '../dsl/step';
|
|
29
|
-
import {
|
|
30
|
-
import { StatusValue, HooksCallback, Params, NetworkConditions, PluginOutput, CliArgs, HooksArgs, PlaywrightOptions, Driver } from '../common_types';
|
|
29
|
+
import { StatusValue, HooksCallback, Params, NetworkConditions, PluginOutput, HooksArgs, Driver, RunOptions } from '../common_types';
|
|
31
30
|
import { PageMetrics, PluginManager } from '../plugins';
|
|
32
|
-
export declare type RunOptions = Omit<CliArgs, 'debug' | 'pattern' | 'inline' | 'require' | 'reporter' | 'richEvents' | 'capability' | 'sandbox' | 'headless' | 'throttling'> & {
|
|
33
|
-
environment?: string;
|
|
34
|
-
playwrightOptions?: PlaywrightOptions;
|
|
35
|
-
networkConditions?: NetworkConditions;
|
|
36
|
-
reporter?: CliArgs['reporter'] | Reporter;
|
|
37
|
-
};
|
|
38
31
|
declare type HookType = 'beforeAll' | 'afterAll';
|
|
39
32
|
export declare type SuiteHooks = Record<HookType, Array<HooksCallback>>;
|
|
40
33
|
declare type JourneyContext = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,OAAO,EAAQ,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,OAAO,EAAQ,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAWnC,OAAO,EACL,WAAW,EACX,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,MAAM,EAEN,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKxD,aAAK,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;AACzC,oBAAY,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAEhE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S;IAK/B,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;IAK/C,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;IAK9C,OAAO,CACX,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC;IAiEhB,QAAQ,CACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,UAAU;IAgCrB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc;IAWnD,UAAU,CACd,OAAO,KAAA,EACP,MAAM,EAAE,cAAc,GAAG,aAAa,EACtC,OAAO,EAAE,UAAU;IA2BrB;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU;IAyBpD,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU;IAmChD,IAAI,CAAC,OAAO,EAAE,UAAU;IAoBxB,GAAG,CAAC,OAAO,EAAE,UAAU;IAuCvB,KAAK;CAWZ"}
|
package/dist/core/runner.js
CHANGED
|
@@ -106,7 +106,6 @@ class Runner extends events_1.EventEmitter {
|
|
|
106
106
|
await (0, helpers_1.runParallel)(journey.hooks.after, args);
|
|
107
107
|
}
|
|
108
108
|
async runStep(step, context, options) {
|
|
109
|
-
var _a;
|
|
110
109
|
const data = {
|
|
111
110
|
status: 'succeeded',
|
|
112
111
|
};
|
|
@@ -160,7 +159,7 @@ class Runner extends events_1.EventEmitter {
|
|
|
160
159
|
const pages = driver.context.pages();
|
|
161
160
|
const page = pages[pages.length - 1];
|
|
162
161
|
if (page) {
|
|
163
|
-
|
|
162
|
+
data.url ?? (data.url = page.url());
|
|
164
163
|
if (screenshots && screenshots !== 'off') {
|
|
165
164
|
await this.captureScreenshot(page, step);
|
|
166
165
|
}
|