@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
|
@@ -0,0 +1,177 @@
|
|
|
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 type { AsymmetricMatcher, MatcherState, ExpectedAssertionsErrors } from 'expect/build/types';
|
|
26
|
+
export declare type Expect = {
|
|
27
|
+
<T = unknown>(actual: T): synthetics.Matchers<T>;
|
|
28
|
+
assertions(arg0: number): void;
|
|
29
|
+
extend(arg0: any): void;
|
|
30
|
+
extractExpectedAssertionsErrors: () => ExpectedAssertionsErrors;
|
|
31
|
+
getState(): MatcherState;
|
|
32
|
+
hasAssertions(): void;
|
|
33
|
+
setState(state: Partial<MatcherState>): void;
|
|
34
|
+
any(expectedObject: any): AsymmetricMatcher;
|
|
35
|
+
anything(): AsymmetricMatcher;
|
|
36
|
+
arrayContaining(sample: Array<unknown>): AsymmetricMatcher;
|
|
37
|
+
objectContaining(sample: Record<string, unknown>): AsymmetricMatcher;
|
|
38
|
+
stringContaining(expected: string): AsymmetricMatcher;
|
|
39
|
+
stringMatching(expected: string | RegExp): AsymmetricMatcher;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Override matchers from expect in our synthetic namespace to
|
|
43
|
+
* reduce support for spy and snapshot matchers which is
|
|
44
|
+
* impelemed via jest matchers
|
|
45
|
+
*
|
|
46
|
+
* We declare the types in global synthetics namespace which allows
|
|
47
|
+
* users to extend expect functionality without type errors
|
|
48
|
+
*/
|
|
49
|
+
declare global {
|
|
50
|
+
export namespace synthetics {
|
|
51
|
+
interface Matchers<R> {
|
|
52
|
+
/**
|
|
53
|
+
* If you know how to test something, `.not` lets you test its opposite.
|
|
54
|
+
*/
|
|
55
|
+
not: Matchers<R>;
|
|
56
|
+
/**
|
|
57
|
+
* Use resolves to unwrap the value of a fulfilled promise so any other
|
|
58
|
+
* matcher can be chained. If the promise is rejected the assertion fails.
|
|
59
|
+
*/
|
|
60
|
+
resolves: Matchers<Promise<R>>;
|
|
61
|
+
/**
|
|
62
|
+
* Unwraps the reason of a rejected promise so any other matcher can be chained.
|
|
63
|
+
* If the promise is fulfilled the assertion fails.
|
|
64
|
+
*/
|
|
65
|
+
rejects: Matchers<Promise<R>>;
|
|
66
|
+
/**
|
|
67
|
+
* Checks that a value is what you expect. It uses `===` to check strict equality.
|
|
68
|
+
* Don't use `toBe` with floating-point numbers.
|
|
69
|
+
*/
|
|
70
|
+
toBe(expected: unknown): R;
|
|
71
|
+
/**
|
|
72
|
+
* Using exact equality with floating point numbers is a bad idea.
|
|
73
|
+
* Rounding means that intuitive things fail.
|
|
74
|
+
* The default for numDigits is 2.
|
|
75
|
+
*/
|
|
76
|
+
toBeCloseTo(expected: number, numDigits?: number): R;
|
|
77
|
+
/**
|
|
78
|
+
* Ensure that a variable is not undefined.
|
|
79
|
+
*/
|
|
80
|
+
toBeDefined(): R;
|
|
81
|
+
/**
|
|
82
|
+
* When you don't care what a value is, you just want to
|
|
83
|
+
* ensure a value is false in a boolean context.
|
|
84
|
+
*/
|
|
85
|
+
toBeFalsy(): R;
|
|
86
|
+
/**
|
|
87
|
+
* For comparing floating point numbers.
|
|
88
|
+
*/
|
|
89
|
+
toBeGreaterThan(expected: number | bigint): R;
|
|
90
|
+
/**
|
|
91
|
+
* For comparing floating point numbers.
|
|
92
|
+
*/
|
|
93
|
+
toBeGreaterThanOrEqual(expected: number | bigint): R;
|
|
94
|
+
/**
|
|
95
|
+
* Ensure that an object is an instance of a class.
|
|
96
|
+
* This matcher uses `instanceof` underneath.
|
|
97
|
+
*/
|
|
98
|
+
toBeInstanceOf(expected: Function): R;
|
|
99
|
+
/**
|
|
100
|
+
* For comparing floating point numbers.
|
|
101
|
+
*/
|
|
102
|
+
toBeLessThan(expected: number | bigint): R;
|
|
103
|
+
/**
|
|
104
|
+
* For comparing floating point numbers.
|
|
105
|
+
*/
|
|
106
|
+
toBeLessThanOrEqual(expected: number | bigint): R;
|
|
107
|
+
/**
|
|
108
|
+
* This is the same as `.toBe(null)` but the error messages are a bit nicer.
|
|
109
|
+
* So use `.toBeNull()` when you want to check that something is null.
|
|
110
|
+
*/
|
|
111
|
+
toBeNull(): R;
|
|
112
|
+
/**
|
|
113
|
+
* Use when you don't care what a value is, you just want to ensure a value
|
|
114
|
+
* is true in a boolean context. In JavaScript, there are six falsy values:
|
|
115
|
+
* `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
|
|
116
|
+
*/
|
|
117
|
+
toBeTruthy(): R;
|
|
118
|
+
/**
|
|
119
|
+
* Used to check that a variable is undefined.
|
|
120
|
+
*/
|
|
121
|
+
toBeUndefined(): R;
|
|
122
|
+
/**
|
|
123
|
+
* Used to check that a variable is NaN.
|
|
124
|
+
*/
|
|
125
|
+
toBeNaN(): R;
|
|
126
|
+
/**
|
|
127
|
+
* Used when you want to check that an item is in a list.
|
|
128
|
+
* For testing the items in the list, this uses `===`, a strict equality check.
|
|
129
|
+
*/
|
|
130
|
+
toContain(expected: unknown): R;
|
|
131
|
+
/**
|
|
132
|
+
* Used when you want to check that an item is in a list.
|
|
133
|
+
* For testing the items in the list, this matcher recursively checks the
|
|
134
|
+
* equality of all fields, rather than checking for object identity.
|
|
135
|
+
*/
|
|
136
|
+
toContainEqual(expected: unknown): R;
|
|
137
|
+
/**
|
|
138
|
+
* Used when you want to check that two objects have the same value.
|
|
139
|
+
* This matcher recursively checks the equality of all fields, rather than checking for object identity.
|
|
140
|
+
*/
|
|
141
|
+
toEqual(expected: unknown): R;
|
|
142
|
+
/**
|
|
143
|
+
* Used to check that an object has a `.length` property
|
|
144
|
+
* and it is set to a certain numeric value.
|
|
145
|
+
*/
|
|
146
|
+
toHaveLength(expected: number): R;
|
|
147
|
+
/**
|
|
148
|
+
* Use to check if property at provided reference keyPath exists for an object.
|
|
149
|
+
* For checking deeply nested properties in an object you may use dot notation or an array containing
|
|
150
|
+
* the keyPath for deep references.
|
|
151
|
+
*
|
|
152
|
+
* Optionally, you can provide a value to check if it's equal to the value present at keyPath
|
|
153
|
+
* on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
|
|
154
|
+
* the equality of all fields.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
*
|
|
158
|
+
* expect(houseForSale).toHaveProperty('kitchen.area', 20);
|
|
159
|
+
*/
|
|
160
|
+
toHaveProperty(keyPath: string | Array<string>, value?: unknown): R;
|
|
161
|
+
/**
|
|
162
|
+
* Check that a string matches a regular expression.
|
|
163
|
+
*/
|
|
164
|
+
toMatch(expected: string | RegExp): R;
|
|
165
|
+
/**
|
|
166
|
+
* Used to check that a JavaScript object matches a subset of the properties of an object
|
|
167
|
+
*/
|
|
168
|
+
toMatchObject(expected: Record<string, unknown> | Array<unknown>): R;
|
|
169
|
+
/**
|
|
170
|
+
* Use to test that objects have the same types as well as structure.
|
|
171
|
+
*/
|
|
172
|
+
toStrictEqual(expected: unknown): R;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export declare const expect: Expect;
|
|
177
|
+
//# sourceMappingURL=expect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/core/expect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KA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,CAAC,CAAC;YACpE;;eAEG;YACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;YACtC;;eAEG;YACH,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACrE;;eAEG;YACH,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,CAAC,CAAC;SACrC;KACF;CACF;AAED,eAAO,MAAM,MAAM,EAAE,MAAkB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.expect = void 0;
|
|
31
|
+
const expect_1 = __importDefault(require("expect"));
|
|
32
|
+
exports.expect = expect_1.default;
|
|
33
|
+
//# sourceMappingURL=expect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/core/expect.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,oDAA+B;AAiKlB,QAAA,MAAM,GAAW,gBAAS,CAAC"}
|
package/dist/core/gatherer.d.ts
CHANGED
|
@@ -22,15 +22,10 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
25
|
+
import { ChromiumBrowser, BrowserContext } from 'playwright-chromium';
|
|
26
26
|
import { PluginManager } from '../plugins';
|
|
27
27
|
import { RunOptions } from './runner';
|
|
28
|
-
|
|
29
|
-
browser: ChromiumBrowser;
|
|
30
|
-
context: ChromiumBrowserContext;
|
|
31
|
-
page: Page;
|
|
32
|
-
client: CDPSession;
|
|
33
|
-
};
|
|
28
|
+
import { Driver } from '../common_types';
|
|
34
29
|
/**
|
|
35
30
|
* Purpose of the Gatherer is to set up the necessary browser driver
|
|
36
31
|
* related capabilities for the runner to run all journeys
|
|
@@ -38,6 +33,8 @@ export declare type Driver = {
|
|
|
38
33
|
export declare class Gatherer {
|
|
39
34
|
static browser: ChromiumBrowser;
|
|
40
35
|
static setupDriver(options: RunOptions): Promise<Driver>;
|
|
36
|
+
static getUserAgent(userAgent?: string): Promise<string>;
|
|
37
|
+
static setNetworkConditions(context: BrowserContext, networkConditions: RunOptions['networkConditions']): Promise<void>;
|
|
41
38
|
/**
|
|
42
39
|
* Starts recording all events related to the v8 devtools protocol
|
|
43
40
|
* 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,
|
|
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;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;;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,36 +34,63 @@ const logger_1 = require("./logger");
|
|
|
34
34
|
*/
|
|
35
35
|
class Gatherer {
|
|
36
36
|
static async setupDriver(options) {
|
|
37
|
+
var _a;
|
|
38
|
+
(0, logger_1.log)('Gatherer: setup driver');
|
|
39
|
+
const { wsEndpoint, playwrightOptions, networkConditions } = options;
|
|
37
40
|
if (Gatherer.browser == null) {
|
|
38
|
-
const { wsEndpoint, headless, sandbox = false } = options;
|
|
39
41
|
if (wsEndpoint) {
|
|
40
|
-
logger_1.log(`Gatherer: connecting to WS endpoint: ${wsEndpoint}`);
|
|
41
|
-
Gatherer.browser = await playwright_chromium_1.chromium.connect(
|
|
42
|
+
(0, logger_1.log)(`Gatherer: connecting to WS endpoint: ${wsEndpoint}`);
|
|
43
|
+
Gatherer.browser = await playwright_chromium_1.chromium.connect(wsEndpoint);
|
|
42
44
|
}
|
|
43
45
|
else {
|
|
44
46
|
Gatherer.browser = await playwright_chromium_1.chromium.launch({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
...playwrightOptions,
|
|
48
|
+
args: [
|
|
49
|
+
...((playwrightOptions === null || playwrightOptions === void 0 ? void 0 : playwrightOptions.headless) ? ['--disable-gpu'] : []),
|
|
50
|
+
...((_a = playwrightOptions === null || playwrightOptions === void 0 ? void 0 : playwrightOptions.args) !== null && _a !== void 0 ? _a : []),
|
|
51
|
+
],
|
|
47
52
|
});
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
|
-
const context = await Gatherer.browser.newContext(
|
|
55
|
+
const context = await Gatherer.browser.newContext({
|
|
56
|
+
...playwrightOptions,
|
|
57
|
+
userAgent: await Gatherer.getUserAgent(playwrightOptions === null || playwrightOptions === void 0 ? void 0 : playwrightOptions.userAgent),
|
|
58
|
+
});
|
|
59
|
+
await Gatherer.setNetworkConditions(context, networkConditions);
|
|
51
60
|
const page = await context.newPage();
|
|
52
61
|
const client = await context.newCDPSession(page);
|
|
53
62
|
return { browser: Gatherer.browser, context, page, client };
|
|
54
63
|
}
|
|
64
|
+
static async getUserAgent(userAgent) {
|
|
65
|
+
const syntheticsIdentifier = ' Elastic/Synthetics';
|
|
66
|
+
if (!userAgent) {
|
|
67
|
+
const session = await Gatherer.browser.newBrowserCDPSession();
|
|
68
|
+
({ userAgent } = await session.send('Browser.getVersion'));
|
|
69
|
+
}
|
|
70
|
+
return userAgent + syntheticsIdentifier;
|
|
71
|
+
}
|
|
72
|
+
static async setNetworkConditions(context, networkConditions) {
|
|
73
|
+
if (networkConditions) {
|
|
74
|
+
context.on('page', async (page) => {
|
|
75
|
+
const context = page.context();
|
|
76
|
+
const client = await context.newCDPSession(page);
|
|
77
|
+
await client.send('Network.emulateNetworkConditions', networkConditions);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
55
81
|
/**
|
|
56
82
|
* Starts recording all events related to the v8 devtools protocol
|
|
57
83
|
* https://chromedevtools.github.io/devtools-protocol/v8/
|
|
58
84
|
*/
|
|
59
85
|
static async beginRecording(driver, options) {
|
|
60
|
-
logger_1.log('Gatherer: started recording');
|
|
61
|
-
const {
|
|
86
|
+
(0, logger_1.log)('Gatherer: started recording');
|
|
87
|
+
const { network, metrics } = options;
|
|
62
88
|
const pluginManager = new plugins_1.PluginManager(driver);
|
|
63
|
-
pluginManager.
|
|
64
|
-
|
|
65
|
-
network && (await pluginManager.start('network'));
|
|
66
|
-
metrics && (await pluginManager.start('performance'));
|
|
89
|
+
pluginManager.registerAll(options);
|
|
90
|
+
const plugins = [await pluginManager.start('browserconsole')];
|
|
91
|
+
network && plugins.push(await pluginManager.start('network'));
|
|
92
|
+
metrics && plugins.push(await pluginManager.start('performance'));
|
|
93
|
+
await Promise.all(plugins);
|
|
67
94
|
return pluginManager;
|
|
68
95
|
}
|
|
69
96
|
static async dispose(driver) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../src/core/gatherer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;G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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
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { Journey, JourneyCallback, JourneyOptions } from '../dsl';
|
|
26
26
|
import Runner from './runner';
|
|
27
|
-
import { VoidCallback } from '../common_types';
|
|
27
|
+
import { VoidCallback, HooksCallback } from '../common_types';
|
|
28
28
|
export declare const runner: Runner;
|
|
29
29
|
export declare const journey: (options: JourneyOptions | string, callback: JourneyCallback) => Journey;
|
|
30
30
|
export declare const step: (name: string, callback: VoidCallback) => import("../dsl").Step;
|
|
31
|
-
export declare const beforeAll: (callback:
|
|
32
|
-
export declare const afterAll: (callback:
|
|
33
|
-
export declare const before: (callback:
|
|
34
|
-
export declare const after: (callback:
|
|
31
|
+
export declare const beforeAll: (callback: HooksCallback) => void;
|
|
32
|
+
export declare const afterAll: (callback: HooksCallback) => void;
|
|
33
|
+
export declare const before: (callback: HooksCallback) => void;
|
|
34
|
+
export declare const after: (callback: HooksCallback) => void;
|
|
35
35
|
//# sourceMappingURL=index.d.ts.map
|
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,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAY9D,eAAO,MAAM,MAAM,EAAE,MAAkC,CAAC;AAExD,eAAO,MAAM,OAAO,YACT,cAAc,GAAG,MAAM,YACtB,eAAe,YAS1B,CAAC;AAEF,eAAO,MAAM,IAAI,SAAU,MAAM,YAAY,YAAY,0BAGxD,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
|
@@ -41,7 +41,7 @@ if (!global[SYNTHETICS_RUNNER]) {
|
|
|
41
41
|
}
|
|
42
42
|
exports.runner = global[SYNTHETICS_RUNNER];
|
|
43
43
|
const journey = (options, callback) => {
|
|
44
|
-
logger_1.log(`register journey: ${options}`);
|
|
44
|
+
(0, logger_1.log)(`register journey: ${JSON.stringify(options)}`);
|
|
45
45
|
if (typeof options === 'string') {
|
|
46
46
|
options = { name: options, id: options };
|
|
47
47
|
}
|
|
@@ -52,7 +52,7 @@ const journey = (options, callback) => {
|
|
|
52
52
|
exports.journey = journey;
|
|
53
53
|
const step = (name, callback) => {
|
|
54
54
|
var _a;
|
|
55
|
-
logger_1.log(`register step: ${name}`);
|
|
55
|
+
(0, logger_1.log)(`register step: ${name}`);
|
|
56
56
|
return (_a = exports.runner.currentJourney) === null || _a === void 0 ? void 0 : _a.addStep(name, callback);
|
|
57
57
|
};
|
|
58
58
|
exports.step = step;
|
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;AAEjD,MAAM,OAAO,GAAG,CACrB,OAAgC,EAChC,QAAyB,EACzB,EAAE;IACF,YAAG,
|
|
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,CA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AEK,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/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,wBAAgB,GAAG,CAAC,GAAG,KAAA,QAStB"}
|
package/dist/core/logger.js
CHANGED
|
@@ -23,23 +23,10 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.log =
|
|
31
|
-
const sonic_boom_1 = __importDefault(require("sonic-boom"));
|
|
27
|
+
exports.log = void 0;
|
|
32
28
|
const colors_1 = require("kleur/colors");
|
|
33
29
|
const helpers_1 = require("../helpers");
|
|
34
|
-
const defaultFd = process.stdout.fd;
|
|
35
|
-
let logger = new sonic_boom_1.default({ fd: defaultFd, sync: true });
|
|
36
|
-
const setLogger = (fd) => {
|
|
37
|
-
if (fd && fd !== defaultFd) {
|
|
38
|
-
logger = new sonic_boom_1.default({ fd });
|
|
39
|
-
}
|
|
40
|
-
return logger;
|
|
41
|
-
};
|
|
42
|
-
exports.setLogger = setLogger;
|
|
43
30
|
function log(msg) {
|
|
44
31
|
if (!process.env.DEBUG || !msg) {
|
|
45
32
|
return;
|
|
@@ -47,8 +34,8 @@ function log(msg) {
|
|
|
47
34
|
if (typeof msg === 'object') {
|
|
48
35
|
msg = JSON.stringify(msg);
|
|
49
36
|
}
|
|
50
|
-
const time = colors_1.dim(colors_1.cyan(`at ${parseInt(String(helpers_1.now()))} ms `));
|
|
51
|
-
|
|
37
|
+
const time = (0, colors_1.dim)((0, colors_1.cyan)(`at ${parseInt(String((0, helpers_1.now)()))} ms `));
|
|
38
|
+
console.log(time + (0, colors_1.italic)((0, colors_1.grey)(msg)) + '\n');
|
|
52
39
|
}
|
|
53
40
|
exports.log = log;
|
|
54
41
|
//# sourceMappingURL=logger.js.map
|
package/dist/core/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,yCAAuD;AACvD,wCAAiC;AAEjC,SAAgB,GAAG,CAAC,GAAG;IACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE;QAC9B,OAAO;KACR;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;KAC3B;IACD,MAAM,IAAI,GAAG,IAAA,YAAG,EAAC,IAAA,aAAI,EAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAA,aAAG,GAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAA,eAAM,EAAC,IAAA,aAAI,EAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC/C,CAAC;AATD,kBASC"}
|
package/dist/core/runner.d.ts
CHANGED
|
@@ -27,92 +27,101 @@ import { EventEmitter } from 'events';
|
|
|
27
27
|
import { Journey } from '../dsl/journey';
|
|
28
28
|
import { Step } from '../dsl/step';
|
|
29
29
|
import { Reporter } from '../reporters';
|
|
30
|
-
import { StatusValue,
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
import { StatusValue, HooksCallback, Params, NetworkConditions, PluginOutput, CliArgs, HooksArgs, PlaywrightOptions, Driver } from '../common_types';
|
|
31
|
+
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
36
|
reporter?: CliArgs['reporter'] | Reporter;
|
|
37
37
|
};
|
|
38
|
-
declare type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
params?: RunParamaters;
|
|
38
|
+
declare type HookType = 'beforeAll' | 'afterAll';
|
|
39
|
+
export declare type SuiteHooks = Record<HookType, Array<HooksCallback>>;
|
|
40
|
+
declare type JourneyContext = {
|
|
41
|
+
params?: Params;
|
|
43
42
|
start: number;
|
|
44
|
-
end?: number;
|
|
45
|
-
};
|
|
46
|
-
declare type JourneyContext = BaseContext & {
|
|
47
43
|
driver: Driver;
|
|
48
44
|
pluginManager: PluginManager;
|
|
49
45
|
};
|
|
50
46
|
declare type StepResult = {
|
|
51
47
|
status: StatusValue;
|
|
52
48
|
url?: string;
|
|
53
|
-
metrics?: Metrics;
|
|
54
49
|
error?: Error;
|
|
55
|
-
|
|
50
|
+
pagemetrics?: PageMetrics;
|
|
51
|
+
filmstrips?: PluginOutput['filmstrips'];
|
|
52
|
+
metrics?: PluginOutput['metrics'];
|
|
53
|
+
traces?: PluginOutput['traces'];
|
|
56
54
|
};
|
|
57
55
|
declare type JourneyResult = {
|
|
58
56
|
status: StatusValue;
|
|
59
57
|
error?: Error;
|
|
58
|
+
networkinfo?: PluginOutput['networkinfo'];
|
|
59
|
+
browserconsole?: PluginOutput['browserconsole'];
|
|
60
60
|
};
|
|
61
61
|
declare type RunResult = Record<string, JourneyResult>;
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
interface StepEvent {
|
|
63
|
+
step: Step;
|
|
64
|
+
journey: Journey;
|
|
65
|
+
}
|
|
66
|
+
interface JourneyEvent {
|
|
67
|
+
journey: Journey;
|
|
68
|
+
timestamp: number;
|
|
69
|
+
params?: Params;
|
|
70
|
+
}
|
|
64
71
|
interface Events {
|
|
65
72
|
start: {
|
|
66
73
|
numJourneys: number;
|
|
74
|
+
networkConditions?: NetworkConditions;
|
|
67
75
|
};
|
|
68
76
|
'journey:register': {
|
|
69
77
|
journey: Journey;
|
|
70
78
|
};
|
|
71
|
-
'journey:start':
|
|
72
|
-
|
|
79
|
+
'journey:start': JourneyEvent;
|
|
80
|
+
'journey:end': JourneyEvent & JourneyResult & {
|
|
81
|
+
start: number;
|
|
82
|
+
end: number;
|
|
83
|
+
options: RunOptions;
|
|
73
84
|
timestamp: number;
|
|
74
|
-
params: RunParamaters;
|
|
75
|
-
};
|
|
76
|
-
'journey:end': BaseContext & JourneyResult & {
|
|
77
|
-
journey: Journey;
|
|
78
|
-
filmstrips?: Array<FilmStrip>;
|
|
79
|
-
networkinfo?: Array<NetworkInfo>;
|
|
80
|
-
browserconsole?: Array<BrowserMessage>;
|
|
81
85
|
};
|
|
82
|
-
'
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
'step:end': StepResult & {
|
|
86
|
+
'journey:end:reported': unknown;
|
|
87
|
+
'step:start': StepEvent;
|
|
88
|
+
'step:end': StepEvent & StepResult & {
|
|
87
89
|
start: number;
|
|
88
90
|
end: number;
|
|
89
|
-
journey: Journey;
|
|
90
|
-
step: Step;
|
|
91
91
|
};
|
|
92
92
|
end: unknown;
|
|
93
93
|
}
|
|
94
|
-
export default
|
|
94
|
+
export default interface Runner {
|
|
95
|
+
on<K extends keyof Events>(name: K, listener: (v: Events[K]) => void): this;
|
|
96
|
+
emit<K extends keyof Events>(event: K, args: Events[K]): boolean;
|
|
97
|
+
}
|
|
98
|
+
export default class Runner extends EventEmitter {
|
|
95
99
|
active: boolean;
|
|
96
|
-
eventEmitter: EventEmitter;
|
|
97
100
|
currentJourney?: Journey;
|
|
98
101
|
journeys: Journey[];
|
|
99
102
|
hooks: SuiteHooks;
|
|
103
|
+
hookError: Error | undefined;
|
|
104
|
+
static screenshotPath: string;
|
|
100
105
|
static createContext(options: RunOptions): Promise<JourneyContext>;
|
|
101
|
-
|
|
106
|
+
captureScreenshot(page: Driver['page'], step: Step): Promise<void>;
|
|
107
|
+
addHook(type: HookType, callback: HooksCallback): void;
|
|
102
108
|
addJourney(journey: Journey): void;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
runBeforeHook(journey: Journey): Promise<void>;
|
|
108
|
-
runAfterHook(journey: Journey): Promise<void>;
|
|
109
|
+
runBeforeAllHook(args: HooksArgs): Promise<void>;
|
|
110
|
+
runAfterAllHook(args: HooksArgs): Promise<void>;
|
|
111
|
+
runBeforeHook(journey: Journey, args: HooksArgs): Promise<void>;
|
|
112
|
+
runAfterHook(journey: Journey, args: HooksArgs): Promise<void>;
|
|
109
113
|
runStep(step: Step, context: JourneyContext, options: RunOptions): Promise<StepResult>;
|
|
110
114
|
runSteps(journey: Journey, context: JourneyContext, options: RunOptions): Promise<StepResult[]>;
|
|
111
115
|
registerJourney(journey: Journey, context: JourneyContext): void;
|
|
112
|
-
endJourney(journey: any, result: JourneyContext & JourneyResult): Promise<void>;
|
|
116
|
+
endJourney(journey: any, result: JourneyContext & JourneyResult, options: RunOptions): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Simulate a journey run to capture errors in the beforeAll hook
|
|
119
|
+
*/
|
|
120
|
+
runFakeJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
|
|
113
121
|
runJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
|
|
122
|
+
init(options: RunOptions): Promise<void>;
|
|
114
123
|
run(options: RunOptions): Promise<RunResult>;
|
|
115
|
-
reset(): void
|
|
124
|
+
reset(): Promise<void>;
|
|
116
125
|
}
|
|
117
126
|
export {};
|
|
118
127
|
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAEH,OAAO,
|
|
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;AACnC,OAAO,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AAUnD,OAAO,EACL,WAAW,EACX,aAAa,EACb,MAAM,E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