@elastic/synthetics 1.0.0-beta.2 → 1.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +235 -0
- package/NOTICE.txt +250 -0
- package/README.md +2 -1
- package/dist/cli.js +87 -56
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +116 -14
- package/dist/common_types.d.ts.map +1 -1
- package/dist/config.d.ts +2 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -5
- package/dist/config.js.map +1 -1
- package/dist/core/browser-service.js +5 -5
- package/dist/core/browser-service.js.map +1 -1
- package/dist/core/expect.d.ts +177 -0
- package/dist/core/expect.d.ts.map +1 -0
- package/dist/core/expect.js +33 -0
- package/dist/core/expect.js.map +1 -0
- package/dist/core/gatherer.d.ts +4 -7
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +39 -12
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +0 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +3 -16
- package/dist/core/logger.js.map +1 -1
- package/dist/core/runner.d.ts +54 -45
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +181 -71
- package/dist/core/runner.js.map +1 -1
- package/dist/dsl/journey.d.ts +13 -4
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +40 -1
- package/dist/dsl/journey.js.map +1 -1
- package/dist/formatter/javascript.d.ts +73 -0
- package/dist/formatter/javascript.d.ts.map +1 -0
- package/dist/formatter/javascript.js +274 -0
- package/dist/formatter/javascript.js.map +1 -0
- package/dist/helpers.d.ts +33 -12
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +108 -54
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/parse_args.d.ts +5 -2
- package/dist/parse_args.d.ts.map +1 -1
- package/dist/parse_args.js +59 -16
- package/dist/parse_args.js.map +1 -1
- package/dist/plugins/browser-console.d.ts +5 -8
- package/dist/plugins/browser-console.d.ts.map +1 -1
- package/dist/plugins/browser-console.js +27 -8
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/network.d.ts +23 -20
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +149 -124
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +5 -5
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js +5 -5
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +11 -11
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +40 -24
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.d.ts +10 -25
- package/dist/plugins/tracing.d.ts.map +1 -1
- package/dist/plugins/tracing.js +40 -26
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/reporters/base.d.ts +0 -1
- package/dist/reporters/base.d.ts.map +1 -1
- package/dist/reporters/base.js +34 -32
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/json.d.ts +46 -59
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +188 -70
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/junit.d.ts.map +1 -1
- package/dist/reporters/junit.js +7 -7
- package/dist/reporters/junit.js.map +1 -1
- package/dist/sdk/lh-trace-processor.d.ts +304 -0
- package/dist/sdk/lh-trace-processor.d.ts.map +1 -0
- package/dist/sdk/lh-trace-processor.js +832 -0
- package/dist/sdk/lh-trace-processor.js.map +1 -0
- package/dist/sdk/trace-metrics.d.ts +61 -0
- package/dist/sdk/trace-metrics.d.ts.map +1 -0
- package/dist/sdk/trace-metrics.js +252 -0
- package/dist/sdk/trace-metrics.js.map +1 -0
- package/dist/sdk/trace-processor.d.ts +106 -0
- package/dist/sdk/trace-processor.d.ts.map +1 -0
- package/dist/sdk/trace-processor.js +74 -0
- package/dist/sdk/trace-processor.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1575
- package/package.json +27 -16
- package/src/cli.ts +68 -45
- package/src/common_types.ts +138 -14
- package/src/config.ts +2 -5
- package/src/core/expect.ts +187 -0
- package/src/core/gatherer.ts +48 -24
- package/src/core/index.ts +6 -6
- package/src/core/logger.ts +1 -12
- package/src/core/runner.ts +259 -112
- package/src/dsl/journey.ts +28 -6
- package/src/formatter/javascript.ts +330 -0
- package/src/helpers.ts +114 -24
- package/src/index.ts +7 -6
- package/src/parse_args.ts +97 -22
- package/src/plugins/browser-console.ts +30 -13
- package/src/plugins/network.ts +175 -159
- package/src/plugins/performance.ts +7 -7
- package/src/plugins/plugin-manager.ts +47 -36
- package/src/plugins/tracing.ts +43 -54
- package/src/reporters/base.ts +29 -23
- package/src/reporters/json.ts +259 -80
- package/src/reporters/junit.ts +1 -1
- package/src/sdk/lh-trace-processor.ts +1033 -0
- package/src/sdk/trace-metrics.ts +287 -0
- package/src/sdk/trace-processor.ts +147 -0
package/dist/core/runner.js
CHANGED
|
@@ -25,23 +25,33 @@
|
|
|
25
25
|
*/
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
const events_1 = require("events");
|
|
28
|
+
const path_1 = require("path");
|
|
29
|
+
const promises_1 = require("fs/promises");
|
|
28
30
|
const reporters_1 = require("../reporters");
|
|
29
31
|
const helpers_1 = require("../helpers");
|
|
30
|
-
const plugins_1 = require("../plugins");
|
|
31
32
|
const gatherer_1 = require("./gatherer");
|
|
32
33
|
const logger_1 = require("./logger");
|
|
33
|
-
class Runner {
|
|
34
|
+
class Runner extends events_1.EventEmitter {
|
|
34
35
|
constructor() {
|
|
36
|
+
super(...arguments);
|
|
35
37
|
this.active = false;
|
|
36
|
-
this.eventEmitter = new events_1.EventEmitter();
|
|
37
38
|
this.currentJourney = null;
|
|
38
39
|
this.journeys = [];
|
|
39
40
|
this.hooks = { beforeAll: [], afterAll: [] };
|
|
40
41
|
}
|
|
41
42
|
static async createContext(options) {
|
|
42
|
-
const start = helpers_1.getMonotonicTime();
|
|
43
43
|
const driver = await gatherer_1.Gatherer.setupDriver(options);
|
|
44
|
+
/**
|
|
45
|
+
* Do not include browser launch/context creation duration
|
|
46
|
+
* as part of journey duration
|
|
47
|
+
*/
|
|
48
|
+
const start = (0, helpers_1.monotonicTimeInSeconds)();
|
|
44
49
|
const pluginManager = await gatherer_1.Gatherer.beginRecording(driver, options);
|
|
50
|
+
/**
|
|
51
|
+
* For each journey we create the screenshots folder for
|
|
52
|
+
* caching all screenshots and clear them at end of each journey
|
|
53
|
+
*/
|
|
54
|
+
await (0, helpers_1.mkdirAsync)(this.screenshotPath, { recursive: true });
|
|
45
55
|
return {
|
|
46
56
|
start,
|
|
47
57
|
params: options.params,
|
|
@@ -49,6 +59,29 @@ class Runner {
|
|
|
49
59
|
pluginManager,
|
|
50
60
|
};
|
|
51
61
|
}
|
|
62
|
+
async captureScreenshot(page, step) {
|
|
63
|
+
await page.waitForLoadState('load');
|
|
64
|
+
const buffer = await page
|
|
65
|
+
.screenshot({
|
|
66
|
+
type: 'jpeg',
|
|
67
|
+
quality: 80,
|
|
68
|
+
})
|
|
69
|
+
.catch(() => { });
|
|
70
|
+
/**
|
|
71
|
+
* Write the screenshot image buffer with additional details (step
|
|
72
|
+
* information) which could be extracted at the end of
|
|
73
|
+
* each journey without impacting the step timing information
|
|
74
|
+
*/
|
|
75
|
+
if (buffer) {
|
|
76
|
+
const fileName = `${(0, helpers_1.generateUniqueId)()}.json`;
|
|
77
|
+
const screenshot = {
|
|
78
|
+
step,
|
|
79
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
80
|
+
data: buffer.toString('base64'),
|
|
81
|
+
};
|
|
82
|
+
await (0, helpers_1.writeFileAsync)((0, path_1.join)(Runner.screenshotPath, fileName), JSON.stringify(screenshot));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
52
85
|
addHook(type, callback) {
|
|
53
86
|
this.hooks[type].push(callback);
|
|
54
87
|
}
|
|
@@ -56,36 +89,29 @@ class Runner {
|
|
|
56
89
|
this.journeys.push(journey);
|
|
57
90
|
this.currentJourney = journey;
|
|
58
91
|
}
|
|
59
|
-
|
|
60
|
-
logger_1.log(`Runner:
|
|
61
|
-
this.
|
|
62
|
-
}
|
|
63
|
-
on(e, cb) {
|
|
64
|
-
this.eventEmitter.on(e, cb);
|
|
92
|
+
async runBeforeAllHook(args) {
|
|
93
|
+
(0, logger_1.log)(`Runner: beforeAll hooks`);
|
|
94
|
+
await (0, helpers_1.runParallel)(this.hooks.beforeAll, args);
|
|
65
95
|
}
|
|
66
|
-
async
|
|
67
|
-
logger_1.log(`Runner:
|
|
68
|
-
await helpers_1.runParallel(this.hooks.
|
|
96
|
+
async runAfterAllHook(args) {
|
|
97
|
+
(0, logger_1.log)(`Runner: afterAll hooks`);
|
|
98
|
+
await (0, helpers_1.runParallel)(this.hooks.afterAll, args);
|
|
69
99
|
}
|
|
70
|
-
async
|
|
71
|
-
logger_1.log(`Runner:
|
|
72
|
-
await helpers_1.runParallel(
|
|
100
|
+
async runBeforeHook(journey, args) {
|
|
101
|
+
(0, logger_1.log)(`Runner: before hooks for (${journey.name})`);
|
|
102
|
+
await (0, helpers_1.runParallel)(journey.hooks.before, args);
|
|
73
103
|
}
|
|
74
|
-
async
|
|
75
|
-
logger_1.log(`Runner:
|
|
76
|
-
await helpers_1.runParallel(journey.hooks.
|
|
77
|
-
}
|
|
78
|
-
async runAfterHook(journey) {
|
|
79
|
-
logger_1.log(`Runner: after hooks for (${journey.name})`);
|
|
80
|
-
await helpers_1.runParallel(journey.hooks.after);
|
|
104
|
+
async runAfterHook(journey, args) {
|
|
105
|
+
(0, logger_1.log)(`Runner: after hooks for (${journey.name})`);
|
|
106
|
+
await (0, helpers_1.runParallel)(journey.hooks.after, args);
|
|
81
107
|
}
|
|
82
108
|
async runStep(step, context, options) {
|
|
83
109
|
var _a;
|
|
84
110
|
const data = {
|
|
85
111
|
status: 'succeeded',
|
|
86
112
|
};
|
|
87
|
-
logger_1.log(`Runner: start step (${step.name})`);
|
|
88
|
-
const { metrics, screenshots } = options;
|
|
113
|
+
(0, logger_1.log)(`Runner: start step (${step.name})`);
|
|
114
|
+
const { metrics, screenshots, filmstrips, trace } = options;
|
|
89
115
|
const { driver, pluginManager } = context;
|
|
90
116
|
/**
|
|
91
117
|
* URL needs to be the first navigation request of any step
|
|
@@ -96,14 +122,28 @@ class Runner {
|
|
|
96
122
|
if (!data.url && req.isNavigationRequest()) {
|
|
97
123
|
data.url = req.url();
|
|
98
124
|
}
|
|
99
|
-
driver.
|
|
125
|
+
driver.context.off('request', captureUrl);
|
|
100
126
|
};
|
|
101
|
-
driver.
|
|
127
|
+
driver.context.on('request', captureUrl);
|
|
102
128
|
try {
|
|
129
|
+
/**
|
|
130
|
+
* Set up plugin manager context and also register
|
|
131
|
+
* step level plugins
|
|
132
|
+
*/
|
|
133
|
+
const traceEnabled = trace || filmstrips;
|
|
103
134
|
pluginManager.onStep(step);
|
|
135
|
+
traceEnabled && (await pluginManager.start('trace'));
|
|
136
|
+
// call the step definition
|
|
104
137
|
await step.callback();
|
|
138
|
+
/**
|
|
139
|
+
* Collect all step level metrics
|
|
140
|
+
*/
|
|
105
141
|
if (metrics) {
|
|
106
|
-
data.
|
|
142
|
+
data.pagemetrics = await pluginManager.get('performance').getMetrics();
|
|
143
|
+
}
|
|
144
|
+
if (traceEnabled) {
|
|
145
|
+
const traceOutput = await pluginManager.stop('trace');
|
|
146
|
+
Object.assign(data, traceOutput);
|
|
107
147
|
}
|
|
108
148
|
}
|
|
109
149
|
catch (error) {
|
|
@@ -111,23 +151,29 @@ class Runner {
|
|
|
111
151
|
data.error = error;
|
|
112
152
|
}
|
|
113
153
|
finally {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Capture screenshot for the newly created pages
|
|
156
|
+
* via popup or new windows/tabs
|
|
157
|
+
*
|
|
158
|
+
* Last open page will get us the correct screenshot
|
|
159
|
+
*/
|
|
160
|
+
const pages = driver.context.pages();
|
|
161
|
+
const page = pages[pages.length - 1];
|
|
162
|
+
if (page) {
|
|
163
|
+
(_a = data.url) !== null && _a !== void 0 ? _a : (data.url = page.url());
|
|
164
|
+
if (screenshots && screenshots !== 'off') {
|
|
165
|
+
await this.captureScreenshot(page, step);
|
|
166
|
+
}
|
|
121
167
|
}
|
|
122
168
|
}
|
|
123
|
-
logger_1.log(`Runner: end step (${step.name})`);
|
|
169
|
+
(0, logger_1.log)(`Runner: end step (${step.name})`);
|
|
124
170
|
return data;
|
|
125
171
|
}
|
|
126
172
|
async runSteps(journey, context, options) {
|
|
127
173
|
const results = [];
|
|
128
174
|
let skipStep = false;
|
|
129
175
|
for (const step of journey.steps) {
|
|
130
|
-
const start = helpers_1.
|
|
176
|
+
const start = (0, helpers_1.monotonicTimeInSeconds)();
|
|
131
177
|
this.emit('step:start', { journey, step });
|
|
132
178
|
let data = { status: 'succeeded' };
|
|
133
179
|
if (skipStep) {
|
|
@@ -145,7 +191,7 @@ class Runner {
|
|
|
145
191
|
journey,
|
|
146
192
|
step,
|
|
147
193
|
start,
|
|
148
|
-
end: helpers_1.
|
|
194
|
+
end: (0, helpers_1.monotonicTimeInSeconds)(),
|
|
149
195
|
...data,
|
|
150
196
|
});
|
|
151
197
|
if (options.pauseOnError && data.error) {
|
|
@@ -157,7 +203,7 @@ class Runner {
|
|
|
157
203
|
}
|
|
158
204
|
registerJourney(journey, context) {
|
|
159
205
|
this.currentJourney = journey;
|
|
160
|
-
const timestamp = helpers_1.getTimestamp();
|
|
206
|
+
const timestamp = (0, helpers_1.getTimestamp)();
|
|
161
207
|
const { params } = context;
|
|
162
208
|
this.emit('journey:start', { journey, timestamp, params });
|
|
163
209
|
/**
|
|
@@ -165,30 +211,71 @@ class Runner {
|
|
|
165
211
|
*/
|
|
166
212
|
journey.callback({ ...context.driver, params });
|
|
167
213
|
}
|
|
168
|
-
async endJourney(journey, result) {
|
|
169
|
-
const
|
|
170
|
-
const {
|
|
214
|
+
async endJourney(journey, result, options) {
|
|
215
|
+
const end = (0, helpers_1.monotonicTimeInSeconds)();
|
|
216
|
+
const { pluginManager, start, status, error } = result;
|
|
217
|
+
const pluginOutput = pluginManager.output();
|
|
171
218
|
this.emit('journey:end', {
|
|
172
219
|
journey,
|
|
173
220
|
status,
|
|
174
221
|
error,
|
|
175
|
-
params,
|
|
176
222
|
start,
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
223
|
+
end,
|
|
224
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
225
|
+
options,
|
|
226
|
+
...pluginOutput,
|
|
227
|
+
browserconsole: status == 'failed' ? pluginOutput.browserconsole : [],
|
|
181
228
|
});
|
|
229
|
+
/**
|
|
230
|
+
* Wait for the all the reported events to be consumed aschronously
|
|
231
|
+
* by reporter.
|
|
232
|
+
*/
|
|
233
|
+
if (options.reporter === 'json') {
|
|
234
|
+
await (0, events_1.once)(this, 'journey:end:reported');
|
|
235
|
+
}
|
|
236
|
+
// clear screenshots cache after each journey
|
|
237
|
+
await (0, promises_1.rm)(Runner.screenshotPath, { recursive: true, force: true });
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Simulate a journey run to capture errors in the beforeAll hook
|
|
241
|
+
*/
|
|
242
|
+
async runFakeJourney(journey, options) {
|
|
243
|
+
const start = (0, helpers_1.monotonicTimeInSeconds)();
|
|
244
|
+
this.emit('journey:start', {
|
|
245
|
+
journey,
|
|
246
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
247
|
+
params: options.params,
|
|
248
|
+
});
|
|
249
|
+
const result = {
|
|
250
|
+
status: 'failed',
|
|
251
|
+
error: this.hookError,
|
|
252
|
+
};
|
|
253
|
+
this.emit('journey:end', {
|
|
254
|
+
journey,
|
|
255
|
+
timestamp: (0, helpers_1.getTimestamp)(),
|
|
256
|
+
start,
|
|
257
|
+
options,
|
|
258
|
+
end: (0, helpers_1.monotonicTimeInSeconds)(),
|
|
259
|
+
...result,
|
|
260
|
+
});
|
|
261
|
+
if (options.reporter === 'json') {
|
|
262
|
+
await (0, events_1.once)(this, 'journey:end:reported');
|
|
263
|
+
}
|
|
264
|
+
return result;
|
|
182
265
|
}
|
|
183
266
|
async runJourney(journey, options) {
|
|
184
267
|
const result = {
|
|
185
268
|
status: 'succeeded',
|
|
186
269
|
};
|
|
187
|
-
logger_1.log(`Runner: start journey (${journey.name})`);
|
|
188
270
|
const context = await Runner.createContext(options);
|
|
271
|
+
(0, logger_1.log)(`Runner: start journey (${journey.name})`);
|
|
189
272
|
try {
|
|
190
273
|
this.registerJourney(journey, context);
|
|
191
|
-
|
|
274
|
+
const hookArgs = {
|
|
275
|
+
env: options.environment,
|
|
276
|
+
params: options.params,
|
|
277
|
+
};
|
|
278
|
+
await this.runBeforeHook(journey, hookArgs);
|
|
192
279
|
const stepResults = await this.runSteps(journey, context, options);
|
|
193
280
|
/**
|
|
194
281
|
* Mark journey as failed if any intermediate step fails
|
|
@@ -199,27 +286,21 @@ class Runner {
|
|
|
199
286
|
result.error = stepResult.error;
|
|
200
287
|
}
|
|
201
288
|
}
|
|
202
|
-
await this.runAfterHook(journey);
|
|
289
|
+
await this.runAfterHook(journey, hookArgs);
|
|
203
290
|
}
|
|
204
291
|
catch (e) {
|
|
205
292
|
result.status = 'failed';
|
|
206
293
|
result.error = e;
|
|
207
294
|
}
|
|
208
295
|
finally {
|
|
209
|
-
await this.endJourney(journey, { ...context, ...result });
|
|
296
|
+
await this.endJourney(journey, { ...context, ...result }, options);
|
|
210
297
|
await gatherer_1.Gatherer.dispose(context.driver);
|
|
211
298
|
}
|
|
212
|
-
logger_1.log(`Runner: end journey (${journey.name})`);
|
|
299
|
+
(0, logger_1.log)(`Runner: end journey (${journey.name})`);
|
|
213
300
|
return result;
|
|
214
301
|
}
|
|
215
|
-
async
|
|
216
|
-
const
|
|
217
|
-
if (this.active) {
|
|
218
|
-
return result;
|
|
219
|
-
}
|
|
220
|
-
this.active = true;
|
|
221
|
-
logger_1.log(`Runner: run ${this.journeys.length} journeys`);
|
|
222
|
-
const { reporter, journeyName, outfd } = options;
|
|
302
|
+
async init(options) {
|
|
303
|
+
const { reporter, outfd, networkConditions } = options;
|
|
223
304
|
/**
|
|
224
305
|
* Set up the corresponding reporter and fallback
|
|
225
306
|
*/
|
|
@@ -227,35 +308,64 @@ class Runner {
|
|
|
227
308
|
? reporter
|
|
228
309
|
: reporters_1.reporters[reporter] || reporters_1.reporters['default'];
|
|
229
310
|
new Reporter(this, { fd: outfd });
|
|
230
|
-
this.emit('start', {
|
|
231
|
-
|
|
311
|
+
this.emit('start', {
|
|
312
|
+
numJourneys: this.journeys.length,
|
|
313
|
+
networkConditions,
|
|
314
|
+
});
|
|
315
|
+
/**
|
|
316
|
+
* Set up the directory for caching screenshots
|
|
317
|
+
*/
|
|
318
|
+
await (0, helpers_1.mkdirAsync)(helpers_1.CACHE_PATH, { recursive: true });
|
|
319
|
+
}
|
|
320
|
+
async run(options) {
|
|
321
|
+
const result = {};
|
|
322
|
+
if (this.active) {
|
|
323
|
+
return result;
|
|
324
|
+
}
|
|
325
|
+
this.active = true;
|
|
326
|
+
(0, logger_1.log)(`Runner: run ${this.journeys.length} journeys`);
|
|
327
|
+
this.init(options);
|
|
328
|
+
await this.runBeforeAllHook({
|
|
329
|
+
env: options.environment,
|
|
330
|
+
params: options.params,
|
|
331
|
+
}).catch(e => (this.hookError = e));
|
|
332
|
+
const { dryRun, match, tags } = options;
|
|
232
333
|
for (const journey of this.journeys) {
|
|
233
334
|
/**
|
|
234
335
|
* Used by heartbeat to gather all registered journeys
|
|
235
336
|
*/
|
|
236
|
-
if (
|
|
337
|
+
if (dryRun) {
|
|
237
338
|
this.emit('journey:register', { journey });
|
|
238
339
|
continue;
|
|
239
340
|
}
|
|
240
|
-
|
|
241
|
-
if (journeyName && journey.name != journeyName) {
|
|
341
|
+
if (!journey.isMatch(match, tags)) {
|
|
242
342
|
continue;
|
|
243
343
|
}
|
|
244
|
-
const journeyResult =
|
|
344
|
+
const journeyResult = this.hookError
|
|
345
|
+
? await this.runFakeJourney(journey, options)
|
|
346
|
+
: await this.runJourney(journey, options);
|
|
245
347
|
result[journey.name] = journeyResult;
|
|
246
348
|
}
|
|
247
349
|
await gatherer_1.Gatherer.stop();
|
|
248
|
-
await this.runAfterAllHook(
|
|
249
|
-
|
|
250
|
-
|
|
350
|
+
await this.runAfterAllHook({
|
|
351
|
+
env: options.environment,
|
|
352
|
+
params: options.params,
|
|
353
|
+
});
|
|
354
|
+
await this.reset();
|
|
251
355
|
return result;
|
|
252
356
|
}
|
|
253
|
-
reset() {
|
|
254
|
-
|
|
357
|
+
async reset() {
|
|
358
|
+
/**
|
|
359
|
+
* Clear all cache data stored for post processing by
|
|
360
|
+
* the current synthetic agent run
|
|
361
|
+
*/
|
|
362
|
+
await (0, promises_1.rm)(helpers_1.CACHE_PATH, { recursive: true, force: true });
|
|
255
363
|
this.currentJourney = null;
|
|
256
364
|
this.journeys = [];
|
|
257
365
|
this.active = false;
|
|
366
|
+
this.emit('end', {});
|
|
258
367
|
}
|
|
259
368
|
}
|
|
260
369
|
exports.default = Runner;
|
|
370
|
+
Runner.screenshotPath = (0, path_1.join)(helpers_1.CACHE_PATH, 'screenshots');
|
|
261
371
|
//# sourceMappingURL=runner.js.map
|
package/dist/core/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,
|
|
1
|
+
{"version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AAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC;;AA1WH,yBA2WC;AArWQ,qBAAc,GAAG,IAAA,WAAI,EAAC,oBAAU,EAAE,aAAa,CAAC,CAAC"}
|
package/dist/dsl/journey.d.ts
CHANGED
|
@@ -24,29 +24,38 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { Browser, Page, BrowserContext, CDPSession } from 'playwright-chromium';
|
|
26
26
|
import { Step } from './step';
|
|
27
|
-
import { VoidCallback } from '../common_types';
|
|
27
|
+
import { VoidCallback, HooksCallback, Params } from '../common_types';
|
|
28
28
|
export declare type JourneyOptions = {
|
|
29
29
|
name: string;
|
|
30
30
|
id?: string;
|
|
31
|
+
tags?: string[];
|
|
31
32
|
};
|
|
32
33
|
declare type HookType = 'before' | 'after';
|
|
33
|
-
export declare type Hooks = Record<HookType, Array<
|
|
34
|
+
export declare type Hooks = Record<HookType, Array<HooksCallback>>;
|
|
34
35
|
export declare type JourneyCallback = (options: {
|
|
35
36
|
page: Page;
|
|
36
37
|
context: BrowserContext;
|
|
37
38
|
browser: Browser;
|
|
38
39
|
client: CDPSession;
|
|
39
|
-
params:
|
|
40
|
+
params: Params;
|
|
40
41
|
}) => void;
|
|
41
42
|
export declare class Journey {
|
|
42
43
|
name: string;
|
|
43
44
|
id?: string;
|
|
45
|
+
tags?: string[];
|
|
44
46
|
callback: JourneyCallback;
|
|
45
47
|
steps: Step[];
|
|
46
48
|
hooks: Hooks;
|
|
47
49
|
constructor(options: JourneyOptions, callback: JourneyCallback);
|
|
48
50
|
addStep(name: string, callback: VoidCallback): Step;
|
|
49
|
-
addHook(type: HookType, callback:
|
|
51
|
+
addHook(type: HookType, callback: HooksCallback): void;
|
|
52
|
+
/**
|
|
53
|
+
* Matches journeys based on the provided args. Proitize tags over match
|
|
54
|
+
* - tags pattern that matches only tags
|
|
55
|
+
* - match pattern that matches both name and tags
|
|
56
|
+
*/
|
|
57
|
+
isMatch(matchPattern: string, tagsPattern: Array<string>): boolean;
|
|
58
|
+
tagsMatch(pattern: any): boolean;
|
|
50
59
|
}
|
|
51
60
|
export {};
|
|
52
61
|
//# sourceMappingURL=journey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/dsl/journey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/dsl/journey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEtE,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,aAAK,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AACnC,oBAAY,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAC3D,oBAAY,eAAe,GAAG,CAAC,OAAO,EAAE;IACtC,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,IAAI,CAAC;AAEX,qBAAa,OAAO;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,KAAK,EAAE,KAAK,CAA6B;gBAE7B,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe;IAO9D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY;IAM5C,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa;IAG/C;;;;OAIG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;IAUxD,SAAS,CAAC,OAAO,KAAA;CAIlB"}
|
package/dist/dsl/journey.js
CHANGED
|
@@ -23,15 +23,36 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
26
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
46
|
exports.Journey = void 0;
|
|
47
|
+
const micromatch_1 = __importStar(require("micromatch"));
|
|
28
48
|
const step_1 = require("./step");
|
|
29
49
|
class Journey {
|
|
30
50
|
constructor(options, callback) {
|
|
31
51
|
this.steps = [];
|
|
32
52
|
this.hooks = { before: [], after: [] };
|
|
33
53
|
this.name = options.name;
|
|
34
|
-
this.id = options.id;
|
|
54
|
+
this.id = options.id || options.name;
|
|
55
|
+
this.tags = options.tags;
|
|
35
56
|
this.callback = callback;
|
|
36
57
|
}
|
|
37
58
|
addStep(name, callback) {
|
|
@@ -42,6 +63,24 @@ class Journey {
|
|
|
42
63
|
addHook(type, callback) {
|
|
43
64
|
this.hooks[type].push(callback);
|
|
44
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Matches journeys based on the provided args. Proitize tags over match
|
|
68
|
+
* - tags pattern that matches only tags
|
|
69
|
+
* - match pattern that matches both name and tags
|
|
70
|
+
*/
|
|
71
|
+
isMatch(matchPattern, tagsPattern) {
|
|
72
|
+
if (tagsPattern) {
|
|
73
|
+
return this.tagsMatch(tagsPattern);
|
|
74
|
+
}
|
|
75
|
+
if (matchPattern) {
|
|
76
|
+
return (0, micromatch_1.isMatch)(this.name, matchPattern) || this.tagsMatch(matchPattern);
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
tagsMatch(pattern) {
|
|
81
|
+
const matchess = (0, micromatch_1.default)(this.tags || ['*'], pattern);
|
|
82
|
+
return matchess.length > 0;
|
|
83
|
+
}
|
|
45
84
|
}
|
|
46
85
|
exports.Journey = Journey;
|
|
47
86
|
//# sourceMappingURL=journey.js.map
|
package/dist/dsl/journey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../src/dsl/journey.ts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YAAY,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;SACzE;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,OAAO;QACf,MAAM,QAAQ,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;QACzD,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF;AA3CD,0BA2CC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
import { JavaScriptLanguageGenerator } from 'playwright-chromium/lib/server/supplements/recorder/javascript';
|
|
26
|
+
export declare type ActionInContext = {
|
|
27
|
+
pageAlias: string;
|
|
28
|
+
frameName?: string;
|
|
29
|
+
frameUrl: string;
|
|
30
|
+
isMainFrame: boolean;
|
|
31
|
+
action: Action;
|
|
32
|
+
committed?: boolean;
|
|
33
|
+
modified?: boolean;
|
|
34
|
+
title?: string;
|
|
35
|
+
};
|
|
36
|
+
declare type Action = {
|
|
37
|
+
name: string;
|
|
38
|
+
selector?: string;
|
|
39
|
+
url?: string;
|
|
40
|
+
key?: string;
|
|
41
|
+
signals: Signal[];
|
|
42
|
+
modifiers?: number;
|
|
43
|
+
button?: 'left' | 'middle' | 'right';
|
|
44
|
+
clickCount?: number;
|
|
45
|
+
text?: string;
|
|
46
|
+
value?: string;
|
|
47
|
+
isAssert?: boolean;
|
|
48
|
+
command?: string;
|
|
49
|
+
};
|
|
50
|
+
declare type Signal = {
|
|
51
|
+
name: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
isAsync?: boolean;
|
|
54
|
+
popupAlias?: string;
|
|
55
|
+
downloadAlias?: string;
|
|
56
|
+
dialogAlias?: string;
|
|
57
|
+
};
|
|
58
|
+
export declare class SyntheticsGenerator extends JavaScriptLanguageGenerator {
|
|
59
|
+
private isSuite;
|
|
60
|
+
private previousContext;
|
|
61
|
+
private insideStep;
|
|
62
|
+
constructor(isSuite: boolean);
|
|
63
|
+
generateAction(actionInContext: ActionInContext): any;
|
|
64
|
+
isNewStep(actioninContext: ActionInContext): boolean;
|
|
65
|
+
generateStepStart(name: any): string;
|
|
66
|
+
generateStepEnd(): any;
|
|
67
|
+
generateHeader(): any;
|
|
68
|
+
generateFooter(): string;
|
|
69
|
+
generateText(actions: Array<ActionInContext>): string;
|
|
70
|
+
}
|
|
71
|
+
export declare function quote(text: string, char?: string): string;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=javascript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../src/formatter/javascript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,2BAA2B,EAE5B,MAAM,gEAAgE,CAAC;AAExE,oBAAY,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,aAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,aAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;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