testcafe 2.3.1 → 2.6.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/CHANGELOG.md +129 -0
- package/LICENSE +1 -1
- package/README.md +40 -46
- package/bin/testcafe-with-v8-flag-filter.js +2 -2
- package/lib/api/test-controller/execution-context.js +4 -2
- package/lib/api/test-controller/index.js +6 -1
- package/lib/api/test-run-tracker.js +1 -1
- package/lib/browser/connection/gateway/index.js +273 -0
- package/lib/browser/connection/gateway/status.js +10 -0
- package/lib/browser/connection/index.js +60 -47
- package/lib/browser/connection/service-routes.js +4 -2
- package/lib/browser/provider/built-in/dedicated/chrome/cdp-client/index.js +3 -2
- package/lib/browser/provider/built-in/dedicated/chrome/index.js +48 -23
- package/lib/browser/provider/built-in/dedicated/edge/index.js +4 -1
- package/lib/browser/provider/index.js +13 -4
- package/lib/browser/provider/plugin-host.js +7 -1
- package/lib/cli/argument-parser/index.js +10 -14
- package/lib/cli/cli.js +3 -4
- package/lib/cli/remotes-wizard.js +2 -1
- package/lib/cli/utils/should-move-option-to-end.js +17 -0
- package/lib/client/automation/deps/hammerhead.js +24 -0
- package/lib/client/automation/deps/testcafe-core.js +24 -0
- package/lib/client/automation/index.js +528 -161
- package/lib/client/automation/index.min.js +1 -1
- package/lib/client/automation/playback/press/get-key-info.js +44 -0
- package/lib/client/automation/playback/press/utils.js +142 -0
- package/lib/client/automation/utils/get-key-code.js +15 -0
- package/lib/client/automation/utils/get-key-identifier.js +14 -0
- package/lib/client/automation/utils/is-letter.js +7 -0
- package/lib/client/automation/utils/key-identifier-maps.js +93 -0
- package/lib/client/browser/idle-page/index.html.mustache +2 -2
- package/lib/client/browser/idle-page/index.js +13 -8
- package/lib/client/core/index.js +58 -10
- package/lib/client/core/index.min.js +1 -1
- package/lib/client/core/utils/array.js +77 -0
- package/lib/client/core/utils/dom.js +459 -0
- package/lib/client/core/utils/send-request-to-frame.js +22 -0
- package/lib/client/core/utils/style.js +102 -0
- package/lib/client/core/utils/values/boundary-values.js +41 -0
- package/lib/client/driver/index.js +253 -224
- package/lib/client/driver/index.min.js +1 -1
- package/lib/client/test-run/iframe.js.mustache +6 -6
- package/lib/client/test-run/index.js.mustache +37 -33
- package/lib/client/ui/index.js +3238 -54
- package/lib/client/ui/index.min.js +1 -1
- package/lib/client/ui/sprite.svg +15 -0
- package/lib/client/ui/styles.css +184 -41
- package/lib/compiler/babel/load-libs.js +6 -6
- package/lib/compiler/compilers.js +7 -7
- package/lib/compiler/index.js +6 -6
- package/lib/compiler/interfaces.js +1 -1
- package/lib/compiler/test-file/api-based.js +5 -5
- package/lib/compiler/test-file/formats/es-next/compiler.js +5 -5
- package/lib/compiler/test-file/formats/typescript/compiler.js +9 -9
- package/lib/compiler/test-file/get-exportable-lib-path.js +3 -3
- package/lib/configuration/configuration-base.js +9 -6
- package/lib/configuration/default-values.js +3 -3
- package/lib/configuration/formats.js +9 -5
- package/lib/configuration/interfaces.js +1 -1
- package/lib/configuration/option-names.js +3 -3
- package/lib/configuration/run-option-names.js +2 -2
- package/lib/configuration/testcafe-configuration.js +41 -24
- package/lib/configuration/types.js +1 -1
- package/lib/configuration/utils.js +32 -0
- package/lib/custom-client-scripts/client-script.js +2 -2
- package/lib/custom-client-scripts/get-code.js +3 -3
- package/lib/custom-client-scripts/routing.js +10 -12
- package/lib/errors/runtime/templates.js +4 -2
- package/lib/errors/test-run/templates.js +4 -1
- package/lib/errors/types.js +4 -1
- package/lib/index.js +6 -29
- package/lib/live/test-runner.js +5 -3
- package/lib/native-automation/add-custom-debug-formatters.js +22 -0
- package/lib/native-automation/api-base.js +27 -0
- package/lib/native-automation/client/event-descriptor.js +112 -0
- package/lib/native-automation/client/input.js +50 -0
- package/lib/native-automation/client/key-press/utils.js +31 -0
- package/lib/native-automation/client/types.js +11 -0
- package/lib/native-automation/client/utils.js +54 -0
- package/lib/native-automation/cookie-provider.js +115 -0
- package/lib/native-automation/empty-page-markup.js +11 -0
- package/lib/native-automation/error-route.js +7 -0
- package/lib/native-automation/errors.js +20 -0
- package/lib/native-automation/index.js +53 -0
- package/lib/native-automation/request-hooks/event-factory/frame-navigated-event-based.js +40 -0
- package/lib/native-automation/request-hooks/event-factory/request-paused-event-based.js +94 -0
- package/lib/native-automation/request-hooks/event-provider.js +52 -0
- package/lib/native-automation/request-hooks/pipeline-context.js +11 -0
- package/lib/{proxyless → native-automation}/request-pipeline/constants.js +1 -1
- package/lib/native-automation/request-pipeline/context-info.js +55 -0
- package/lib/native-automation/request-pipeline/index.js +309 -0
- package/lib/native-automation/request-pipeline/resendAuthRequest.js +23 -0
- package/lib/native-automation/request-pipeline/safe-api.js +63 -0
- package/lib/native-automation/request-pipeline/special-handlers.js +73 -0
- package/lib/native-automation/request-pipeline/test-run-bridge.js +45 -0
- package/lib/native-automation/resource-injector.js +175 -0
- package/lib/native-automation/session-storage/index.js +43 -0
- package/lib/native-automation/storages-provider.js +17 -0
- package/lib/native-automation/types.js +12 -0
- package/lib/native-automation/utils/cdp.js +70 -0
- package/lib/native-automation/utils/convert.js +11 -0
- package/lib/native-automation/utils/get-active-client.js +8 -0
- package/lib/native-automation/utils/headers.js +30 -0
- package/lib/native-automation/utils/string.js +32 -0
- package/lib/reporter/index.js +52 -4
- package/lib/reporter/interfaces.js +1 -1
- package/lib/reporter/plugin-host.js +44 -4
- package/lib/reporter/plugin-methods.js +2 -1
- package/lib/reporter/report-data-log.js +25 -0
- package/lib/runner/bootstrapper.js +38 -6
- package/lib/runner/index.js +87 -47
- package/lib/runner/interfaces.js +1 -1
- package/lib/runner/task/index.js +1 -29
- package/lib/runner/test-run-controller.js +45 -1
- package/lib/services/compiler/host.js +3 -3
- package/lib/services/compiler/interfaces.js +1 -1
- package/lib/services/compiler/service.js +6 -5
- package/lib/services/compiler/test-run-proxy.js +3 -2
- package/lib/services/interfaces.js +1 -1
- package/lib/services/serialization/replicator/transforms/command-base-trasform/command-constructors.js +2 -1
- package/lib/shared/errors/index.js +8 -2
- package/lib/shared/utils/is-file-protocol.js +2 -2
- package/lib/test-run/commands/actions.js +16 -4
- package/lib/test-run/commands/type.js +2 -1
- package/lib/test-run/cookies/base.js +4 -1
- package/lib/test-run/cookies/factory.js +4 -4
- package/lib/test-run/cookies/provider.js +9 -2
- package/lib/test-run/execute-js-expression/index.js +4 -2
- package/lib/test-run/index.js +29 -22
- package/lib/test-run/request/create-request-options.js +37 -24
- package/lib/test-run/request/send.js +2 -3
- package/lib/test-run/role-provider.js +5 -5
- package/lib/test-run/session-controller.js +5 -5
- package/lib/test-run/storages/factory.js +4 -4
- package/lib/testcafe.js +17 -10
- package/lib/utils/check-is-vm.js +58 -0
- package/lib/utils/debug-loggers.js +7 -7
- package/lib/utils/get-browser.js +5 -2
- package/lib/utils/get-options/boolean-or-object-option.js +18 -0
- package/lib/utils/get-options/quarantine.js +10 -13
- package/lib/utils/get-options/skip-js-errors.js +12 -16
- package/lib/utils/parse-user-agent.js +4 -12
- package/lib/utils/string.js +1 -1
- package/package.json +13 -9
- package/ts-defs/index.d.ts +12 -2
- package/ts-defs/selectors.d.ts +8 -1
- package/ts-defs/testcafe-scripts.d.ts +8 -1
- package/lib/browser/connection/gateway.js +0 -205
- package/lib/proxyless/add-custom-debug-formatters.js +0 -22
- package/lib/proxyless/api-base.js +0 -25
- package/lib/proxyless/client/event-simulator.js +0 -40
- package/lib/proxyless/client/types.js +0 -11
- package/lib/proxyless/client/utils.js +0 -24
- package/lib/proxyless/cookie-provider.js +0 -87
- package/lib/proxyless/default-setup-options.js +0 -9
- package/lib/proxyless/empty-page-markup.js +0 -11
- package/lib/proxyless/error-route.js +0 -7
- package/lib/proxyless/index.js +0 -53
- package/lib/proxyless/request-hooks/event-factory/frame-navigated-event-based.js +0 -40
- package/lib/proxyless/request-hooks/event-factory/request-paused-event-based.js +0 -95
- package/lib/proxyless/request-hooks/event-provider.js +0 -52
- package/lib/proxyless/request-hooks/pipeline-context.js +0 -11
- package/lib/proxyless/request-pipeline/context-info.js +0 -55
- package/lib/proxyless/request-pipeline/index.js +0 -230
- package/lib/proxyless/request-pipeline/resendAuthRequest.js +0 -23
- package/lib/proxyless/request-pipeline/safe-api.js +0 -62
- package/lib/proxyless/request-pipeline/special-handlers.js +0 -73
- package/lib/proxyless/request-pipeline/test-run-bridge.js +0 -45
- package/lib/proxyless/resource-injector.js +0 -162
- package/lib/proxyless/session-storage/index.js +0 -39
- package/lib/proxyless/storages-provider.js +0 -17
- package/lib/proxyless/types.js +0 -10
- package/lib/proxyless/utils/cdp.js +0 -66
- package/lib/proxyless/utils/get-active-client.js +0 -8
- package/lib/proxyless/utils/headers.js +0 -30
- package/lib/proxyless/utils/string.js +0 -32
|
@@ -235,6 +235,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
235
235
|
addRequestHooks: 'add-request-hooks',
|
|
236
236
|
removeRequestHooks: 'remove-request-hooks',
|
|
237
237
|
runCustomAction: 'run-custom-action',
|
|
238
|
+
report: 'report',
|
|
238
239
|
};
|
|
239
240
|
|
|
240
241
|
// -------------------------------------------------------------
|
|
@@ -398,6 +399,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
398
399
|
actionFunctionOptionError: 'E99',
|
|
399
400
|
actionInvalidObjectPropertyError: 'E100',
|
|
400
401
|
actionElementIsNotTargetError: 'E101',
|
|
402
|
+
multipleWindowsModeIsNotSupportedInNativeAutomationError: 'E102',
|
|
401
403
|
};
|
|
402
404
|
|
|
403
405
|
// Base
|
|
@@ -920,6 +922,13 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
920
922
|
return _this;
|
|
921
923
|
}
|
|
922
924
|
return UncaughtErrorInNativeDialogHandler;
|
|
925
|
+
}(TestRunErrorBase));
|
|
926
|
+
var MultipleWindowsModeIsNotSupportedInNativeAutomationModeError = /** @class */ (function (_super) {
|
|
927
|
+
__extends(MultipleWindowsModeIsNotSupportedInNativeAutomationModeError, _super);
|
|
928
|
+
function MultipleWindowsModeIsNotSupportedInNativeAutomationModeError() {
|
|
929
|
+
return _super.call(this, TEST_RUN_ERRORS.multipleWindowsModeIsNotSupportedInNativeAutomationError) || this;
|
|
930
|
+
}
|
|
931
|
+
return MultipleWindowsModeIsNotSupportedInNativeAutomationModeError;
|
|
923
932
|
}(TestRunErrorBase));
|
|
924
933
|
|
|
925
934
|
var Errors = /*#__PURE__*/Object.freeze({
|
|
@@ -982,7 +991,8 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
982
991
|
CurrentIframeNotFoundError: CurrentIframeNotFoundError,
|
|
983
992
|
CurrentIframeIsInvisibleError: CurrentIframeIsInvisibleError,
|
|
984
993
|
NativeDialogNotHandledError: NativeDialogNotHandledError,
|
|
985
|
-
UncaughtErrorInNativeDialogHandler: UncaughtErrorInNativeDialogHandler
|
|
994
|
+
UncaughtErrorInNativeDialogHandler: UncaughtErrorInNativeDialogHandler,
|
|
995
|
+
MultipleWindowsModeIsNotSupportedInNativeAutomationModeError: MultipleWindowsModeIsNotSupportedInNativeAutomationModeError
|
|
986
996
|
});
|
|
987
997
|
|
|
988
998
|
// -------------------------------------------------------------
|
|
@@ -1957,11 +1967,10 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
1957
1967
|
}(InterDriverMessage));
|
|
1958
1968
|
var ExecuteCommandMessage = /** @class */ (function (_super) {
|
|
1959
1969
|
__extends(ExecuteCommandMessage, _super);
|
|
1960
|
-
function ExecuteCommandMessage(command, testSpeed
|
|
1970
|
+
function ExecuteCommandMessage(command, testSpeed) {
|
|
1961
1971
|
var _this = _super.call(this, TYPE.executeCommand) || this;
|
|
1962
1972
|
_this.command = command;
|
|
1963
1973
|
_this.testSpeed = testSpeed;
|
|
1964
|
-
_this.leftTopPoint = leftTopPoint;
|
|
1965
1974
|
return _this;
|
|
1966
1975
|
}
|
|
1967
1976
|
return ExecuteCommandMessage;
|
|
@@ -2051,7 +2060,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
2051
2060
|
var JSON$1 = hammerhead__default.json;
|
|
2052
2061
|
var nativeMethods$1 = hammerhead__default.nativeMethods;
|
|
2053
2062
|
var STORAGE_KEY_PREFIX = 'testcafe|driver|';
|
|
2054
|
-
var
|
|
2063
|
+
var NATIVE_AUTOMATION_STORAGE_KEY = '%nativeAutomationContextStorage%';
|
|
2055
2064
|
var StorageStrategyBase = /** @class */ (function () {
|
|
2056
2065
|
function StorageStrategyBase() {
|
|
2057
2066
|
}
|
|
@@ -2105,42 +2114,42 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
2105
2114
|
};
|
|
2106
2115
|
return StorageStrategyProxy;
|
|
2107
2116
|
}(StorageStrategyBase));
|
|
2108
|
-
var
|
|
2109
|
-
__extends(
|
|
2110
|
-
function
|
|
2117
|
+
var StorageStrategyNativeAutomation = /** @class */ (function (_super) {
|
|
2118
|
+
__extends(StorageStrategyNativeAutomation, _super);
|
|
2119
|
+
function StorageStrategyNativeAutomation(window, testRunId) {
|
|
2111
2120
|
var _this = _super.call(this) || this;
|
|
2112
2121
|
var _a = testRunId.split('-'), id = _a[0], frameId = _a[1];
|
|
2113
2122
|
_this.testRunId = id;
|
|
2114
2123
|
_this.frameId = frameId || 'main';
|
|
2115
2124
|
return _this;
|
|
2116
2125
|
}
|
|
2117
|
-
|
|
2126
|
+
StorageStrategyNativeAutomation.prototype._getData = function () {
|
|
2118
2127
|
var _a;
|
|
2119
|
-
return (_a = window[
|
|
2128
|
+
return (_a = window[NATIVE_AUTOMATION_STORAGE_KEY]) === null || _a === void 0 ? void 0 : _a[this.frameId];
|
|
2120
2129
|
};
|
|
2121
|
-
|
|
2122
|
-
window[
|
|
2130
|
+
StorageStrategyNativeAutomation.prototype._deleteData = function () {
|
|
2131
|
+
window[NATIVE_AUTOMATION_STORAGE_KEY] = null;
|
|
2123
2132
|
};
|
|
2124
|
-
|
|
2125
|
-
if (window.
|
|
2126
|
-
window.
|
|
2133
|
+
StorageStrategyNativeAutomation.prototype.save = function (data) {
|
|
2134
|
+
if (window.NATIVE_AUTOMATION_STORAGE_BINDING) {
|
|
2135
|
+
window.NATIVE_AUTOMATION_STORAGE_BINDING(JSON$1.stringify({
|
|
2127
2136
|
testRunId: this.testRunId,
|
|
2128
2137
|
frameDriverId: this.frameId,
|
|
2129
2138
|
data: JSON$1.stringify(data),
|
|
2130
2139
|
}));
|
|
2131
2140
|
}
|
|
2132
2141
|
};
|
|
2133
|
-
return
|
|
2142
|
+
return StorageStrategyNativeAutomation;
|
|
2134
2143
|
}(StorageStrategyBase));
|
|
2135
2144
|
var Storage = /** @class */ (function () {
|
|
2136
2145
|
function Storage(window, _a) {
|
|
2137
|
-
var testRunId = _a.testRunId, windowId = _a.windowId,
|
|
2138
|
-
this.strategy = this._createStorageStrategy(
|
|
2146
|
+
var testRunId = _a.testRunId, windowId = _a.windowId, nativeAutomation = _a.nativeAutomation;
|
|
2147
|
+
this.strategy = this._createStorageStrategy(nativeAutomation, window, testRunId, windowId);
|
|
2139
2148
|
this.data = this.strategy.loadFromStorage();
|
|
2140
2149
|
this.testRunId = testRunId;
|
|
2141
2150
|
}
|
|
2142
|
-
Storage.prototype._createStorageStrategy = function (
|
|
2143
|
-
return
|
|
2151
|
+
Storage.prototype._createStorageStrategy = function (nativeAutomation, window, testRunId, windowId) {
|
|
2152
|
+
return nativeAutomation ? new StorageStrategyNativeAutomation(window, testRunId, windowId) : new StorageStrategyProxy(window, testRunId, windowId);
|
|
2144
2153
|
};
|
|
2145
2154
|
Storage.prototype.save = function () {
|
|
2146
2155
|
this.strategy.save(this.data);
|
|
@@ -2319,162 +2328,13 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
2319
2328
|
hammerhead.eventSandbox.message.sendServiceMsg(msg, window);
|
|
2320
2329
|
}
|
|
2321
2330
|
|
|
2322
|
-
var BoundaryValues = /** @class */ (function () {
|
|
2323
|
-
function BoundaryValues(top, right, bottom, left) {
|
|
2324
|
-
if (top === void 0) { top = 0; }
|
|
2325
|
-
if (right === void 0) { right = 0; }
|
|
2326
|
-
if (bottom === void 0) { bottom = 0; }
|
|
2327
|
-
if (left === void 0) { left = 0; }
|
|
2328
|
-
this.top = top;
|
|
2329
|
-
this.right = right;
|
|
2330
|
-
this.bottom = bottom;
|
|
2331
|
-
this.left = left;
|
|
2332
|
-
}
|
|
2333
|
-
BoundaryValues.create = function (v) {
|
|
2334
|
-
return new BoundaryValues(v.top, v.right, v.bottom, v.left);
|
|
2335
|
-
};
|
|
2336
|
-
BoundaryValues.prototype.add = function (d) {
|
|
2337
|
-
this.top += d.top;
|
|
2338
|
-
this.right += d.right;
|
|
2339
|
-
this.bottom += d.bottom;
|
|
2340
|
-
this.left += d.left;
|
|
2341
|
-
return this;
|
|
2342
|
-
};
|
|
2343
|
-
BoundaryValues.prototype.sub = function (d) {
|
|
2344
|
-
if ('top' in d) {
|
|
2345
|
-
this.top -= d.top;
|
|
2346
|
-
this.left -= d.left;
|
|
2347
|
-
}
|
|
2348
|
-
this.bottom -= d.bottom;
|
|
2349
|
-
this.right -= d.right;
|
|
2350
|
-
return this;
|
|
2351
|
-
};
|
|
2352
|
-
BoundaryValues.prototype.round = function (leftTopRound, rightBottomRound) {
|
|
2353
|
-
if (leftTopRound === void 0) { leftTopRound = Math.round; }
|
|
2354
|
-
if (rightBottomRound === void 0) { rightBottomRound = leftTopRound; }
|
|
2355
|
-
this.top = leftTopRound(this.top);
|
|
2356
|
-
this.right = rightBottomRound(this.right);
|
|
2357
|
-
this.bottom = rightBottomRound(this.bottom);
|
|
2358
|
-
this.left = leftTopRound(this.left);
|
|
2359
|
-
return this;
|
|
2360
|
-
};
|
|
2361
|
-
BoundaryValues.prototype.contains = function (point) {
|
|
2362
|
-
return point.x >= this.left && point.x <= this.right && point.y >= this.top && point.y <= this.bottom;
|
|
2363
|
-
};
|
|
2364
|
-
return BoundaryValues;
|
|
2365
|
-
}());
|
|
2366
|
-
|
|
2367
|
-
var ARRAY_METHODS_PREFIX = 'array';
|
|
2368
|
-
function createNativeMethodWrapper(methodName) {
|
|
2369
|
-
var nativeMethodName = ARRAY_METHODS_PREFIX + methodName.charAt(0).toUpperCase() + methodName.slice(1);
|
|
2370
|
-
var nativeMethod = hammerhead.nativeMethods[nativeMethodName];
|
|
2371
|
-
return function () {
|
|
2372
|
-
var args = [];
|
|
2373
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2374
|
-
args[_i] = arguments[_i];
|
|
2375
|
-
}
|
|
2376
|
-
return nativeMethod.call.apply(nativeMethod, args);
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
var filter = createNativeMethodWrapper('filter');
|
|
2380
|
-
var map = createNativeMethodWrapper('map');
|
|
2381
|
-
var slice = createNativeMethodWrapper('slice');
|
|
2382
|
-
var splice = createNativeMethodWrapper('splice');
|
|
2383
|
-
var unshift = createNativeMethodWrapper('unshift');
|
|
2384
|
-
var forEach = createNativeMethodWrapper('forEach');
|
|
2385
|
-
var indexOf = createNativeMethodWrapper('indexOf');
|
|
2386
|
-
var some = createNativeMethodWrapper('some');
|
|
2387
|
-
var reverse = createNativeMethodWrapper('reverse');
|
|
2388
|
-
var reduce = createNativeMethodWrapper('reduce');
|
|
2389
|
-
var concat = createNativeMethodWrapper('concat');
|
|
2390
|
-
var join = createNativeMethodWrapper('join');
|
|
2391
|
-
|
|
2392
|
-
var browserUtils = hammerhead__default.utils.browser;
|
|
2393
|
-
var nativeMethods$2 = hammerhead__default.nativeMethods;
|
|
2394
|
-
// NOTE: We have to retrieve styleUtils.get from hammerhead
|
|
2395
|
-
// to avoid circular dependencies between domUtils and styleUtils
|
|
2396
|
-
var getElementStyleProperty = hammerhead__default.utils.style.get;
|
|
2397
|
-
var getActiveElement = hammerhead__default.utils.dom.getActiveElement;
|
|
2398
|
-
var findDocument = hammerhead__default.utils.dom.findDocument;
|
|
2399
|
-
var find = hammerhead__default.utils.dom.find;
|
|
2400
|
-
var isElementInDocument = hammerhead__default.utils.dom.isElementInDocument;
|
|
2401
|
-
var isElementInIframe = hammerhead__default.utils.dom.isElementInIframe;
|
|
2402
|
-
var getIframeByElement = hammerhead__default.utils.dom.getIframeByElement;
|
|
2403
|
-
var isCrossDomainWindows = hammerhead__default.utils.dom.isCrossDomainWindows;
|
|
2404
|
-
var getSelectParent = hammerhead__default.utils.dom.getSelectParent;
|
|
2405
|
-
var getChildVisibleIndex = hammerhead__default.utils.dom.getChildVisibleIndex;
|
|
2406
|
-
var getSelectVisibleChildren = hammerhead__default.utils.dom.getSelectVisibleChildren;
|
|
2407
|
-
var isElementNode = hammerhead__default.utils.dom.isElementNode;
|
|
2408
|
-
var isTextNode = hammerhead__default.utils.dom.isTextNode;
|
|
2409
|
-
var isRenderedNode = hammerhead__default.utils.dom.isRenderedNode;
|
|
2410
|
-
var isIframeElement = hammerhead__default.utils.dom.isIframeElement;
|
|
2411
|
-
var isInputElement = hammerhead__default.utils.dom.isInputElement;
|
|
2412
|
-
var isButtonElement = hammerhead__default.utils.dom.isButtonElement;
|
|
2413
|
-
var isFileInput = hammerhead__default.utils.dom.isFileInput;
|
|
2414
|
-
var isTextAreaElement = hammerhead__default.utils.dom.isTextAreaElement;
|
|
2415
|
-
var isAnchorElement = hammerhead__default.utils.dom.isAnchorElement;
|
|
2416
|
-
var isImgElement = hammerhead__default.utils.dom.isImgElement;
|
|
2417
|
-
var isFormElement = hammerhead__default.utils.dom.isFormElement;
|
|
2418
|
-
var isLabelElement = hammerhead__default.utils.dom.isLabelElement;
|
|
2419
|
-
var isSelectElement = hammerhead__default.utils.dom.isSelectElement;
|
|
2420
|
-
var isRadioButtonElement = hammerhead__default.utils.dom.isRadioButtonElement;
|
|
2421
|
-
var isColorInputElement = hammerhead__default.utils.dom.isColorInputElement;
|
|
2422
|
-
var isCheckboxElement = hammerhead__default.utils.dom.isCheckboxElement;
|
|
2423
|
-
var isOptionElement = hammerhead__default.utils.dom.isOptionElement;
|
|
2424
|
-
var isSVGElement = hammerhead__default.utils.dom.isSVGElement;
|
|
2425
|
-
var isMapElement = hammerhead__default.utils.dom.isMapElement;
|
|
2426
|
-
var isBodyElement = hammerhead__default.utils.dom.isBodyElement;
|
|
2427
|
-
var isHtmlElement = hammerhead__default.utils.dom.isHtmlElement;
|
|
2428
|
-
var isDocument = hammerhead__default.utils.dom.isDocument;
|
|
2429
|
-
var isWindow = hammerhead__default.utils.dom.isWindow;
|
|
2430
|
-
var isTextEditableInput = hammerhead__default.utils.dom.isTextEditableInput;
|
|
2431
|
-
var isTextEditableElement = hammerhead__default.utils.dom.isTextEditableElement;
|
|
2432
|
-
var isTextEditableElementAndEditingAllowed = hammerhead__default.utils.dom.isTextEditableElementAndEditingAllowed;
|
|
2433
|
-
var isContentEditableElement = hammerhead__default.utils.dom.isContentEditableElement;
|
|
2434
|
-
var isDomElement = hammerhead__default.utils.dom.isDomElement;
|
|
2435
|
-
var isShadowUIElement = hammerhead__default.utils.dom.isShadowUIElement;
|
|
2436
|
-
var isShadowRoot = hammerhead__default.utils.dom.isShadowRoot;
|
|
2437
|
-
var isElementFocusable = hammerhead__default.utils.dom.isElementFocusable;
|
|
2438
|
-
var isHammerheadAttr = hammerhead__default.utils.dom.isHammerheadAttr;
|
|
2439
|
-
var isElementReadOnly = hammerhead__default.utils.dom.isElementReadOnly;
|
|
2440
|
-
var getScrollbarSize = hammerhead__default.utils.dom.getScrollbarSize;
|
|
2441
|
-
var getMapContainer = hammerhead__default.utils.dom.getMapContainer;
|
|
2442
|
-
var getTagName = hammerhead__default.utils.dom.getTagName;
|
|
2443
|
-
var closest = hammerhead__default.utils.dom.closest;
|
|
2444
|
-
var getParents = hammerhead__default.utils.dom.getParents;
|
|
2445
|
-
var findParent = hammerhead__default.utils.dom.findParent;
|
|
2446
|
-
var getTopSameDomainWindow = hammerhead__default.utils.dom.getTopSameDomainWindow;
|
|
2447
|
-
var getParentExceptShadowRoot = hammerhead__default.utils.dom.getParentExceptShadowRoot;
|
|
2448
|
-
|
|
2449
|
-
var styleUtils = hammerhead__default.utils.style;
|
|
2450
|
-
var getBordersWidth = hammerhead__default.utils.style.getBordersWidth;
|
|
2451
|
-
var getComputedStyle = hammerhead__default.utils.style.getComputedStyle;
|
|
2452
|
-
var getElementMargin = hammerhead__default.utils.style.getElementMargin;
|
|
2453
|
-
var getElementPadding = hammerhead__default.utils.style.getElementPadding;
|
|
2454
|
-
var getElementScroll = hammerhead__default.utils.style.getElementScroll;
|
|
2455
|
-
var getOptionHeight = hammerhead__default.utils.style.getOptionHeight;
|
|
2456
|
-
var getSelectElementSize = hammerhead__default.utils.style.getSelectElementSize;
|
|
2457
|
-
var isElementVisible = hammerhead__default.utils.style.isElementVisible;
|
|
2458
|
-
var isSelectVisibleChild = hammerhead__default.utils.style.isVisibleChild;
|
|
2459
|
-
var getWidth = hammerhead__default.utils.style.getWidth;
|
|
2460
|
-
var getHeight = hammerhead__default.utils.style.getHeight;
|
|
2461
|
-
var getInnerWidth = hammerhead__default.utils.style.getInnerWidth;
|
|
2462
|
-
var getInnerHeight = hammerhead__default.utils.style.getInnerHeight;
|
|
2463
|
-
var getScrollLeft = hammerhead__default.utils.style.getScrollLeft;
|
|
2464
|
-
var getScrollTop = hammerhead__default.utils.style.getScrollTop;
|
|
2465
|
-
var setScrollLeft = hammerhead__default.utils.style.setScrollLeft;
|
|
2466
|
-
var setScrollTop = hammerhead__default.utils.style.setScrollTop;
|
|
2467
|
-
var get = hammerhead__default.utils.style.get;
|
|
2468
|
-
var getBordersWidthFloat = hammerhead__default.utils.style.getBordersWidthFloat;
|
|
2469
|
-
var getElementPaddingFloat = hammerhead__default.utils.style.getElementPaddingFloat;
|
|
2470
|
-
|
|
2471
2331
|
var ChildIframeDriverLink = /** @class */ (function () {
|
|
2472
|
-
function ChildIframeDriverLink(driverWindow, driverId,
|
|
2332
|
+
function ChildIframeDriverLink(driverWindow, driverId, dispatchNativeAutomationEventUrls) {
|
|
2473
2333
|
this.driverWindow = driverWindow;
|
|
2474
2334
|
this.driverIframe = testcafeCore.domUtils.findIframeByWindow(driverWindow);
|
|
2475
2335
|
this.driverId = driverId;
|
|
2476
2336
|
this.iframeAvailabilityTimeout = 0;
|
|
2477
|
-
this.
|
|
2337
|
+
this.dispatchNativeAutomationEventUrls = dispatchNativeAutomationEventUrls;
|
|
2478
2338
|
}
|
|
2479
2339
|
Object.defineProperty(ChildIframeDriverLink.prototype, "availabilityTimeout", {
|
|
2480
2340
|
set: function (val) {
|
|
@@ -2524,37 +2384,21 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
2524
2384
|
return status;
|
|
2525
2385
|
});
|
|
2526
2386
|
};
|
|
2527
|
-
ChildIframeDriverLink.prototype._getLeftTopPoint = function (proxyless) {
|
|
2528
|
-
if (!proxyless)
|
|
2529
|
-
return null;
|
|
2530
|
-
var rect = this.driverIframe.getBoundingClientRect();
|
|
2531
|
-
var borders = getBordersWidthFloat(this.driverIframe);
|
|
2532
|
-
var paddings = getElementPaddingFloat(this.driverIframe);
|
|
2533
|
-
return {
|
|
2534
|
-
x: rect.left + borders.left + paddings.left,
|
|
2535
|
-
y: rect.top + borders.top + paddings.top,
|
|
2536
|
-
};
|
|
2537
|
-
};
|
|
2538
2387
|
ChildIframeDriverLink.prototype.sendConfirmationMessage = function (requestMsgId) {
|
|
2539
2388
|
sendConfirmationMessage({
|
|
2540
2389
|
requestMsgId: requestMsgId,
|
|
2541
|
-
result: { id: this.driverId,
|
|
2390
|
+
result: { id: this.driverId, dispatchNativeAutomationEventUrls: this.dispatchNativeAutomationEventUrls },
|
|
2542
2391
|
window: this.driverWindow,
|
|
2543
2392
|
});
|
|
2544
2393
|
};
|
|
2545
|
-
ChildIframeDriverLink.prototype.executeCommand = function (command, testSpeed
|
|
2394
|
+
ChildIframeDriverLink.prototype.executeCommand = function (command, testSpeed) {
|
|
2546
2395
|
var _this = this;
|
|
2547
2396
|
// NOTE: We should check if the iframe is visible and exists before executing the next
|
|
2548
2397
|
// command, because the iframe might be hidden or removed since the previous command.
|
|
2549
2398
|
return this
|
|
2550
2399
|
._ensureIframe()
|
|
2551
2400
|
.then(function () {
|
|
2552
|
-
var
|
|
2553
|
-
if (leftTopPoint) {
|
|
2554
|
-
currentLeftTopPoint.x += leftTopPoint.x;
|
|
2555
|
-
currentLeftTopPoint.y += leftTopPoint.y;
|
|
2556
|
-
}
|
|
2557
|
-
var msg = new ExecuteCommandMessage(command, testSpeed, currentLeftTopPoint);
|
|
2401
|
+
var msg = new ExecuteCommandMessage(command, testSpeed);
|
|
2558
2402
|
return hammerhead.Promise.all([
|
|
2559
2403
|
sendMessageToDriver(msg, _this.driverWindow, _this.iframeAvailabilityTimeout, CurrentIframeIsNotLoadedError),
|
|
2560
2404
|
_this._waitForCommandResult(),
|
|
@@ -2809,9 +2653,9 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
2809
2653
|
}());
|
|
2810
2654
|
|
|
2811
2655
|
var Promise = hammerhead__default.Promise;
|
|
2812
|
-
var nativeMethods$
|
|
2656
|
+
var nativeMethods$2 = hammerhead__default.nativeMethods;
|
|
2813
2657
|
function delay (ms) {
|
|
2814
|
-
return new Promise(function (resolve) { return nativeMethods$
|
|
2658
|
+
return new Promise(function (resolve) { return nativeMethods$2.setTimeout.call(window, resolve, ms); });
|
|
2815
2659
|
}
|
|
2816
2660
|
|
|
2817
2661
|
function whilst(condition, iterator) {
|
|
@@ -2904,6 +2748,156 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
2904
2748
|
return ElementsRetriever;
|
|
2905
2749
|
}());
|
|
2906
2750
|
|
|
2751
|
+
var BoundaryValues = /** @class */ (function () {
|
|
2752
|
+
function BoundaryValues(top, right, bottom, left) {
|
|
2753
|
+
if (top === void 0) { top = 0; }
|
|
2754
|
+
if (right === void 0) { right = 0; }
|
|
2755
|
+
if (bottom === void 0) { bottom = 0; }
|
|
2756
|
+
if (left === void 0) { left = 0; }
|
|
2757
|
+
this.top = top;
|
|
2758
|
+
this.right = right;
|
|
2759
|
+
this.bottom = bottom;
|
|
2760
|
+
this.left = left;
|
|
2761
|
+
}
|
|
2762
|
+
BoundaryValues.create = function (v) {
|
|
2763
|
+
return new BoundaryValues(v.top, v.right, v.bottom, v.left);
|
|
2764
|
+
};
|
|
2765
|
+
BoundaryValues.prototype.add = function (d) {
|
|
2766
|
+
this.top += d.top;
|
|
2767
|
+
this.right += d.right;
|
|
2768
|
+
this.bottom += d.bottom;
|
|
2769
|
+
this.left += d.left;
|
|
2770
|
+
return this;
|
|
2771
|
+
};
|
|
2772
|
+
BoundaryValues.prototype.sub = function (d) {
|
|
2773
|
+
if ('top' in d) {
|
|
2774
|
+
this.top -= d.top;
|
|
2775
|
+
this.left -= d.left;
|
|
2776
|
+
}
|
|
2777
|
+
this.bottom -= d.bottom;
|
|
2778
|
+
this.right -= d.right;
|
|
2779
|
+
return this;
|
|
2780
|
+
};
|
|
2781
|
+
BoundaryValues.prototype.round = function (leftTopRound, rightBottomRound) {
|
|
2782
|
+
if (leftTopRound === void 0) { leftTopRound = Math.round; }
|
|
2783
|
+
if (rightBottomRound === void 0) { rightBottomRound = leftTopRound; }
|
|
2784
|
+
this.top = leftTopRound(this.top);
|
|
2785
|
+
this.right = rightBottomRound(this.right);
|
|
2786
|
+
this.bottom = rightBottomRound(this.bottom);
|
|
2787
|
+
this.left = leftTopRound(this.left);
|
|
2788
|
+
return this;
|
|
2789
|
+
};
|
|
2790
|
+
BoundaryValues.prototype.contains = function (point) {
|
|
2791
|
+
return point.x >= this.left && point.x <= this.right && point.y >= this.top && point.y <= this.bottom;
|
|
2792
|
+
};
|
|
2793
|
+
return BoundaryValues;
|
|
2794
|
+
}());
|
|
2795
|
+
|
|
2796
|
+
var ARRAY_METHODS_PREFIX = 'array';
|
|
2797
|
+
function createNativeMethodWrapper(methodName) {
|
|
2798
|
+
var nativeMethodName = ARRAY_METHODS_PREFIX + methodName.charAt(0).toUpperCase() + methodName.slice(1);
|
|
2799
|
+
var nativeMethod = hammerhead.nativeMethods[nativeMethodName];
|
|
2800
|
+
return function () {
|
|
2801
|
+
var args = [];
|
|
2802
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2803
|
+
args[_i] = arguments[_i];
|
|
2804
|
+
}
|
|
2805
|
+
return nativeMethod.call.apply(nativeMethod, args);
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
var filter = createNativeMethodWrapper('filter');
|
|
2809
|
+
var map = createNativeMethodWrapper('map');
|
|
2810
|
+
var slice = createNativeMethodWrapper('slice');
|
|
2811
|
+
var splice = createNativeMethodWrapper('splice');
|
|
2812
|
+
var unshift = createNativeMethodWrapper('unshift');
|
|
2813
|
+
var forEach = createNativeMethodWrapper('forEach');
|
|
2814
|
+
var indexOf = createNativeMethodWrapper('indexOf');
|
|
2815
|
+
var some = createNativeMethodWrapper('some');
|
|
2816
|
+
var reverse = createNativeMethodWrapper('reverse');
|
|
2817
|
+
var reduce = createNativeMethodWrapper('reduce');
|
|
2818
|
+
var concat = createNativeMethodWrapper('concat');
|
|
2819
|
+
var join = createNativeMethodWrapper('join');
|
|
2820
|
+
var every = createNativeMethodWrapper('every');
|
|
2821
|
+
|
|
2822
|
+
var browserUtils = hammerhead__default.utils.browser;
|
|
2823
|
+
var nativeMethods$3 = hammerhead__default.nativeMethods;
|
|
2824
|
+
// NOTE: We have to retrieve styleUtils.get from hammerhead
|
|
2825
|
+
// to avoid circular dependencies between domUtils and styleUtils
|
|
2826
|
+
var getElementStyleProperty = hammerhead__default.utils.style.get;
|
|
2827
|
+
var getActiveElement = hammerhead__default.utils.dom.getActiveElement;
|
|
2828
|
+
var findDocument = hammerhead__default.utils.dom.findDocument;
|
|
2829
|
+
var find = hammerhead__default.utils.dom.find;
|
|
2830
|
+
var isElementInDocument = hammerhead__default.utils.dom.isElementInDocument;
|
|
2831
|
+
var isElementInIframe = hammerhead__default.utils.dom.isElementInIframe;
|
|
2832
|
+
var getIframeByElement = hammerhead__default.utils.dom.getIframeByElement;
|
|
2833
|
+
var isCrossDomainWindows = hammerhead__default.utils.dom.isCrossDomainWindows;
|
|
2834
|
+
var getSelectParent = hammerhead__default.utils.dom.getSelectParent;
|
|
2835
|
+
var getChildVisibleIndex = hammerhead__default.utils.dom.getChildVisibleIndex;
|
|
2836
|
+
var getSelectVisibleChildren = hammerhead__default.utils.dom.getSelectVisibleChildren;
|
|
2837
|
+
var isElementNode = hammerhead__default.utils.dom.isElementNode;
|
|
2838
|
+
var isTextNode = hammerhead__default.utils.dom.isTextNode;
|
|
2839
|
+
var isRenderedNode = hammerhead__default.utils.dom.isRenderedNode;
|
|
2840
|
+
var isIframeElement = hammerhead__default.utils.dom.isIframeElement;
|
|
2841
|
+
var isInputElement = hammerhead__default.utils.dom.isInputElement;
|
|
2842
|
+
var isButtonElement = hammerhead__default.utils.dom.isButtonElement;
|
|
2843
|
+
var isFileInput = hammerhead__default.utils.dom.isFileInput;
|
|
2844
|
+
var isTextAreaElement = hammerhead__default.utils.dom.isTextAreaElement;
|
|
2845
|
+
var isAnchorElement = hammerhead__default.utils.dom.isAnchorElement;
|
|
2846
|
+
var isImgElement = hammerhead__default.utils.dom.isImgElement;
|
|
2847
|
+
var isFormElement = hammerhead__default.utils.dom.isFormElement;
|
|
2848
|
+
var isLabelElement = hammerhead__default.utils.dom.isLabelElement;
|
|
2849
|
+
var isSelectElement = hammerhead__default.utils.dom.isSelectElement;
|
|
2850
|
+
var isRadioButtonElement = hammerhead__default.utils.dom.isRadioButtonElement;
|
|
2851
|
+
var isColorInputElement = hammerhead__default.utils.dom.isColorInputElement;
|
|
2852
|
+
var isCheckboxElement = hammerhead__default.utils.dom.isCheckboxElement;
|
|
2853
|
+
var isOptionElement = hammerhead__default.utils.dom.isOptionElement;
|
|
2854
|
+
var isSVGElement = hammerhead__default.utils.dom.isSVGElement;
|
|
2855
|
+
var isMapElement = hammerhead__default.utils.dom.isMapElement;
|
|
2856
|
+
var isBodyElement = hammerhead__default.utils.dom.isBodyElement;
|
|
2857
|
+
var isHtmlElement = hammerhead__default.utils.dom.isHtmlElement;
|
|
2858
|
+
var isDocument = hammerhead__default.utils.dom.isDocument;
|
|
2859
|
+
var isWindow = hammerhead__default.utils.dom.isWindow;
|
|
2860
|
+
var isTextEditableInput = hammerhead__default.utils.dom.isTextEditableInput;
|
|
2861
|
+
var isTextEditableElement = hammerhead__default.utils.dom.isTextEditableElement;
|
|
2862
|
+
var isTextEditableElementAndEditingAllowed = hammerhead__default.utils.dom.isTextEditableElementAndEditingAllowed;
|
|
2863
|
+
var isContentEditableElement = hammerhead__default.utils.dom.isContentEditableElement;
|
|
2864
|
+
var isDomElement = hammerhead__default.utils.dom.isDomElement;
|
|
2865
|
+
var isShadowUIElement = hammerhead__default.utils.dom.isShadowUIElement;
|
|
2866
|
+
var isShadowRoot = hammerhead__default.utils.dom.isShadowRoot;
|
|
2867
|
+
var isElementFocusable = hammerhead__default.utils.dom.isElementFocusable;
|
|
2868
|
+
var isHammerheadAttr = hammerhead__default.utils.dom.isHammerheadAttr;
|
|
2869
|
+
var isElementReadOnly = hammerhead__default.utils.dom.isElementReadOnly;
|
|
2870
|
+
var getScrollbarSize = hammerhead__default.utils.dom.getScrollbarSize;
|
|
2871
|
+
var getMapContainer = hammerhead__default.utils.dom.getMapContainer;
|
|
2872
|
+
var getTagName = hammerhead__default.utils.dom.getTagName;
|
|
2873
|
+
var closest = hammerhead__default.utils.dom.closest;
|
|
2874
|
+
var getParents = hammerhead__default.utils.dom.getParents;
|
|
2875
|
+
var findParent = hammerhead__default.utils.dom.findParent;
|
|
2876
|
+
var getTopSameDomainWindow = hammerhead__default.utils.dom.getTopSameDomainWindow;
|
|
2877
|
+
var getParentExceptShadowRoot = hammerhead__default.utils.dom.getParentExceptShadowRoot;
|
|
2878
|
+
|
|
2879
|
+
var styleUtils = hammerhead__default.utils.style;
|
|
2880
|
+
var getBordersWidth = hammerhead__default.utils.style.getBordersWidth;
|
|
2881
|
+
var getComputedStyle = hammerhead__default.utils.style.getComputedStyle;
|
|
2882
|
+
var getElementMargin = hammerhead__default.utils.style.getElementMargin;
|
|
2883
|
+
var getElementPadding = hammerhead__default.utils.style.getElementPadding;
|
|
2884
|
+
var getElementScroll = hammerhead__default.utils.style.getElementScroll;
|
|
2885
|
+
var getOptionHeight = hammerhead__default.utils.style.getOptionHeight;
|
|
2886
|
+
var getSelectElementSize = hammerhead__default.utils.style.getSelectElementSize;
|
|
2887
|
+
var isElementVisible = hammerhead__default.utils.style.isElementVisible;
|
|
2888
|
+
var isSelectVisibleChild = hammerhead__default.utils.style.isVisibleChild;
|
|
2889
|
+
var getWidth = hammerhead__default.utils.style.getWidth;
|
|
2890
|
+
var getHeight = hammerhead__default.utils.style.getHeight;
|
|
2891
|
+
var getInnerWidth = hammerhead__default.utils.style.getInnerWidth;
|
|
2892
|
+
var getInnerHeight = hammerhead__default.utils.style.getInnerHeight;
|
|
2893
|
+
var getScrollLeft = hammerhead__default.utils.style.getScrollLeft;
|
|
2894
|
+
var getScrollTop = hammerhead__default.utils.style.getScrollTop;
|
|
2895
|
+
var setScrollLeft = hammerhead__default.utils.style.setScrollLeft;
|
|
2896
|
+
var setScrollTop = hammerhead__default.utils.style.setScrollTop;
|
|
2897
|
+
var get = hammerhead__default.utils.style.get;
|
|
2898
|
+
var getBordersWidthFloat = hammerhead__default.utils.style.getBordersWidthFloat;
|
|
2899
|
+
var getElementPaddingFloat = hammerhead__default.utils.style.getElementPaddingFloat;
|
|
2900
|
+
|
|
2907
2901
|
var shadowUI = hammerhead__default.shadowUI;
|
|
2908
2902
|
var nativeMethods$4 = hammerhead__default.nativeMethods;
|
|
2909
2903
|
|
|
@@ -3130,7 +3124,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
3130
3124
|
var handler = ActionExecutor.ACTIONS_HANDLERS[this._command.type];
|
|
3131
3125
|
if (!handler)
|
|
3132
3126
|
throw new Error("There is no handler for the \"".concat(this._command.type, "\" command."));
|
|
3133
|
-
return handler.create(this._command, this._elements, this._options.
|
|
3127
|
+
return handler.create(this._command, this._elements, this._options.dispatchNativeAutomationEventFn);
|
|
3134
3128
|
};
|
|
3135
3129
|
ActionExecutor.prototype._runAction = function (strictElementCheck) {
|
|
3136
3130
|
var _this = this;
|
|
@@ -4478,7 +4472,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4478
4472
|
},
|
|
4479
4473
|
};
|
|
4480
4474
|
ActionExecutor.ACTIONS_HANDLERS[COMMAND_TYPE.pressKey] = {
|
|
4481
|
-
create: function (command) { return new testcafeAutomation.Press(testcafeCore.parseKeySequence(command.keys).combinations, command.options); },
|
|
4475
|
+
create: function (command, _a, dispatchNativeAutomationEventFn) { return new testcafeAutomation.Press(testcafeCore.parseKeySequence(command.keys).combinations, command.options, dispatchNativeAutomationEventFn); },
|
|
4482
4476
|
ensureCmdArgs: function (command) {
|
|
4483
4477
|
var parsedKeySequence = testcafeCore.parseKeySequence(command.keys);
|
|
4484
4478
|
if (parsedKeySequence.error)
|
|
@@ -4486,11 +4480,10 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4486
4480
|
},
|
|
4487
4481
|
};
|
|
4488
4482
|
ActionExecutor.ACTIONS_HANDLERS[COMMAND_TYPE.click] = {
|
|
4489
|
-
create: function (command, elements,
|
|
4483
|
+
create: function (command, elements, dispatchNativeAutomationEventFn) {
|
|
4490
4484
|
if (/option|optgroup/.test(testcafeCore.domUtils.getTagName(elements[0])))
|
|
4491
4485
|
return new testcafeAutomation.SelectChildClick(elements[0], command.options);
|
|
4492
|
-
testcafeAutomation.
|
|
4493
|
-
return new testcafeAutomation.Click(elements[0], command.options, window, testcafeAutomation.cursor, dispatchProxylessEventFn, leftTopPoint);
|
|
4486
|
+
return new testcafeAutomation.Click(elements[0], command.options, window, testcafeAutomation.cursor, dispatchNativeAutomationEventFn);
|
|
4494
4487
|
},
|
|
4495
4488
|
};
|
|
4496
4489
|
ActionExecutor.ACTIONS_HANDLERS[COMMAND_TYPE.rightClick] = {
|
|
@@ -4500,7 +4493,9 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4500
4493
|
create: function (command, elements) { return new testcafeAutomation.DblClick(elements[0], command.options); },
|
|
4501
4494
|
};
|
|
4502
4495
|
ActionExecutor.ACTIONS_HANDLERS[COMMAND_TYPE.hover] = {
|
|
4503
|
-
create: function (command, elements
|
|
4496
|
+
create: function (command, elements, dispatchNativeAutomationEventFn) {
|
|
4497
|
+
return new testcafeAutomation.Hover(elements[0], command.options, dispatchNativeAutomationEventFn);
|
|
4498
|
+
},
|
|
4504
4499
|
};
|
|
4505
4500
|
ActionExecutor.ACTIONS_HANDLERS[COMMAND_TYPE.drag] = {
|
|
4506
4501
|
create: function (command, elements) {
|
|
@@ -4530,7 +4525,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4530
4525
|
};
|
|
4531
4526
|
ActionExecutor.ACTIONS_HANDLERS[COMMAND_TYPE.typeText] = {
|
|
4532
4527
|
// eslint-disable-next-line no-restricted-properties
|
|
4533
|
-
create: function (command, elements) { return new testcafeAutomation.Type(elements[0], command.text, command.options); },
|
|
4528
|
+
create: function (command, elements, dispatchNativeAutomationEventFn) { return new testcafeAutomation.Type(elements[0], command.text, command.options, dispatchNativeAutomationEventFn); },
|
|
4534
4529
|
};
|
|
4535
4530
|
function createSelectTextAutomation(command, elements) {
|
|
4536
4531
|
var selectArgs = testcafeAutomation.calculateSelectTextArguments(elements[0], command);
|
|
@@ -4605,6 +4600,12 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4605
4600
|
return executor.getResult();
|
|
4606
4601
|
}
|
|
4607
4602
|
|
|
4603
|
+
var FILE_PROTOCOL = 'file://';
|
|
4604
|
+
function isFileProtocol(url) {
|
|
4605
|
+
if (url === void 0) { url = ''; }
|
|
4606
|
+
return url.indexOf(FILE_PROTOCOL) === 0;
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4608
4609
|
var settings = hammerhead__default.settings;
|
|
4609
4610
|
var transport = hammerhead__default.transport;
|
|
4610
4611
|
var Promise$2 = hammerhead__default.Promise;
|
|
@@ -4665,6 +4666,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4665
4666
|
_this.childWindowDriverLinks = [];
|
|
4666
4667
|
_this.parentWindowDriverLink = null;
|
|
4667
4668
|
_this.statusBar = null;
|
|
4669
|
+
_this.selectorInspectorPanel = null;
|
|
4668
4670
|
_this.windowId = _this._getCurrentWindowId();
|
|
4669
4671
|
_this.role = DriverRole.replica;
|
|
4670
4672
|
_this.setAsMasterInProgress = false;
|
|
@@ -4674,12 +4676,13 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4674
4676
|
_this.readyPromise = _this._getReadyPromise();
|
|
4675
4677
|
_this._initChildDriverListening();
|
|
4676
4678
|
testcafeCore.pageUnloadBarrier.init();
|
|
4677
|
-
if (!_this.options.
|
|
4679
|
+
if (!_this.options.nativeAutomation)
|
|
4678
4680
|
testcafeCore.preventRealEvents();
|
|
4679
4681
|
hammerhead__default.on(hammerhead__default.EVENTS.uncaughtJsError, function (err) { return _this._onJsError(err); });
|
|
4680
4682
|
hammerhead__default.on(hammerhead__default.EVENTS.unhandledRejection, function (err) { return _this._onJsError(err); });
|
|
4681
4683
|
hammerhead__default.on(hammerhead__default.EVENTS.consoleMethCalled, function (e) { return _this._onConsoleMessage(e); });
|
|
4682
4684
|
hammerhead__default.on(hammerhead__default.EVENTS.beforeFormSubmit, function (e) { return _this._onFormSubmit(e); });
|
|
4685
|
+
hammerhead__default.on(hammerhead__default.EVENTS.beforeWindowOpened, function (e) { return _this._onBeforeChildWindowOpened(e); });
|
|
4683
4686
|
hammerhead__default.on(hammerhead__default.EVENTS.windowOpened, function (e) { return _this._onChildWindowOpened(e); });
|
|
4684
4687
|
_this.setCustomCommandHandlers(COMMAND_TYPE.unlockPage, function () { return _this._unlockPageAfterTestIsDone(); });
|
|
4685
4688
|
_this.setCustomCommandHandlers(COMMAND_TYPE.getActiveElement, function () { return _this._getActiveElement(); });
|
|
@@ -4709,7 +4712,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4709
4712
|
return new ClientBrowserConsoleMessages(this.contextStorage.getItem(CONSOLE_MESSAGES));
|
|
4710
4713
|
},
|
|
4711
4714
|
set: function (messages) {
|
|
4712
|
-
|
|
4715
|
+
this.contextStorage.setItem(CONSOLE_MESSAGES, messages ? messages.getCopy() : null);
|
|
4713
4716
|
},
|
|
4714
4717
|
enumerable: false,
|
|
4715
4718
|
configurable: true
|
|
@@ -4734,7 +4737,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4734
4737
|
contextStorage.getItem(this.EXECUTING_IN_IFRAME_FLAG);
|
|
4735
4738
|
};
|
|
4736
4739
|
Driver.prototype._getCurrentWindowId = function () {
|
|
4737
|
-
if (this.options.
|
|
4740
|
+
if (this.options.nativeAutomation)
|
|
4738
4741
|
return this.runInfo.activeWindowId;
|
|
4739
4742
|
var currentUrl = window.location.toString();
|
|
4740
4743
|
var parsedProxyUrl = hammerhead__default.utils.url.parseProxyUrl(currentUrl);
|
|
@@ -4784,7 +4787,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4784
4787
|
this.contextStorage.setItem(PENDING_PAGE_ERROR, error);
|
|
4785
4788
|
};
|
|
4786
4789
|
Driver.prototype._unlockPageAfterTestIsDone = function () {
|
|
4787
|
-
if (!this.options.
|
|
4790
|
+
if (!this.options.nativeAutomation)
|
|
4788
4791
|
testcafeCore.disableRealEventsPreventing();
|
|
4789
4792
|
return Promise$2.resolve();
|
|
4790
4793
|
};
|
|
@@ -4867,6 +4870,15 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4867
4870
|
}));
|
|
4868
4871
|
});
|
|
4869
4872
|
};
|
|
4873
|
+
Driver.prototype._onBeforeChildWindowOpened = function (e) {
|
|
4874
|
+
if (!this.options.nativeAutomation)
|
|
4875
|
+
return;
|
|
4876
|
+
this._onReady(new DriverStatus({
|
|
4877
|
+
isCommandResult: true,
|
|
4878
|
+
executionError: new MultipleWindowsModeIsNotSupportedInNativeAutomationModeError(),
|
|
4879
|
+
}));
|
|
4880
|
+
e.isPrevented = true;
|
|
4881
|
+
};
|
|
4870
4882
|
Driver.prototype._onChildWindowOpened = function (e) {
|
|
4871
4883
|
this._addChildWindowDriverLink(e);
|
|
4872
4884
|
this._switchToChildWindow(e.windowId);
|
|
@@ -4964,7 +4976,10 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
4964
4976
|
var childIframeDriverLink = this._getChildIframeDriverLinkByWindow(driverWindow);
|
|
4965
4977
|
if (!childIframeDriverLink) {
|
|
4966
4978
|
var driverId = "".concat(this.testRunId, "-").concat(generateId());
|
|
4967
|
-
childIframeDriverLink = new ChildIframeDriverLink(driverWindow, driverId,
|
|
4979
|
+
childIframeDriverLink = new ChildIframeDriverLink(driverWindow, driverId, {
|
|
4980
|
+
single: this.communicationUrls.dispatchNativeAutomationEvent,
|
|
4981
|
+
sequence: this.communicationUrls.dispatchNativeAutomationEventSequence,
|
|
4982
|
+
});
|
|
4968
4983
|
this.childIframeDriverLinks.push(childIframeDriverLink);
|
|
4969
4984
|
}
|
|
4970
4985
|
childIframeDriverLink.sendConfirmationMessage(id);
|
|
@@ -5360,7 +5375,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
5360
5375
|
runningChain
|
|
5361
5376
|
.then(function () {
|
|
5362
5377
|
_this.contextStorage.setItem(_this.EXECUTING_IN_IFRAME_FLAG, true);
|
|
5363
|
-
return _this.activeChildIframeDriverLink.executeCommand(command, _this.speed, _this.options.
|
|
5378
|
+
return _this.activeChildIframeDriverLink.executeCommand(command, _this.speed, _this.options.nativeAutomation);
|
|
5364
5379
|
})
|
|
5365
5380
|
.then(function (status) { return _this._onCommandExecutedInIframe(status); })
|
|
5366
5381
|
.catch(function (err) { return _this._onCommandExecutedInIframe(new DriverStatus({
|
|
@@ -5541,6 +5556,15 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
5541
5556
|
for (var i = 0; i < this.childIframeDriverLinks.length; i++)
|
|
5542
5557
|
messageSandbox$2.sendServiceMsg(msg, this.childIframeDriverLinks[i].driverWindow);
|
|
5543
5558
|
};
|
|
5559
|
+
Driver.prototype.createDispatchNativeAutomationEventFunctions = function () {
|
|
5560
|
+
return this.options.nativeAutomation ? {
|
|
5561
|
+
single: this._createDispatchNativeAutomationEventFn('dispatchNativeAutomationEvent'),
|
|
5562
|
+
sequence: this._createDispatchNativeAutomationEventFn('dispatchNativeAutomationEventSequence'),
|
|
5563
|
+
} : null;
|
|
5564
|
+
};
|
|
5565
|
+
Driver.prototype._createDispatchNativeAutomationEventFn = function (name) {
|
|
5566
|
+
return nativeMethods$6.functionBind.call(testcafeCore.browser[name], testcafeCore.browser[name], this.communicationUrls[name], testCafeUI__default, hammerhead__default.createNativeXHR);
|
|
5567
|
+
};
|
|
5544
5568
|
// Commands handling
|
|
5545
5569
|
Driver.prototype._onActionCommand = function (command) {
|
|
5546
5570
|
var _this = this;
|
|
@@ -5550,13 +5574,11 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
5550
5574
|
var selectorExecutor = new SelectorExecutor(selector, _this.options.selectorTimeout, startTime, createNotFoundError, createIsInvisibleError);
|
|
5551
5575
|
return selectorExecutor.getResult();
|
|
5552
5576
|
};
|
|
5553
|
-
var dispatchProxylessEventFn = this.options.proxyless ? nativeMethods$6.functionBind.call(testcafeCore.browser.dispatchProxylessEvent, testcafeCore.browser.dispatchProxylessEvent, this.communicationUrls.dispatchProxylessEvent, testCafeUI__default, hammerhead__default.createNativeXHR) : null;
|
|
5554
5577
|
var executor = new ActionExecutor(command, {
|
|
5555
5578
|
globalSelectorTimeout: this.options.selectorTimeout,
|
|
5556
5579
|
testSpeed: this.speed,
|
|
5557
5580
|
executeSelectorFn: executeSelectorCb,
|
|
5558
|
-
|
|
5559
|
-
dispatchProxylessEventFn: dispatchProxylessEventFn,
|
|
5581
|
+
dispatchNativeAutomationEventFn: this.createDispatchNativeAutomationEventFunctions(),
|
|
5560
5582
|
});
|
|
5561
5583
|
var warnings = [];
|
|
5562
5584
|
executor.on(ActionExecutor.EXECUTION_STARTED_EVENT, function () {
|
|
@@ -5604,11 +5626,15 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
5604
5626
|
Driver.prototype._onNavigateToCommand = function (command) {
|
|
5605
5627
|
var _this = this;
|
|
5606
5628
|
this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG, true);
|
|
5607
|
-
|
|
5608
|
-
.
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5629
|
+
if (this.options.nativeAutomation && isFileProtocol(command.url))
|
|
5630
|
+
testcafeCore.browser.redirectUsingCdp(command, hammerhead__default.createNativeXHR, this.communicationUrls.openFileProtocolUrl);
|
|
5631
|
+
else {
|
|
5632
|
+
executeNavigateTo(command)
|
|
5633
|
+
.then(function (driverStatus) {
|
|
5634
|
+
_this.contextStorage.setItem(_this.COMMAND_EXECUTING_FLAG, false);
|
|
5635
|
+
return _this._onReady(driverStatus);
|
|
5636
|
+
});
|
|
5637
|
+
}
|
|
5612
5638
|
};
|
|
5613
5639
|
Driver.prototype._onGetProxyUrlCommand = function (command) {
|
|
5614
5640
|
this._onReady(new DriverStatus({
|
|
@@ -5828,6 +5854,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
5828
5854
|
var _this = this;
|
|
5829
5855
|
var isTestError = _a.isTestError, inCompilerService = _a.inCompilerService;
|
|
5830
5856
|
var showDebuggingStatusPromise = this.statusBar.showDebuggingStatus(isTestError);
|
|
5857
|
+
this.selectorInspectorPanel.show();
|
|
5831
5858
|
if (inCompilerService) {
|
|
5832
5859
|
showDebuggingStatusPromise.then(function (debug) {
|
|
5833
5860
|
_this.debug = debug;
|
|
@@ -5876,7 +5903,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
5876
5903
|
statusUrl: this.communicationUrls.statusDone,
|
|
5877
5904
|
};
|
|
5878
5905
|
return testcafeCore.browser
|
|
5879
|
-
.checkStatus(urls, hammerhead__default.createNativeXHR, { manualRedirect: true,
|
|
5906
|
+
.checkStatus(urls, hammerhead__default.createNativeXHR, { manualRedirect: true, nativeAutomation: this.options.nativeAutomation })
|
|
5880
5907
|
.then(function (_a) {
|
|
5881
5908
|
var command = _a.command;
|
|
5882
5909
|
var isSessionChange = command.testRunId !== _this.testRunId;
|
|
@@ -6003,6 +6030,8 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
6003
6030
|
};
|
|
6004
6031
|
Driver.prototype._executeCommand = function (command) {
|
|
6005
6032
|
this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG, false);
|
|
6033
|
+
if (this.selectorInspectorPanel)
|
|
6034
|
+
this.selectorInspectorPanel.hide();
|
|
6006
6035
|
if (this.customCommandHandlers[command.type])
|
|
6007
6036
|
this._onCustomCommand(command);
|
|
6008
6037
|
else if (command.type === COMMAND_TYPE.testDone)
|
|
@@ -6190,17 +6219,18 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
6190
6219
|
});
|
|
6191
6220
|
};
|
|
6192
6221
|
Driver.prototype._init = function () {
|
|
6193
|
-
var _a = this.options,
|
|
6222
|
+
var _a = this.options, nativeAutomation = _a.nativeAutomation, dialogHandler = _a.dialogHandler, speed = _a.speed;
|
|
6194
6223
|
this.contextStorage = new Storage(window, {
|
|
6195
6224
|
testRunId: this.testRunId,
|
|
6196
6225
|
windowId: this.windowId,
|
|
6197
|
-
|
|
6226
|
+
nativeAutomation: nativeAutomation,
|
|
6198
6227
|
});
|
|
6199
|
-
this.nativeDialogsTracker = new NativeDialogTracker(this.contextStorage, {
|
|
6228
|
+
this.nativeDialogsTracker = new NativeDialogTracker(this.contextStorage, { nativeAutomation: nativeAutomation, dialogHandler: dialogHandler });
|
|
6200
6229
|
this.statusBar = new testCafeUI__default.StatusBar(this.runInfo.userAgent, this.runInfo.fixtureName, this.runInfo.testName, this.contextStorage);
|
|
6230
|
+
this.selectorInspectorPanel = new testCafeUI__default.SelectorInspectorPanel(this.statusBar);
|
|
6201
6231
|
var self = this;
|
|
6202
6232
|
this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK, function () {
|
|
6203
|
-
if (!self.options.
|
|
6233
|
+
if (!self.options.nativeAutomation)
|
|
6204
6234
|
testcafeCore.disableRealEventsPreventing();
|
|
6205
6235
|
});
|
|
6206
6236
|
this.speed = speed;
|
|
@@ -6323,7 +6353,6 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
6323
6353
|
_this.lastParentDriverMessageId = null;
|
|
6324
6354
|
_this.parentDriverLink = new ParentIframeDriverLink(window.parent);
|
|
6325
6355
|
_this._initParentDriverListening();
|
|
6326
|
-
_this.leftTopPoint = new AxisValues(0, 0);
|
|
6327
6356
|
return _this;
|
|
6328
6357
|
}
|
|
6329
6358
|
// Errors handling
|
|
@@ -6358,7 +6387,6 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
6358
6387
|
_this.lastParentDriverMessageId = msg.id;
|
|
6359
6388
|
_this.readyPromise.then(function () {
|
|
6360
6389
|
_this.speed = msg.testSpeed;
|
|
6361
|
-
_this.leftTopPoint = msg.leftTopPoint;
|
|
6362
6390
|
_this.parentDriverLink.sendConfirmationMessage(msg.id);
|
|
6363
6391
|
_this._onCommand(msg.command);
|
|
6364
6392
|
});
|
|
@@ -6393,18 +6421,19 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
6393
6421
|
};
|
|
6394
6422
|
IframeDriver.prototype._init = function () {
|
|
6395
6423
|
return __awaiter(this, void 0, void 0, function () {
|
|
6396
|
-
var _a, id,
|
|
6424
|
+
var _a, id, dispatchNativeAutomationEventUrls, inCommandExecution;
|
|
6397
6425
|
return __generator(this, function (_b) {
|
|
6398
6426
|
switch (_b.label) {
|
|
6399
6427
|
case 0: return [4 /*yield*/, this.parentDriverLink.establishConnection()];
|
|
6400
6428
|
case 1:
|
|
6401
|
-
_a = _b.sent(), id = _a.id,
|
|
6429
|
+
_a = _b.sent(), id = _a.id, dispatchNativeAutomationEventUrls = _a.dispatchNativeAutomationEventUrls;
|
|
6402
6430
|
this.contextStorage = new Storage(window, {
|
|
6403
6431
|
testRunId: id,
|
|
6404
6432
|
windowId: this.windowId,
|
|
6405
|
-
|
|
6433
|
+
nativeAutomation: this.options.nativeAutomation,
|
|
6406
6434
|
});
|
|
6407
|
-
this.communicationUrls.
|
|
6435
|
+
this.communicationUrls.dispatchNativeAutomationEvent = dispatchNativeAutomationEventUrls.single;
|
|
6436
|
+
this.communicationUrls.dispatchNativeAutomationEventSequence = dispatchNativeAutomationEventUrls.sequence;
|
|
6408
6437
|
if (this._failIfClientCodeExecutionIsInterrupted())
|
|
6409
6438
|
return [2 /*return*/];
|
|
6410
6439
|
return [4 /*yield*/, this._isInCommandExecution()];
|
|
@@ -6424,7 +6453,7 @@ window['%hammerhead%'].utils.removeInjectedScript();
|
|
|
6424
6453
|
IframeDriver.prototype.start = function () {
|
|
6425
6454
|
this.nativeDialogsTracker = new IframeNativeDialogTracker({
|
|
6426
6455
|
dialogHandler: this.options.dialogHandler,
|
|
6427
|
-
|
|
6456
|
+
nativeAutomation: this.options.nativeAutomation,
|
|
6428
6457
|
});
|
|
6429
6458
|
this.statusBar = new testCafeUI.IframeStatusBar();
|
|
6430
6459
|
var initializePromise = this._init();
|