@itmetsam/samurai-framework 0.9.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/dist/assert/assertion-error.d.ts +1 -1
- package/dist/assert/expect.d.ts +5 -50
- package/dist/assert/expect.js +5 -182
- package/dist/assert/locator-assertions.d.ts +22 -0
- package/dist/assert/locator-assertions.js +61 -0
- package/dist/assert/pending-assertions.d.ts +7 -0
- package/dist/assert/pending-assertions.js +40 -0
- package/dist/assert/text-match.d.ts +4 -0
- package/dist/assert/text-match.js +11 -0
- package/dist/assert/value-assertions.d.ts +23 -0
- package/dist/assert/value-assertions.js +82 -0
- package/dist/browser/browser-context.d.ts +0 -1
- package/dist/browser/browser-context.js +13 -5
- package/dist/browser/browser-finder.js +5 -9
- package/dist/browser/browser.d.ts +3 -31
- package/dist/browser/browser.js +36 -219
- package/dist/browser/chrome-launch.d.ts +14 -1
- package/dist/browser/chrome-launch.js +44 -1
- package/dist/browser/dialog-handling.d.ts +32 -0
- package/dist/browser/dialog-handling.js +85 -0
- package/dist/browser/document-watcher.d.ts +44 -0
- package/dist/browser/document-watcher.js +160 -0
- package/dist/browser/download-folders.d.ts +0 -1
- package/dist/browser/download-folders.js +7 -15
- package/dist/browser/download.js +5 -10
- package/dist/browser/downloads-dir.js +2 -2
- package/dist/browser/emit.d.ts +7 -0
- package/dist/browser/emit.js +16 -0
- package/dist/browser/emulation.d.ts +1 -1
- package/dist/browser/emulation.js +54 -18
- package/dist/browser/file-chooser.js +4 -11
- package/dist/browser/history.d.ts +6 -0
- package/dist/browser/history.js +89 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/init-script.d.ts +2 -0
- package/dist/browser/init-script.js +16 -0
- package/dist/browser/launch-firefox.d.ts +20 -0
- package/dist/browser/launch-firefox.js +66 -0
- package/dist/browser/launch-flags.d.ts +18 -0
- package/dist/browser/launch-flags.js +100 -0
- package/dist/browser/lazy.d.ts +21 -0
- package/dist/browser/lazy.js +44 -0
- package/dist/browser/page-events.d.ts +44 -0
- package/dist/browser/page-events.js +58 -0
- package/dist/browser/page-logs.js +2 -9
- package/dist/browser/page-navigation.d.ts +58 -0
- package/dist/browser/page-navigation.js +108 -0
- package/dist/browser/page-network.d.ts +69 -0
- package/dist/browser/page-network.js +163 -0
- package/dist/browser/page-settings.d.ts +35 -0
- package/dist/browser/page-settings.js +51 -0
- package/dist/browser/page-transfers.d.ts +36 -0
- package/dist/browser/page-transfers.js +50 -0
- package/dist/browser/page.d.ts +39 -154
- package/dist/browser/page.js +134 -758
- package/dist/browser/pdf.d.ts +1 -1
- package/dist/browser/session.d.ts +16 -0
- package/dist/browser/session.js +32 -0
- package/dist/browser/viewport.d.ts +19 -0
- package/dist/browser/viewport.js +72 -0
- package/dist/browser/warm-up.d.ts +1 -1
- package/dist/browser/warm-up.js +2 -1
- package/dist/browsers/index.d.ts +1 -1
- package/dist/browsers/index.js +1 -1
- package/dist/browsers/pins.d.ts +0 -2
- package/dist/browsers/pins.js +0 -2
- package/dist/browsers/store.d.ts +0 -2
- package/dist/browsers/store.js +1 -2
- package/dist/cli/args.d.ts +19 -7
- package/dist/cli/args.js +18 -9
- package/dist/cli/browsers.d.ts +1 -2
- package/dist/cli/browsers.js +2 -2
- package/dist/cli/console-reporter.d.ts +4 -0
- package/dist/cli/console-reporter.js +15 -7
- package/dist/cli/flow-reporter.js +2 -1
- package/dist/cli/flow.d.ts +1 -2
- package/dist/cli/flow.js +25 -22
- package/dist/cli/init.js +3 -8
- package/dist/cli/io.d.ts +10 -0
- package/dist/cli/io.js +1 -0
- package/dist/cli/main.d.ts +3 -10
- package/dist/cli/main.js +11 -137
- package/dist/cli/paint.d.ts +2 -0
- package/dist/cli/paint.js +4 -0
- package/dist/cli/record.d.ts +4 -0
- package/dist/cli/record.js +93 -0
- package/dist/cli/usage.d.ts +1 -0
- package/dist/cli/usage.js +58 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/cli/version.js +7 -0
- package/dist/config/browsers.d.ts +11 -0
- package/dist/config/browsers.js +32 -0
- package/dist/config/config.js +8 -1
- package/dist/config/mask.d.ts +1 -1
- package/dist/config/mask.js +7 -2
- package/dist/config/run-settings.d.ts +1 -2
- package/dist/config/run-settings.js +1 -6
- package/dist/config/timeouts.d.ts +2 -0
- package/dist/config/timeouts.js +13 -0
- package/dist/config/workers.d.ts +14 -0
- package/dist/config/workers.js +29 -0
- package/dist/flows/run/branch-context.d.ts +14 -0
- package/dist/flows/run/branch-context.js +35 -0
- package/dist/flows/run/handlers/condition.d.ts +1 -1
- package/dist/flows/run/handlers/end.d.ts +1 -1
- package/dist/flows/run/handlers/group.d.ts +1 -1
- package/dist/flows/run/handlers/index.d.ts +2 -2
- package/dist/flows/run/handlers/parallel.d.ts +1 -1
- package/dist/flows/run/handlers/start.d.ts +1 -1
- package/dist/flows/run/handlers/support.d.ts +3 -24
- package/dist/flows/run/handlers/support.js +1 -1
- package/dist/flows/run/handlers/test.d.ts +1 -1
- package/dist/flows/run/handlers/types.d.ts +27 -0
- package/dist/flows/run/handlers/types.js +1 -0
- package/dist/flows/run/index.d.ts +1 -1
- package/dist/flows/run/prepare-flow.d.ts +14 -0
- package/dist/flows/run/prepare-flow.js +44 -0
- package/dist/flows/run/project.d.ts +33 -2
- package/dist/flows/run/project.js +139 -49
- package/dist/flows/run/run.d.ts +8 -4
- package/dist/flows/run/run.js +30 -194
- package/dist/flows/run/walker.d.ts +56 -0
- package/dist/flows/run/walker.js +225 -0
- package/dist/flows/steps/catalog.d.ts +1 -1
- package/dist/flows/steps/handler.d.ts +1 -1
- package/dist/flows/steps/set.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locator/actionability.d.ts +33 -0
- package/dist/locator/actionability.js +104 -0
- package/dist/locator/chain-resolver.d.ts +20 -0
- package/dist/locator/chain-resolver.js +102 -0
- package/dist/locator/document-swap.d.ts +1 -0
- package/dist/locator/document-swap.js +11 -0
- package/dist/locator/element-state.d.ts +3 -1
- package/dist/locator/element-state.js +11 -3
- package/dist/locator/file-actions.d.ts +35 -0
- package/dist/locator/file-actions.js +55 -0
- package/dist/{script/helpers.js → locator/helper-realm.js} +2 -2
- package/dist/locator/input-actions.d.ts +18 -0
- package/dist/locator/input-actions.js +80 -0
- package/dist/locator/label-locator.d.ts +1 -1
- package/dist/locator/label-locator.js +5 -12
- package/dist/locator/locator.d.ts +14 -37
- package/dist/locator/locator.js +68 -424
- package/dist/locator/page-scripts.d.ts +16 -0
- package/dist/locator/page-scripts.js +54 -0
- package/dist/locator/page-search.d.ts +10 -0
- package/dist/locator/page-search.js +19 -0
- package/dist/locator/selector-errors.d.ts +0 -4
- package/dist/locator/selector-errors.js +0 -7
- package/dist/locator/selector.d.ts +14 -13
- package/dist/locator/selector.js +10 -16
- package/dist/locator/text-locator.d.ts +1 -1
- package/dist/locator/text-locator.js +5 -9
- package/dist/logger/index.d.ts +6 -0
- package/dist/logger/index.js +14 -7
- package/dist/network/bidi-wire.d.ts +10 -0
- package/dist/network/bidi-wire.js +38 -0
- package/dist/network/intercept.d.ts +30 -0
- package/dist/network/intercept.js +130 -0
- package/dist/network/network-tracker.d.ts +10 -47
- package/dist/network/network-tracker.js +34 -68
- package/dist/network/network-types.d.ts +33 -0
- package/dist/network/network-types.js +1 -0
- package/dist/network/network-wait.d.ts +7 -2
- package/dist/network/network-wait.js +14 -4
- package/dist/network/response.d.ts +1 -1
- package/dist/network/response.js +1 -1
- package/dist/network/route.d.ts +92 -0
- package/dist/network/route.js +142 -0
- package/dist/network/router.d.ts +6 -91
- package/dist/network/router.js +25 -258
- package/dist/recorder/expectation.d.ts +5 -0
- package/dist/recorder/expectation.js +20 -0
- package/dist/recorder/files-recorder.d.ts +30 -0
- package/dist/recorder/files-recorder.js +88 -0
- package/dist/recorder/normalise.d.ts +17 -6
- package/dist/recorder/normalise.js +96 -91
- package/dist/recorder/options.d.ts +56 -0
- package/dist/recorder/options.js +1 -0
- package/dist/recorder/page-messages.d.ts +35 -0
- package/dist/recorder/page-messages.js +26 -0
- package/dist/recorder/ranking.js +1 -0
- package/dist/recorder/realms.d.ts +6 -0
- package/dist/recorder/realms.js +13 -0
- package/dist/recorder/recorder.d.ts +10 -74
- package/dist/recorder/recorder.js +39 -199
- package/dist/recorder/session-browser.d.ts +22 -0
- package/dist/recorder/session-browser.js +21 -0
- package/dist/recorder/session-secrets.d.ts +8 -0
- package/dist/recorder/session-secrets.js +45 -0
- package/dist/recorder/session.d.ts +7 -13
- package/dist/recorder/session.js +22 -117
- package/dist/recorder/spec-source.d.ts +39 -0
- package/dist/recorder/spec-source.js +84 -0
- package/dist/recorder/toolbar/action-guard.d.ts +21 -0
- package/dist/recorder/toolbar/action-guard.js +43 -0
- package/dist/recorder/toolbar/actions/assert.d.ts +4 -0
- package/dist/recorder/toolbar/actions/assert.js +52 -0
- package/dist/recorder/toolbar/actions/insert.d.ts +6 -0
- package/dist/recorder/toolbar/actions/insert.js +93 -0
- package/dist/recorder/toolbar/actions/pick.d.ts +8 -0
- package/dist/recorder/toolbar/actions/pick.js +26 -0
- package/dist/recorder/toolbar/actions/reply.d.ts +7 -0
- package/dist/recorder/toolbar/actions/reply.js +10 -0
- package/dist/recorder/toolbar/controller-fixture.d.ts +47 -0
- package/dist/recorder/toolbar/controller-fixture.js +129 -0
- package/dist/recorder/toolbar/controller.d.ts +12 -78
- package/dist/recorder/toolbar/controller.js +35 -247
- package/dist/recorder/toolbar/inspect.d.ts +1 -3
- package/dist/recorder/toolbar/inspect.js +2 -2
- package/dist/recorder/toolbar/page-scope.d.ts +19 -0
- package/dist/recorder/toolbar/page-scope.js +43 -0
- package/dist/recorder/toolbar/protocol.d.ts +2 -1
- package/dist/recorder/toolbar/source/attach.d.ts +2 -0
- package/dist/recorder/toolbar/source/attach.js +41 -0
- package/dist/recorder/toolbar/source/dom.d.ts +2 -0
- package/dist/recorder/toolbar/source/dom.js +47 -0
- package/dist/recorder/toolbar/source/drag.d.ts +2 -0
- package/dist/recorder/toolbar/source/drag.js +32 -0
- package/dist/recorder/toolbar/source/events-page.d.ts +2 -0
- package/dist/recorder/toolbar/source/events-page.js +67 -0
- package/dist/recorder/toolbar/source/events-toolbar.d.ts +2 -0
- package/dist/recorder/toolbar/source/events-toolbar.js +35 -0
- package/dist/recorder/toolbar/source/fields.d.ts +2 -0
- package/dist/recorder/toolbar/source/fields.js +44 -0
- package/dist/recorder/toolbar/source/handlers.d.ts +2 -0
- package/dist/recorder/toolbar/source/handlers.js +134 -0
- package/dist/recorder/toolbar/source/names.d.ts +2 -0
- package/dist/recorder/toolbar/source/names.js +12 -0
- package/dist/recorder/toolbar/source/picking.d.ts +2 -0
- package/dist/recorder/toolbar/source/picking.js +72 -0
- package/dist/recorder/toolbar/source/placement.d.ts +2 -0
- package/dist/recorder/toolbar/source/placement.js +45 -0
- package/dist/recorder/toolbar/source/recorder-side.d.ts +2 -0
- package/dist/recorder/toolbar/source/recorder-side.js +54 -0
- package/dist/recorder/toolbar/source/setup.d.ts +2 -0
- package/dist/recorder/toolbar/source/setup.js +50 -0
- package/dist/recorder/toolbar/source/views-panels.d.ts +2 -0
- package/dist/recorder/toolbar/source/views-panels.js +150 -0
- package/dist/recorder/toolbar/source/views-rail.d.ts +2 -0
- package/dist/recorder/toolbar/source/views-rail.js +40 -0
- package/dist/recorder/toolbar/source/views-render.d.ts +2 -0
- package/dist/recorder/toolbar/source/views-render.js +48 -0
- package/dist/recorder/toolbar/source.js +30 -856
- package/dist/recorder/toolbar/types.d.ts +70 -0
- package/dist/recorder/toolbar/types.js +1 -0
- package/dist/recorder/toolbar-bridge.d.ts +43 -0
- package/dist/recorder/toolbar-bridge.js +106 -0
- package/dist/runner/browsers.d.ts +10 -0
- package/dist/runner/browsers.js +12 -0
- package/dist/runner/groups.d.ts +5 -1
- package/dist/runner/groups.js +9 -2
- package/dist/runner/options.d.ts +31 -0
- package/dist/runner/options.js +1 -0
- package/dist/runner/pooled-run.d.ts +43 -0
- package/dist/runner/pooled-run.js +75 -0
- package/dist/runner/ports.d.ts +2 -0
- package/dist/runner/ports.js +2 -0
- package/dist/runner/registry.d.ts +1 -1
- package/dist/runner/registry.js +1 -1
- package/dist/runner/reporter.d.ts +40 -11
- package/dist/runner/reporter.js +69 -16
- package/dist/runner/run-test.d.ts +16 -0
- package/dist/runner/run-test.js +178 -0
- package/dist/runner/run.d.ts +5 -2
- package/dist/runner/run.js +28 -28
- package/dist/runner/select.d.ts +24 -0
- package/dist/runner/select.js +77 -0
- package/dist/runner/test-dir.d.ts +13 -0
- package/dist/runner/test-dir.js +27 -0
- package/dist/runner/test-runner.d.ts +27 -50
- package/dist/runner/test-runner.js +102 -264
- package/dist/runner/worker-pool.d.ts +67 -0
- package/dist/runner/worker-pool.js +275 -0
- package/dist/runner/worker-process.d.ts +6 -0
- package/dist/runner/worker-process.js +54 -0
- package/dist/runner/worker-protocol.d.ts +67 -0
- package/dist/runner/worker-protocol.js +1 -0
- package/dist/runner/worker-session.d.ts +7 -0
- package/dist/runner/worker-session.js +60 -0
- package/dist/runner/worker.d.ts +26 -0
- package/dist/runner/worker.js +121 -0
- package/dist/runner/workers-option.d.ts +15 -0
- package/dist/runner/workers-option.js +22 -0
- package/dist/script/call-function.d.ts +1 -9
- package/dist/script/call-function.js +2 -19
- package/dist/script/element-handle.d.ts +1 -2
- package/dist/script/element-handle.js +1 -2
- package/dist/script/serialize.d.ts +3 -12
- package/dist/script/serialize.js +53 -62
- package/dist/steps/parse/call.d.ts +3 -0
- package/dist/steps/parse/call.js +81 -0
- package/dist/steps/parse/expectation.d.ts +5 -0
- package/dist/steps/parse/expectation.js +71 -0
- package/dist/steps/parse/file-entry.d.ts +4 -0
- package/dist/steps/parse/file-entry.js +74 -0
- package/dist/steps/parse/literals.d.ts +4 -0
- package/dist/steps/parse/literals.js +28 -0
- package/dist/steps/parse/step.d.ts +4 -0
- package/dist/steps/parse/step.js +81 -0
- package/dist/steps/parse.js +2 -323
- package/dist/transport/bidi-connection.d.ts +4 -2
- package/dist/transport/bidi-connection.js +9 -43
- package/dist/transport/log-redaction.d.ts +13 -0
- package/dist/transport/log-redaction.js +51 -0
- package/dist/transport/subscriptions.js +18 -13
- package/dist/transport/unsupported.d.ts +7 -0
- package/dist/transport/unsupported.js +13 -0
- package/dist/types/bidi-modules/browser.d.ts +1 -12
- package/dist/types/bidi-modules/browsing-context.d.ts +8 -18
- package/dist/types/bidi-modules/emulation.d.ts +29 -21
- package/dist/types/bidi-modules/input.d.ts +1 -9
- package/dist/types/bidi-modules/network.d.ts +29 -24
- package/dist/types/bidi-modules/script.d.ts +0 -9
- package/dist/types/bidi-modules/session.d.ts +0 -8
- package/dist/types/bidi-modules/storage.d.ts +0 -5
- package/dist/types/bidi.d.ts +7 -37
- package/dist/types/config.d.ts +17 -3
- package/dist/types/test.d.ts +15 -2
- package/dist/wait/wait-until.d.ts +1 -5
- package/dist/wait/wait-until.js +7 -16
- package/package.json +3 -2
- package/dist/config/default.d.ts +0 -2
- package/dist/config/default.js +0 -3
- package/dist/types/bidi-modules/web-extensions.d.ts +0 -9
- package/dist/types/bidi-protocols/command.d.ts +0 -7
- package/dist/types/bidi-protocols/event.d.ts +0 -17
- /package/dist/{script/helpers.d.ts → locator/helper-realm.d.ts} +0 -0
|
@@ -12,35 +12,44 @@ export interface EmulationCommands {
|
|
|
12
12
|
params: SetGeolocationOverrideParameters;
|
|
13
13
|
result: SetGeolocationOverrideResult;
|
|
14
14
|
};
|
|
15
|
-
"emulation.setLocaleOverride": {
|
|
16
|
-
|
|
15
|
+
"emulation.setLocaleOverride": {
|
|
16
|
+
params: SetLocaleOverrideParameters;
|
|
17
|
+
result: SetLocaleOverrideResult;
|
|
18
|
+
};
|
|
19
|
+
"emulation.setNetworkConditions": {
|
|
20
|
+
params: SetNetworkConditionsParameters;
|
|
21
|
+
result: EmptyResult;
|
|
22
|
+
};
|
|
17
23
|
"emulation.setScreenOrientationOverride": {
|
|
18
24
|
params: SetScreenOrientationOverrideParameters;
|
|
19
25
|
result: SetScreenOrientationOverrideResult;
|
|
20
26
|
};
|
|
21
|
-
"emulation.setScreenSettingsOverride": {
|
|
22
|
-
|
|
27
|
+
"emulation.setScreenSettingsOverride": {
|
|
28
|
+
params: SetScreenSettingsOverrideParameters;
|
|
29
|
+
result: EmptyResult;
|
|
30
|
+
};
|
|
31
|
+
"emulation.setScriptingEnabled": {
|
|
32
|
+
params: SetScriptingEnabledParameters;
|
|
33
|
+
result: SetScriptingEnabledResult;
|
|
34
|
+
};
|
|
23
35
|
"emulation.setScrollbarTypeOverride": {
|
|
24
36
|
params: SetScrollbarTypeOverrideParameters;
|
|
25
37
|
result: SetScrollbarTypeOverrideResult;
|
|
26
38
|
};
|
|
27
|
-
"emulation.setTimezoneOverride": {
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
"emulation.setTimezoneOverride": {
|
|
40
|
+
params: SetTimezoneOverrideParameters;
|
|
41
|
+
result: SetTimezoneOverrideResult;
|
|
42
|
+
};
|
|
43
|
+
"emulation.setTouchOverride": {
|
|
44
|
+
params: SetTouchOverrideParameters;
|
|
45
|
+
result: SetTouchOverrideResult;
|
|
46
|
+
};
|
|
47
|
+
"emulation.setUserAgentOverride": {
|
|
48
|
+
params: SetUserAgentOverrideParameters;
|
|
49
|
+
result: SetUserAgentOverrideResult;
|
|
50
|
+
};
|
|
30
51
|
}
|
|
31
52
|
|
|
32
|
-
/** Union of all possible result types returned by emulation module commands. */
|
|
33
|
-
export type EmulationResult =
|
|
34
|
-
| SetForcedColorsModeThemeOverrideResult
|
|
35
|
-
| SetGeolocationOverrideResult
|
|
36
|
-
| SetLocaleOverrideResult
|
|
37
|
-
| SetScreenOrientationOverrideResult
|
|
38
|
-
| SetScriptingEnabledResult
|
|
39
|
-
| SetScrollbarTypeOverrideResult
|
|
40
|
-
| SetTimezoneOverrideResult
|
|
41
|
-
| SetTouchOverrideResult
|
|
42
|
-
| SetUserAgentOverrideResult;
|
|
43
|
-
|
|
44
53
|
/** Result of `emulation.setForcedColorsModeThemeOverride`. */
|
|
45
54
|
export type SetForcedColorsModeThemeOverrideResult = EmptyResult;
|
|
46
55
|
/** Result of `emulation.setGeolocationOverride`. */
|
|
@@ -108,8 +117,7 @@ export interface GeolocationCoordinatesResponse {
|
|
|
108
117
|
|
|
109
118
|
/** Either a successful coordinates override or an error response. */
|
|
110
119
|
export type GeolocationOverrideResponse =
|
|
111
|
-
|
|
|
112
|
-
| GeolocationCoordinatesResponseError;
|
|
120
|
+
GeolocationCoordinatesResponse | GeolocationCoordinatesResponseError;
|
|
113
121
|
|
|
114
122
|
/** Parameters for `emulation.setGeolocationOverride`. */
|
|
115
123
|
export type SetGeolocationOverrideParameters = GeolocationOverrideResponse & {
|
|
@@ -68,10 +68,7 @@ export interface PointerParameters {
|
|
|
68
68
|
|
|
69
69
|
/** A single action for a pointer input source. */
|
|
70
70
|
export type PointerSourceAction =
|
|
71
|
-
|
|
|
72
|
-
| PointerDownAction
|
|
73
|
-
| PointerUpAction
|
|
74
|
-
| PointerMoveAction;
|
|
71
|
+
PauseAction | PointerDownAction | PointerUpAction | PointerMoveAction;
|
|
75
72
|
|
|
76
73
|
/** Actions for a wheel input source. */
|
|
77
74
|
export interface WheelSourceActions {
|
|
@@ -191,11 +188,6 @@ export interface FileDialogOpened {
|
|
|
191
188
|
params: FileDialogInfo;
|
|
192
189
|
}
|
|
193
190
|
|
|
194
|
-
export type InputResult =
|
|
195
|
-
| PerformActionResult
|
|
196
|
-
| ReleaseActionResult
|
|
197
|
-
| SetFilesResult;
|
|
198
|
-
|
|
199
191
|
export type PerformActionResult = EmptyResult;
|
|
200
192
|
export type ReleaseActionResult = EmptyResult;
|
|
201
193
|
export type SetFilesResult = EmptyResult;
|
|
@@ -14,7 +14,10 @@ export interface NetworkCommands {
|
|
|
14
14
|
};
|
|
15
15
|
result: AddInterceptResult;
|
|
16
16
|
};
|
|
17
|
-
"network.removeIntercept": {
|
|
17
|
+
"network.removeIntercept": {
|
|
18
|
+
params: { intercept: Intercept };
|
|
19
|
+
result: RemoveInterceptResult;
|
|
20
|
+
};
|
|
18
21
|
/** Lets a blocked request go on, optionally modified. */
|
|
19
22
|
"network.continueRequest": {
|
|
20
23
|
params: {
|
|
@@ -42,7 +45,11 @@ export interface NetworkCommands {
|
|
|
42
45
|
"network.continueWithAuth": {
|
|
43
46
|
params:
|
|
44
47
|
| { request: Request; action: "default" | "cancel" }
|
|
45
|
-
| {
|
|
48
|
+
| {
|
|
49
|
+
request: Request;
|
|
50
|
+
action: "provideCredentials";
|
|
51
|
+
credentials: AuthCredentials;
|
|
52
|
+
};
|
|
46
53
|
result: ContinueWithAuthResult;
|
|
47
54
|
};
|
|
48
55
|
/** Answers a blocked request without contacting the server. */
|
|
@@ -57,9 +64,15 @@ export interface NetworkCommands {
|
|
|
57
64
|
};
|
|
58
65
|
result: ProvideResponseResult;
|
|
59
66
|
};
|
|
60
|
-
"network.failRequest": {
|
|
67
|
+
"network.failRequest": {
|
|
68
|
+
params: { request: Request };
|
|
69
|
+
result: FailRequestResult;
|
|
70
|
+
};
|
|
61
71
|
"network.setCacheBehavior": {
|
|
62
|
-
params: {
|
|
72
|
+
params: {
|
|
73
|
+
cacheBehavior: "default" | "bypass";
|
|
74
|
+
contexts?: BrowsingContext[] | undefined;
|
|
75
|
+
};
|
|
63
76
|
result: SetCacheBehaviorResult;
|
|
64
77
|
};
|
|
65
78
|
/** Starts retaining response bodies for later `network.getData`. */
|
|
@@ -73,7 +86,10 @@ export interface NetworkCommands {
|
|
|
73
86
|
};
|
|
74
87
|
result: AddDataCollectorResult;
|
|
75
88
|
};
|
|
76
|
-
"network.removeDataCollector": {
|
|
89
|
+
"network.removeDataCollector": {
|
|
90
|
+
params: { collector: Collector };
|
|
91
|
+
result: RemoveDataCollectorResult;
|
|
92
|
+
};
|
|
77
93
|
"network.getData": {
|
|
78
94
|
params: {
|
|
79
95
|
dataType: DataType;
|
|
@@ -89,9 +105,14 @@ export interface NetworkCommands {
|
|
|
89
105
|
};
|
|
90
106
|
}
|
|
91
107
|
|
|
92
|
-
export type InterceptPhase =
|
|
108
|
+
export type InterceptPhase =
|
|
109
|
+
"beforeRequestSent" | "responseStarted" | "authRequired";
|
|
93
110
|
export type DataType = "request" | "response";
|
|
94
|
-
export type AuthCredentials = {
|
|
111
|
+
export type AuthCredentials = {
|
|
112
|
+
type: "password";
|
|
113
|
+
username: string;
|
|
114
|
+
password: string;
|
|
115
|
+
};
|
|
95
116
|
export type UrlPattern =
|
|
96
117
|
| { type: "string"; pattern: string }
|
|
97
118
|
| {
|
|
@@ -202,7 +223,7 @@ export interface BaseParameters {
|
|
|
202
223
|
/** Whether this request is currently blocked by an active intercept. */
|
|
203
224
|
isBlocked: boolean;
|
|
204
225
|
navigation: Navigation | null;
|
|
205
|
-
redirectCount:
|
|
226
|
+
redirectCount: number;
|
|
206
227
|
request: RequestData;
|
|
207
228
|
timestamp: number;
|
|
208
229
|
userContext?: UserContext | null;
|
|
@@ -301,22 +322,6 @@ export interface ResponseStarted {
|
|
|
301
322
|
params: ResponseStartedParameters;
|
|
302
323
|
}
|
|
303
324
|
|
|
304
|
-
/** Union of all possible result types returned by network module commands. */
|
|
305
|
-
export type NetworkResult =
|
|
306
|
-
| AddDataCollectorResult
|
|
307
|
-
| AddInterceptResult
|
|
308
|
-
| ContinueRequestResult
|
|
309
|
-
| ContinueResponseResult
|
|
310
|
-
| ContinueWithAuthResult
|
|
311
|
-
| DisownDataResult
|
|
312
|
-
| FailRequestResult
|
|
313
|
-
| GetDataResult
|
|
314
|
-
| ProvideResponseResult
|
|
315
|
-
| RemoveDataCollectorResult
|
|
316
|
-
| RemoveInterceptResult
|
|
317
|
-
| SetCacheBehaviorResult
|
|
318
|
-
| SetExtraHeadersResult;
|
|
319
|
-
|
|
320
325
|
/** Unique identifier for an active network data collector. */
|
|
321
326
|
export type Collector = string;
|
|
322
327
|
|
|
@@ -528,15 +528,6 @@ export interface RealmDestroyedParameters {
|
|
|
528
528
|
realm: Realm;
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
-
/** Union of all possible result types returned by script module commands. */
|
|
532
|
-
export type ScriptResult =
|
|
533
|
-
| AddPreloadScriptResult
|
|
534
|
-
| CallFunctionResult
|
|
535
|
-
| DisownResult
|
|
536
|
-
| EvaluateResult
|
|
537
|
-
| GetRealmsResult
|
|
538
|
-
| RemovePreloadScriptResult;
|
|
539
|
-
|
|
540
531
|
/** Unique identifier for a preload script registered via `script.addPreloadScript`. */
|
|
541
532
|
export type PreloadScript = string;
|
|
542
533
|
|
|
@@ -38,14 +38,6 @@ export type Subscription = string;
|
|
|
38
38
|
/** Defines how user prompts (alerts, confirms, prompts) should be automatically handled. */
|
|
39
39
|
export type UserPromptHandlerType = "accept" | "dismiss" | "ignore";
|
|
40
40
|
|
|
41
|
-
/** Union of all possible result types returned by session module commands. */
|
|
42
|
-
export type SessionResult =
|
|
43
|
-
| EndResult
|
|
44
|
-
| NewResult
|
|
45
|
-
| StatusResult
|
|
46
|
-
| SubscribeResult
|
|
47
|
-
| UnsubscribeResult;
|
|
48
|
-
|
|
49
41
|
/** Result of `session.end`. */
|
|
50
42
|
export type EndResult = EmptyResult;
|
|
51
43
|
|
|
@@ -68,11 +68,6 @@ export interface StorageKeyPartitionDescriptor extends Extensible {
|
|
|
68
68
|
sourceOrigin?: string;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export type StorageResult =
|
|
72
|
-
| DeleteCookiesResult
|
|
73
|
-
| GetCookiesResult
|
|
74
|
-
| SetCookieResult;
|
|
75
|
-
|
|
76
71
|
export interface PartitionKey extends Extensible {
|
|
77
72
|
userContext?: UserContext;
|
|
78
73
|
sourceOrigin?: string;
|
package/dist/types/bidi.d.ts
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import type { BrowserCommands
|
|
1
|
+
import type { BrowserCommands } from "./bidi-modules/browser.js";
|
|
2
2
|
import type {
|
|
3
3
|
BrowsingContextEvents,
|
|
4
4
|
BrowsingContextModule as BrowsingContextCommands,
|
|
5
|
-
BrowsingContextResult,
|
|
6
5
|
} from "./bidi-modules/browsing-context.js";
|
|
7
|
-
import type { EmulationCommands
|
|
8
|
-
import type {
|
|
9
|
-
InputCommands,
|
|
10
|
-
InputEvents,
|
|
11
|
-
InputResult,
|
|
12
|
-
} from "./bidi-modules/input.js";
|
|
6
|
+
import type { EmulationCommands } from "./bidi-modules/emulation.js";
|
|
7
|
+
import type { InputCommands, InputEvents } from "./bidi-modules/input.js";
|
|
13
8
|
import type { LogEvents } from "./bidi-modules/log.js";
|
|
14
9
|
import type { PermissionsCommands } from "./bidi-modules/permissions.js";
|
|
15
|
-
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./bidi-modules/network.js";
|
|
20
|
-
import type {
|
|
21
|
-
ScriptCommands,
|
|
22
|
-
ScriptEvents,
|
|
23
|
-
ScriptResult,
|
|
24
|
-
} from "./bidi-modules/script.js";
|
|
25
|
-
import type { SessionModule, SessionResult } from "./bidi-modules/session.js";
|
|
26
|
-
import type { StorageCommands, StorageResult } from "./bidi-modules/storage.js";
|
|
27
|
-
import type { WebExtensionResult } from "./bidi-modules/web-extensions.js";
|
|
28
|
-
import type { CommandResponse } from "./bidi-protocols/command.js";
|
|
29
|
-
import type { ErrorResponse } from "./bidi-protocols/error.js";
|
|
30
|
-
import type { BiDiEvent } from "./bidi-protocols/event.js";
|
|
10
|
+
import type { NetworkCommands, NetworkEvents } from "./bidi-modules/network.js";
|
|
11
|
+
import type { ScriptCommands, ScriptEvents } from "./bidi-modules/script.js";
|
|
12
|
+
import type { SessionModule } from "./bidi-modules/session.js";
|
|
13
|
+
import type { StorageCommands } from "./bidi-modules/storage.js";
|
|
31
14
|
|
|
32
15
|
export type BiDiCommands = BrowserCommands &
|
|
33
16
|
SessionModule &
|
|
@@ -45,19 +28,6 @@ export type BiDiEvents = BrowsingContextEvents &
|
|
|
45
28
|
NetworkEvents &
|
|
46
29
|
ScriptEvents;
|
|
47
30
|
|
|
48
|
-
export type BiDiMessages = CommandResponse | ErrorResponse | BiDiEvent;
|
|
49
|
-
|
|
50
|
-
export type ResultData =
|
|
51
|
-
| BrowserResult
|
|
52
|
-
| BrowsingContextResult
|
|
53
|
-
| EmulationResult
|
|
54
|
-
| InputResult
|
|
55
|
-
| NetworkResult
|
|
56
|
-
| ScriptResult
|
|
57
|
-
| SessionResult
|
|
58
|
-
| StorageResult
|
|
59
|
-
| WebExtensionResult;
|
|
60
|
-
|
|
61
31
|
export type EmptyResult = Extensible;
|
|
62
32
|
|
|
63
33
|
export interface Extensible {
|
package/dist/types/config.d.ts
CHANGED
|
@@ -24,6 +24,13 @@ export interface SamuraiGroup {
|
|
|
24
24
|
* Overrides 'src' and 'testMatch' options.
|
|
25
25
|
*/
|
|
26
26
|
tests?: SamuraiTest[];
|
|
27
|
+
/** The browsers this group's tests run in, instead of the project's `browsers` */
|
|
28
|
+
browsers?: SupportedBrowser[];
|
|
29
|
+
/**
|
|
30
|
+
* How many of this group's tests may run at the same time. Only `1` has an effect: the group's tests run one
|
|
31
|
+
* after the other, even when the run uses more workers (for tests that share an account or data).
|
|
32
|
+
*/
|
|
33
|
+
workers?: number;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
export interface SamuraiEnvironment {
|
|
@@ -45,10 +52,17 @@ export interface SamuraiTestConfig {
|
|
|
45
52
|
*/
|
|
46
53
|
srcDir?: string;
|
|
47
54
|
/**
|
|
48
|
-
* The
|
|
49
|
-
* @default "firefox"
|
|
55
|
+
* The browsers the tests run in, one after the other: every selected test runs once in each. A group can name its own.
|
|
56
|
+
* @default ["firefox"]
|
|
57
|
+
*/
|
|
58
|
+
browsers?: SupportedBrowser[];
|
|
59
|
+
/**
|
|
60
|
+
* How many tests run at the same time, each in a worker process of its own: a whole number from 1, or a share of
|
|
61
|
+
* the CPUs like `"50%"`. `--workers` and `SAMURAI_WORKERS` win over it. A config passed as an object, not read
|
|
62
|
+
* from `samurai.config.ts`, runs on one worker.
|
|
63
|
+
* @default half the CPUs
|
|
50
64
|
*/
|
|
51
|
-
|
|
65
|
+
workers?: number | string;
|
|
52
66
|
/**
|
|
53
67
|
* Browser binaries to launch instead of the builds SAMURAI downloads, relative to the project.
|
|
54
68
|
* `SAMURAI_FIREFOX_PATH` / `SAMURAI_CHROME_PATH` win over these.
|
package/dist/types/test.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { Browser } from "../browser/browser.
|
|
2
|
-
import type Page from "../browser/page.
|
|
1
|
+
import type { Browser } from "../browser/browser.js";
|
|
2
|
+
import type Page from "../browser/page.js";
|
|
3
|
+
import type { SupportedBrowser } from "./browser.js";
|
|
3
4
|
|
|
4
5
|
/** What a test function receives */
|
|
5
6
|
export interface TestFixtures {
|
|
6
7
|
page: Page;
|
|
7
8
|
browser: Browser;
|
|
9
|
+
/** The browser this run of the test is in */
|
|
10
|
+
browserName: SupportedBrowser;
|
|
11
|
+
/** The worker process running the test; 0 when the run has one worker or none */
|
|
12
|
+
workerIndex: number;
|
|
8
13
|
/** The chosen environment's variables; reading an unknown name throws */
|
|
9
14
|
env: Readonly<Record<string, string | number | boolean>>;
|
|
10
15
|
/** Secrets by name (SAMURAI_SECRET_<NAME>); reading an unset name throws */
|
|
@@ -66,12 +71,18 @@ export interface TestLogEntry {
|
|
|
66
71
|
interface TestResultIdentity {
|
|
67
72
|
name: string;
|
|
68
73
|
file: string;
|
|
74
|
+
/** The browser the test ran in */
|
|
75
|
+
browser: SupportedBrowser;
|
|
76
|
+
/** The worker process that ran the test; absent when the test ran in the main process */
|
|
77
|
+
worker?: number;
|
|
69
78
|
startTime: number;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
81
|
interface TestResultBase {
|
|
73
82
|
name: string;
|
|
74
83
|
file: string;
|
|
84
|
+
browser: SupportedBrowser;
|
|
85
|
+
worker?: number;
|
|
75
86
|
startTime: number;
|
|
76
87
|
status: "started";
|
|
77
88
|
}
|
|
@@ -102,4 +113,6 @@ interface TestSummaryBase {
|
|
|
102
113
|
tests: TestResult[];
|
|
103
114
|
/** The environment the run used */
|
|
104
115
|
environment: string;
|
|
116
|
+
/** The browsers the run used, in the order they ran */
|
|
117
|
+
browsers: SupportedBrowser[];
|
|
105
118
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export interface WaitOptions {
|
|
2
2
|
/** Total time (ms) to keep probing; 0 probes exactly once */
|
|
3
3
|
timeout: number;
|
|
4
|
-
/** Time (ms) between probes. @default 100 */
|
|
5
|
-
interval?: number;
|
|
6
4
|
}
|
|
7
5
|
export declare class WaitTimeoutError<T> extends Error {
|
|
8
6
|
readonly timeout: number;
|
|
@@ -10,11 +8,9 @@ export declare class WaitTimeoutError<T> extends Error {
|
|
|
10
8
|
readonly last: T | undefined;
|
|
11
9
|
constructor(timeout: number, last: T | undefined);
|
|
12
10
|
}
|
|
13
|
-
/** Per-call timeout, else the active run's expect timeout, else config `expect.timeout`, else 5000 */
|
|
14
|
-
export declare function resolveTimeout(perCall?: number): Promise<number>;
|
|
15
11
|
/**
|
|
16
12
|
* Probes until `isDone(current, previous)` is true and resolves with that result.
|
|
17
13
|
* Always probes at least once; with `timeout > 0` every probe races the time left.
|
|
18
14
|
* Probe errors are rethrown immediately. Throws WaitTimeoutError at the deadline.
|
|
19
15
|
*/
|
|
20
|
-
export declare function waitUntil<T>(probe: () => Promise<T>, isDone: (current: T, previous: T | undefined) => boolean, { timeout
|
|
16
|
+
export declare function waitUntil<T>(probe: () => Promise<T>, isDone: (current: T, previous: T | undefined) => boolean, { timeout }: WaitOptions): Promise<T>;
|
package/dist/wait/wait-until.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const DEFAULT_TIMEOUT = 5000;
|
|
5
|
-
const DEFAULT_INTERVAL = 100;
|
|
2
|
+
/** Time (ms) between probes */
|
|
3
|
+
const POLL_INTERVAL = 100;
|
|
6
4
|
export class WaitTimeoutError extends Error {
|
|
7
5
|
constructor(timeout, last) {
|
|
8
6
|
super(`Condition not met within ${timeout}ms`);
|
|
@@ -11,15 +9,6 @@ export class WaitTimeoutError extends Error {
|
|
|
11
9
|
this.last = last;
|
|
12
10
|
}
|
|
13
11
|
}
|
|
14
|
-
/** Per-call timeout, else the active run's expect timeout, else config `expect.timeout`, else 5000 */
|
|
15
|
-
export async function resolveTimeout(perCall) {
|
|
16
|
-
if (perCall !== undefined)
|
|
17
|
-
return perCall;
|
|
18
|
-
const run = peekRunSettings();
|
|
19
|
-
if (run)
|
|
20
|
-
return run.expectTimeout;
|
|
21
|
-
return (await readConfig("expect"))?.timeout ?? DEFAULT_TIMEOUT;
|
|
22
|
-
}
|
|
23
12
|
const DEADLINE = Symbol("deadline");
|
|
24
13
|
/**
|
|
25
14
|
* Races `probe()` against the time left. Resolves `{ value }` when the probe wins,
|
|
@@ -40,7 +29,7 @@ function probeBefore(probe, remaining) {
|
|
|
40
29
|
* Always probes at least once; with `timeout > 0` every probe races the time left.
|
|
41
30
|
* Probe errors are rethrown immediately. Throws WaitTimeoutError at the deadline.
|
|
42
31
|
*/
|
|
43
|
-
export async function waitUntil(probe, isDone, { timeout
|
|
32
|
+
export async function waitUntil(probe, isDone, { timeout }) {
|
|
44
33
|
const deadline = Date.now() + timeout;
|
|
45
34
|
let previous;
|
|
46
35
|
for (let first = true;; first = false) {
|
|
@@ -49,7 +38,9 @@ export async function waitUntil(probe, isDone, { timeout, interval = DEFAULT_INT
|
|
|
49
38
|
if (!first && remaining <= 0)
|
|
50
39
|
throw new WaitTimeoutError(timeout, previous);
|
|
51
40
|
// timeout 0 keeps the single probe un-raced so it always completes
|
|
52
|
-
const result = timeout > 0
|
|
41
|
+
const result = timeout > 0
|
|
42
|
+
? await probeBefore(probe, remaining)
|
|
43
|
+
: { value: await probe() };
|
|
53
44
|
if (result === DEADLINE)
|
|
54
45
|
throw new WaitTimeoutError(timeout, previous);
|
|
55
46
|
if (isDone(result.value, previous))
|
|
@@ -58,6 +49,6 @@ export async function waitUntil(probe, isDone, { timeout, interval = DEFAULT_INT
|
|
|
58
49
|
const left = deadline - Date.now();
|
|
59
50
|
if (left <= 0)
|
|
60
51
|
throw new WaitTimeoutError(timeout, previous);
|
|
61
|
-
await sleep(Math.min(
|
|
52
|
+
await sleep(Math.min(POLL_INTERVAL, left));
|
|
62
53
|
}
|
|
63
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itmetsam/samurai-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Browser test framework over WebDriver BiDi: auto-waiting locators, environments and secrets, a recorder, and a command line.",
|
|
5
5
|
"main": "dist/api.js",
|
|
6
6
|
"exports": {
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"type": "module",
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/node": "^25.6.0",
|
|
74
|
-
"
|
|
74
|
+
"esbuild": "^0.28.2",
|
|
75
|
+
"tsx": "^4.23.15"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
77
78
|
"@puppeteer/browsers": "^3.2.4",
|
package/dist/config/default.d.ts
DELETED
package/dist/config/default.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { BrowsingContextEvent } from "../bidi-modules/browsing-context.js";
|
|
2
|
-
import type { LogEvent } from "../bidi-modules/log.js";
|
|
3
|
-
import type { NetworkEvent } from "../bidi-modules/network.js";
|
|
4
|
-
import type { ScriptEvent } from "../bidi-modules/script.js";
|
|
5
|
-
import type { Extensible } from "../bidi.js";
|
|
6
|
-
|
|
7
|
-
export type BiDiEvent = Extensible &
|
|
8
|
-
EventData & {
|
|
9
|
-
type: "event";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type EventData =
|
|
13
|
-
| BrowsingContextEvent
|
|
14
|
-
| InputEvent
|
|
15
|
-
| LogEvent
|
|
16
|
-
| NetworkEvent
|
|
17
|
-
| ScriptEvent;
|
|
File without changes
|