testcafe
Version:
Automated browser testing for the modern web development stack.
970 lines (955 loc) • 332 kB
JavaScript
window['%hammerhead%'].utils.removeInjectedScript();
// NOTE: We should have the capability to initialize scripts with different contexts.
// This is required for iframes without the src attribute because Hammerhead does not
// inject scripts into such iframes. So, we wrap all scripts in initialization functions.
(function () {
function initTestCafeClientDrivers(window, isIFrameWithoutSrc) {
var document = window.document;
(function (hammerhead, Promise$4, testcafeCore, testcafeAutomation, testCafeUI) {
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var hammerhead__default = /*#__PURE__*/_interopDefaultLegacy(hammerhead);
var Promise__default = /*#__PURE__*/_interopDefaultLegacy(Promise$4);
var testCafeUI__default = /*#__PURE__*/_interopDefaultLegacy(testCafeUI);
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise__default["default"]))(function (resolve, reject) {
function fulfilled(value) { try {
step(generator.next(value));
}
catch (e) {
reject(e);
} }
function rejected(value) { try {
step(generator["throw"](value));
}
catch (e) {
reject(e);
} }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1)
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f)
throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _)
try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
return t;
if (y = 0, t)
op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2])
_.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
}
catch (e) {
op = [6, e];
y = 0;
}
finally {
f = t = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2)
for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
// -------------------------------------------------------------
// WARNING: this file is used by both the client and the server.
// Do not use any browser or node-specific API!
// -------------------------------------------------------------
var HEARTBEAT_TIMEOUT = 2 * 60 * 1000;
var CHECK_IFRAME_DRIVER_LINK_DELAY = 500;
var CHECK_CHILD_WINDOW_DRIVER_LINK_DELAY = 500;
var SEND_STATUS_REQUEST_TIME_LIMIT = 5000;
var SEND_STATUS_REQUEST_RETRY_DELAY = 300;
var SEND_STATUS_REQUEST_RETRY_COUNT = Math.floor(HEARTBEAT_TIMEOUT / SEND_STATUS_REQUEST_RETRY_DELAY - 1);
var CHECK_STATUS_RETRY_DELAY = 1000;
var ClientMessages;
(function (ClientMessages) {
ClientMessages["ready"] = "ready";
ClientMessages["readyForBrowserManipulation"] = "ready-for-browser-manipulation";
ClientMessages["waitForFileDownload"] = "wait-for-file-download";
})(ClientMessages || (ClientMessages = {}));
var TEST_RUN_MESSAGES = ClientMessages;
// -------------------------------------------------------------
// WARNING: this file is used by both the client and the server.
// Do not use any browser or node-specific API!
// -------------------------------------------------------------
var COMMAND_TYPE = {
dispatchEvent: 'dispatch-event',
click: 'click',
rightClick: 'right-click',
doubleClick: 'double-click',
drag: 'drag',
dragToElement: 'drag-to-element',
hover: 'hover',
scroll: 'scroll',
scrollBy: 'scroll-by',
scrollIntoView: 'scroll-into-view',
typeText: 'type-text',
selectText: 'select-text',
selectTextAreaContent: 'select-text-area-content',
selectEditableContent: 'select-editable-content',
pressKey: 'press-key',
wait: 'wait',
navigateTo: 'navigate-to',
setFilesToUpload: 'set-files-to-upload',
clearUpload: 'clear-upload',
executeClientFunction: 'execute-client-function',
executeSelector: 'execute-selector',
takeScreenshot: 'take-screenshot',
takeElementScreenshot: 'take-element-screenshot',
takeScreenshotOnFail: 'take-screenshot-on-fail',
prepareBrowserManipulation: 'prepare-browser-manipulation',
showAssertionRetriesStatus: 'show-assertion-retries-status',
hideAssertionRetriesStatus: 'hide-assertion-retries-status',
setBreakpoint: 'set-breakpoint',
resizeWindow: 'resize-window',
resizeWindowToFitDevice: 'resize-window-to-fit-device',
maximizeWindow: 'maximize-window',
switchToIframe: 'switch-to-iframe',
switchToMainWindow: 'switch-to-main-window',
openWindow: 'open-window',
closeWindow: 'close-window',
getCurrentWindow: 'get-current-window',
getCurrentWindows: 'get-current-windows',
getCurrentCDPSession: 'get-current-c-d-p-session',
switchToWindow: 'switch-to-window',
switchToWindowByPredicate: 'switch-to-window-by-predicate',
switchToParentWindow: 'switch-to-parent-window',
switchToPreviousWindow: 'switch-to-previous-window',
setNativeDialogHandler: 'set-native-dialog-handler',
getNativeDialogHistory: 'get-native-dialog-history',
getBrowserConsoleMessages: 'get-browser-console-messages',
getActiveElement: 'get-active-element',
setTestSpeed: 'set-test-speed',
setPageLoadTimeout: 'set-page-load-timeout',
debug: 'debug',
assertion: 'assertion',
useRole: 'useRole',
testDone: 'test-done',
backupStorages: 'backup-storages',
executeExpression: 'execute-expression',
executeAsyncExpression: 'execute-async-expression',
unlockPage: 'unlock-page',
closeChildWindowOnFileDownloading: 'close-child-window-on-file-downloading',
recorder: 'recorder',
prepareClientEnvironmentInDebugMode: 'prepare-client-environment-in-debug-mode',
getCookies: 'get-cookies',
setCookies: 'set-cookies',
deleteCookies: 'delete-cookies',
getProxyUrl: 'get-proxy-url',
request: 'request',
skipJsErrors: 'skip-js-errors',
addRequestHooks: 'add-request-hooks',
removeRequestHooks: 'remove-request-hooks',
runCustomAction: 'run-custom-action',
report: 'report',
};
// -------------------------------------------------------------
function isCommandRejectableByPageError(command) {
return !isObservationCommand(command) && !isBrowserManipulationCommand(command) && !isServiceCommand(command) ||
isResizeWindowCommand(command)
&& !isWindowSwitchingCommand(command);
}
function isClientFunctionCommand(command) {
return command.type === COMMAND_TYPE.executeClientFunction ||
command.type === COMMAND_TYPE.executeSelector;
}
function isObservationCommand(command) {
return isClientFunctionCommand(command) ||
command.type === COMMAND_TYPE.wait ||
command.type === COMMAND_TYPE.assertion ||
command.type === COMMAND_TYPE.executeExpression;
}
function isWindowSwitchingCommand(command) {
return command.type === COMMAND_TYPE.switchToIframe || command.type === COMMAND_TYPE.switchToMainWindow;
}
function isScreenshotCommand(command) {
return command.type === COMMAND_TYPE.takeScreenshot ||
command.type === COMMAND_TYPE.takeElementScreenshot ||
command.type === COMMAND_TYPE.takeScreenshotOnFail;
}
function isResizeWindowCommand(command) {
return command.type === COMMAND_TYPE.resizeWindow ||
command.type === COMMAND_TYPE.resizeWindowToFitDevice ||
command.type === COMMAND_TYPE.maximizeWindow;
}
function isBrowserManipulationCommand(command) {
return isScreenshotCommand(command) || isResizeWindowCommand(command);
}
function isServiceCommand(command) {
return command.type === COMMAND_TYPE.testDone ||
command.type === COMMAND_TYPE.showAssertionRetriesStatus ||
command.type === COMMAND_TYPE.hideAssertionRetriesStatus ||
command.type === COMMAND_TYPE.setBreakpoint ||
command.type === COMMAND_TYPE.takeScreenshotOnFail ||
command.type === COMMAND_TYPE.recorder ||
command.type === COMMAND_TYPE.getProxyUrl;
}
function isExecutableInTopWindowOnly(command) {
return command.type === COMMAND_TYPE.testDone ||
command.type === COMMAND_TYPE.switchToMainWindow ||
command.type === COMMAND_TYPE.setNativeDialogHandler ||
command.type === COMMAND_TYPE.getNativeDialogHistory ||
command.type === COMMAND_TYPE.setTestSpeed ||
command.type === COMMAND_TYPE.showAssertionRetriesStatus ||
command.type === COMMAND_TYPE.hideAssertionRetriesStatus ||
command.type === COMMAND_TYPE.setBreakpoint ||
isBrowserManipulationCommand(command) && command.type !== COMMAND_TYPE.takeElementScreenshot;
}
var STATUS_BAR_DEBUG_ACTION = {
step: 'step',
resume: 'resume',
};
// -------------------------------------------------------------
// WARNING: this file is used by both the client and the server.
// Do not use any browser or node-specific API!
// -------------------------------------------------------------
var TEST_RUN_ERRORS = {
uncaughtErrorOnPage: 'E1',
uncaughtErrorInTestCode: 'E2',
uncaughtNonErrorObjectInTestCode: 'E3',
uncaughtErrorInClientFunctionCode: 'E4',
uncaughtErrorInCustomDOMPropertyCode: 'E5',
unhandledPromiseRejection: 'E6',
uncaughtException: 'E7',
missingAwaitError: 'E8',
actionIntegerOptionError: 'E9',
actionPositiveIntegerOptionError: 'E10',
actionBooleanOptionError: 'E11',
actionSpeedOptionError: 'E12',
actionOptionsTypeError: 'E14',
actionBooleanArgumentError: 'E15',
actionStringArgumentError: 'E16',
actionNullableStringArgumentError: 'E17',
actionStringOrStringArrayArgumentError: 'E18',
actionStringArrayElementError: 'E19',
actionIntegerArgumentError: 'E20',
actionRoleArgumentError: 'E21',
actionPositiveIntegerArgumentError: 'E22',
actionSelectorError: 'E23',
actionElementNotFoundError: 'E24',
actionElementIsInvisibleError: 'E26',
actionSelectorMatchesWrongNodeTypeError: 'E27',
actionAdditionalElementNotFoundError: 'E28',
actionAdditionalElementIsInvisibleError: 'E29',
actionAdditionalSelectorMatchesWrongNodeTypeError: 'E30',
actionElementNonEditableError: 'E31',
actionElementNotTextAreaError: 'E32',
actionElementNonContentEditableError: 'E33',
actionElementIsNotFileInputError: 'E34',
actionRootContainerNotFoundError: 'E35',
actionIncorrectKeysError: 'E36',
actionCannotFindFileToUploadError: 'E37',
actionUnsupportedDeviceTypeError: 'E38',
actionIframeIsNotLoadedError: 'E39',
actionElementNotIframeError: 'E40',
actionInvalidScrollTargetError: 'E41',
currentIframeIsNotLoadedError: 'E42',
currentIframeNotFoundError: 'E43',
currentIframeIsInvisibleError: 'E44',
nativeDialogNotHandledError: 'E45',
uncaughtErrorInNativeDialogHandler: 'E46',
setTestSpeedArgumentError: 'E47',
setNativeDialogHandlerCodeWrongTypeError: 'E48',
clientFunctionExecutionInterruptionError: 'E49',
domNodeClientFunctionResultError: 'E50',
invalidSelectorResultError: 'E51',
cannotObtainInfoForElementSpecifiedBySelectorError: 'E52',
externalAssertionLibraryError: 'E53',
pageLoadError: 'E54',
windowDimensionsOverflowError: 'E55',
forbiddenCharactersInScreenshotPathError: 'E56',
invalidElementScreenshotDimensionsError: 'E57',
roleSwitchInRoleInitializerError: 'E58',
assertionExecutableArgumentError: 'E59',
assertionWithoutMethodCallError: 'E60',
assertionUnawaitedPromiseError: 'E61',
requestHookNotImplementedError: 'E62',
requestHookUnhandledError: 'E63',
uncaughtErrorInCustomClientScriptCode: 'E64',
uncaughtErrorInCustomClientScriptCodeLoadedFromModule: 'E65',
uncaughtErrorInCustomScript: 'E66',
uncaughtTestCafeErrorInCustomScript: 'E67',
childWindowIsNotLoadedError: 'E68',
childWindowNotFoundError: 'E69',
cannotSwitchToWindowError: 'E70',
closeChildWindowError: 'E71',
childWindowClosedBeforeSwitchingError: 'E72',
cannotCloseWindowWithChildrenError: 'E73',
targetWindowNotFoundError: 'E74',
parentWindowNotFoundError: 'E76',
previousWindowNotFoundError: 'E77',
switchToWindowPredicateError: 'E78',
actionFunctionArgumentError: 'E79',
multipleWindowsModeIsDisabledError: 'E80',
multipleWindowsModeIsNotSupportedInRemoteBrowserError: 'E81',
cannotCloseWindowWithoutParent: 'E82',
cannotRestoreChildWindowError: 'E83',
executionTimeoutExceeded: 'E84',
actionRequiredCookieArguments: 'E85',
actionCookieArgumentError: 'E86',
actionCookieArgumentsError: 'E87',
actionUrlCookieArgumentError: 'E88',
actionUrlsCookieArgumentError: 'E89',
actionStringOptionError: 'E90',
actionDateOptionError: 'E91',
actionNumberOptionError: 'E92',
actionUrlOptionError: 'E93',
actionUrlSearchParamsOptionError: 'E94',
actionObjectOptionError: 'E95',
actionUrlArgumentError: 'E96',
actionStringOrRegexOptionError: 'E97',
actionSkipJsErrorsArgumentError: 'E98',
actionFunctionOptionError: 'E99',
actionInvalidObjectPropertyError: 'E100',
actionElementIsNotTargetError: 'E101',
multipleWindowsModeIsNotSupportedInNativeAutomationError: 'E102',
};
// Base
//--------------------------------------------------------------------
var TestRunErrorBase = /** @class */ (function () {
function TestRunErrorBase(code, callsite) {
this.code = code;
this.isTestCafeError = true;
this.callsite = callsite || null;
}
return TestRunErrorBase;
}());
var ActionOptionErrorBase = /** @class */ (function (_super) {
__extends(ActionOptionErrorBase, _super);
function ActionOptionErrorBase(code, optionName, actualValue) {
var _this = _super.call(this, code) || this;
_this.optionName = optionName;
_this.actualValue = actualValue;
return _this;
}
return ActionOptionErrorBase;
}(TestRunErrorBase));
// Client function errors
//--------------------------------------------------------------------
var ClientFunctionExecutionInterruptionError = /** @class */ (function (_super) {
__extends(ClientFunctionExecutionInterruptionError, _super);
function ClientFunctionExecutionInterruptionError(instantiationCallsiteName, callsite) {
var _this = _super.call(this, TEST_RUN_ERRORS.clientFunctionExecutionInterruptionError, callsite) || this;
_this.instantiationCallsiteName = instantiationCallsiteName;
return _this;
}
return ClientFunctionExecutionInterruptionError;
}(TestRunErrorBase));
var DomNodeClientFunctionResultError = /** @class */ (function (_super) {
__extends(DomNodeClientFunctionResultError, _super);
function DomNodeClientFunctionResultError(instantiationCallsiteName, callsite) {
var _this = _super.call(this, TEST_RUN_ERRORS.domNodeClientFunctionResultError, callsite) || this;
_this.instantiationCallsiteName = instantiationCallsiteName;
return _this;
}
return DomNodeClientFunctionResultError;
}(TestRunErrorBase));
// Selector errors
//--------------------------------------------------------------------
var SelectorErrorBase = /** @class */ (function (_super) {
__extends(SelectorErrorBase, _super);
function SelectorErrorBase(code, _a, callsite) {
var _b = _a === void 0 ? {} : _a, apiFnChain = _b.apiFnChain, apiFnIndex = _b.apiFnIndex, reason = _b.reason;
var _this = _super.call(this, code, callsite) || this;
_this.apiFnChain = apiFnChain;
_this.apiFnIndex = apiFnIndex;
_this.reason = reason;
return _this;
}
return SelectorErrorBase;
}(TestRunErrorBase));
var InvalidSelectorResultError = /** @class */ (function (_super) {
__extends(InvalidSelectorResultError, _super);
function InvalidSelectorResultError(callsite) {
return _super.call(this, TEST_RUN_ERRORS.invalidSelectorResultError, callsite) || this;
}
return InvalidSelectorResultError;
}(TestRunErrorBase));
var CannotObtainInfoForElementSpecifiedBySelectorError = /** @class */ (function (_super) {
__extends(CannotObtainInfoForElementSpecifiedBySelectorError, _super);
function CannotObtainInfoForElementSpecifiedBySelectorError(callsite, apiFnArgs) {
return _super.call(this, TEST_RUN_ERRORS.cannotObtainInfoForElementSpecifiedBySelectorError, apiFnArgs, callsite) || this;
}
return CannotObtainInfoForElementSpecifiedBySelectorError;
}(SelectorErrorBase));
// Uncaught errors
//--------------------------------------------------------------------
var UncaughtErrorOnPage = /** @class */ (function (_super) {
__extends(UncaughtErrorOnPage, _super);
function UncaughtErrorOnPage(errStack, pageDestUrl) {
var _this = _super.call(this, TEST_RUN_ERRORS.uncaughtErrorOnPage) || this;
_this.errStack = errStack;
_this.pageDestUrl = pageDestUrl;
return _this;
}
return UncaughtErrorOnPage;
}(TestRunErrorBase));
var UncaughtErrorInClientFunctionCode = /** @class */ (function (_super) {
__extends(UncaughtErrorInClientFunctionCode, _super);
function UncaughtErrorInClientFunctionCode(instantiationCallsiteName, err, callsite) {
var _this = _super.call(this, TEST_RUN_ERRORS.uncaughtErrorInClientFunctionCode, callsite) || this;
_this.errMsg = String(err);
_this.instantiationCallsiteName = instantiationCallsiteName;
return _this;
}
return UncaughtErrorInClientFunctionCode;
}(TestRunErrorBase));
var UncaughtErrorInCustomDOMPropertyCode = /** @class */ (function (_super) {
__extends(UncaughtErrorInCustomDOMPropertyCode, _super);
function UncaughtErrorInCustomDOMPropertyCode(instantiationCallsiteName, err, prop, callsite) {
var _this = _super.call(this, TEST_RUN_ERRORS.uncaughtErrorInCustomDOMPropertyCode, callsite) || this;
_this.errMsg = String(err);
_this.property = prop;
_this.instantiationCallsiteName = instantiationCallsiteName;
return _this;
}
return UncaughtErrorInCustomDOMPropertyCode;
}(TestRunErrorBase));
var UncaughtErrorInCustomClientScriptCode = /** @class */ (function (_super) {
__extends(UncaughtErrorInCustomClientScriptCode, _super);
function UncaughtErrorInCustomClientScriptCode(err) {
var _this = _super.call(this, TEST_RUN_ERRORS.uncaughtErrorInCustomClientScriptCode) || this;
_this.errMsg = String(err);
return _this;
}
return UncaughtErrorInCustomClientScriptCode;
}(TestRunErrorBase));
var UncaughtErrorInCustomClientScriptLoadedFromModule = /** @class */ (function (_super) {
__extends(UncaughtErrorInCustomClientScriptLoadedFromModule, _super);
function UncaughtErrorInCustomClientScriptLoadedFromModule(err, moduleName) {
var _this = _super.call(this, TEST_RUN_ERRORS.uncaughtErrorInCustomClientScriptCodeLoadedFromModule) || this;
_this.errMsg = String(err);
_this.moduleName = moduleName;
return _this;
}
return UncaughtErrorInCustomClientScriptLoadedFromModule;
}(TestRunErrorBase));
// Action parameters errors
//--------------------------------------------------------------------
// Options errors
//--------------------------------------------------------------------
var ActionIntegerOptionError = /** @class */ (function (_super) {
__extends(ActionIntegerOptionError, _super);
function ActionIntegerOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionIntegerOptionError, optionName, actualValue) || this;
}
return ActionIntegerOptionError;
}(ActionOptionErrorBase));
var ActionPositiveIntegerOptionError = /** @class */ (function (_super) {
__extends(ActionPositiveIntegerOptionError, _super);
function ActionPositiveIntegerOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionPositiveIntegerOptionError, optionName, actualValue) || this;
}
return ActionPositiveIntegerOptionError;
}(ActionOptionErrorBase));
var ActionBooleanOptionError = /** @class */ (function (_super) {
__extends(ActionBooleanOptionError, _super);
function ActionBooleanOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionBooleanOptionError, optionName, actualValue) || this;
}
return ActionBooleanOptionError;
}(ActionOptionErrorBase));
var ActionSpeedOptionError = /** @class */ (function (_super) {
__extends(ActionSpeedOptionError, _super);
function ActionSpeedOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionSpeedOptionError, optionName, actualValue) || this;
}
return ActionSpeedOptionError;
}(ActionOptionErrorBase));
var ActionStringOptionError = /** @class */ (function (_super) {
__extends(ActionStringOptionError, _super);
function ActionStringOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionStringOptionError, optionName, actualValue) || this;
}
return ActionStringOptionError;
}(ActionOptionErrorBase));
var ActionStringOrRegexOptionError = /** @class */ (function (_super) {
__extends(ActionStringOrRegexOptionError, _super);
function ActionStringOrRegexOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionStringOrRegexOptionError, optionName, actualValue) || this;
}
return ActionStringOrRegexOptionError;
}(ActionOptionErrorBase));
var ActionDateOptionError = /** @class */ (function (_super) {
__extends(ActionDateOptionError, _super);
function ActionDateOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionDateOptionError, optionName, actualValue) || this;
}
return ActionDateOptionError;
}(ActionOptionErrorBase));
var ActionNumberOptionError = /** @class */ (function (_super) {
__extends(ActionNumberOptionError, _super);
function ActionNumberOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionNumberOptionError, optionName, actualValue) || this;
}
return ActionNumberOptionError;
}(ActionOptionErrorBase));
var ActionUrlOptionError = /** @class */ (function (_super) {
__extends(ActionUrlOptionError, _super);
function ActionUrlOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionUrlOptionError, optionName, actualValue) || this;
}
return ActionUrlOptionError;
}(ActionOptionErrorBase));
var ActionUrlSearchParamsOptionError = /** @class */ (function (_super) {
__extends(ActionUrlSearchParamsOptionError, _super);
function ActionUrlSearchParamsOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionUrlSearchParamsOptionError, optionName, actualValue) || this;
}
return ActionUrlSearchParamsOptionError;
}(ActionOptionErrorBase));
var ActionObjectOptionError = /** @class */ (function (_super) {
__extends(ActionObjectOptionError, _super);
function ActionObjectOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionObjectOptionError, optionName, actualValue) || this;
}
return ActionObjectOptionError;
}(ActionOptionErrorBase));
var ActionFunctionOptionError = /** @class */ (function (_super) {
__extends(ActionFunctionOptionError, _super);
function ActionFunctionOptionError(optionName, actualValue) {
return _super.call(this, TEST_RUN_ERRORS.actionFunctionOptionError, optionName, actualValue) || this;
}
return ActionFunctionOptionError;
}(ActionOptionErrorBase));
var ActionInvalidObjectPropertyError = /** @class */ (function (_super) {
__extends(ActionInvalidObjectPropertyError, _super);
function ActionInvalidObjectPropertyError(objectName, propertyName, availableProperties) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionInvalidObjectPropertyError) || this;
_this.objectName = objectName;
_this.propertyName = propertyName;
_this.availableProperties = availableProperties;
return _this;
}
return ActionInvalidObjectPropertyError;
}(TestRunErrorBase));
// Action execution errors
//--------------------------------------------------------------------
var ActionElementNotFoundError = /** @class */ (function (_super) {
__extends(ActionElementNotFoundError, _super);
function ActionElementNotFoundError(callsite, apiFnArgs) {
return _super.call(this, TEST_RUN_ERRORS.actionElementNotFoundError, apiFnArgs, callsite) || this;
}
return ActionElementNotFoundError;
}(SelectorErrorBase));
var ActionElementIsInvisibleError = /** @class */ (function (_super) {
__extends(ActionElementIsInvisibleError, _super);
function ActionElementIsInvisibleError(callsite, apiFnArgs) {
return _super.call(this, TEST_RUN_ERRORS.actionElementIsInvisibleError, apiFnArgs, callsite) || this;
}
return ActionElementIsInvisibleError;
}(SelectorErrorBase));
var ActionSelectorMatchesWrongNodeTypeError = /** @class */ (function (_super) {
__extends(ActionSelectorMatchesWrongNodeTypeError, _super);
function ActionSelectorMatchesWrongNodeTypeError(nodeDescription) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionSelectorMatchesWrongNodeTypeError) || this;
_this.nodeDescription = nodeDescription;
return _this;
}
return ActionSelectorMatchesWrongNodeTypeError;
}(TestRunErrorBase));
var ActionAdditionalElementNotFoundError = /** @class */ (function (_super) {
__extends(ActionAdditionalElementNotFoundError, _super);
function ActionAdditionalElementNotFoundError(argumentName, apiFnArgs) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionAdditionalElementNotFoundError, apiFnArgs) || this;
_this.argumentName = argumentName;
return _this;
}
return ActionAdditionalElementNotFoundError;
}(SelectorErrorBase));
var ActionElementIsNotTargetError = /** @class */ (function (_super) {
__extends(ActionElementIsNotTargetError, _super);
function ActionElementIsNotTargetError(callsite) {
return _super.call(this, TEST_RUN_ERRORS.actionElementIsNotTargetError, callsite) || this;
}
return ActionElementIsNotTargetError;
}(TestRunErrorBase));
var ActionAdditionalElementIsInvisibleError = /** @class */ (function (_super) {
__extends(ActionAdditionalElementIsInvisibleError, _super);
function ActionAdditionalElementIsInvisibleError(argumentName, apiFnArgs) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionAdditionalElementIsInvisibleError, apiFnArgs) || this;
_this.argumentName = argumentName;
return _this;
}
return ActionAdditionalElementIsInvisibleError;
}(SelectorErrorBase));
var ActionAdditionalSelectorMatchesWrongNodeTypeError = /** @class */ (function (_super) {
__extends(ActionAdditionalSelectorMatchesWrongNodeTypeError, _super);
function ActionAdditionalSelectorMatchesWrongNodeTypeError(argumentName, nodeDescription) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionAdditionalSelectorMatchesWrongNodeTypeError) || this;
_this.argumentName = argumentName;
_this.nodeDescription = nodeDescription;
return _this;
}
return ActionAdditionalSelectorMatchesWrongNodeTypeError;
}(TestRunErrorBase));
var ActionElementNonEditableError = /** @class */ (function (_super) {
__extends(ActionElementNonEditableError, _super);
function ActionElementNonEditableError() {
return _super.call(this, TEST_RUN_ERRORS.actionElementNonEditableError) || this;
}
return ActionElementNonEditableError;
}(TestRunErrorBase));
var ActionElementNotTextAreaError = /** @class */ (function (_super) {
__extends(ActionElementNotTextAreaError, _super);
function ActionElementNotTextAreaError() {
return _super.call(this, TEST_RUN_ERRORS.actionElementNotTextAreaError) || this;
}
return ActionElementNotTextAreaError;
}(TestRunErrorBase));
var ActionElementNonContentEditableError = /** @class */ (function (_super) {
__extends(ActionElementNonContentEditableError, _super);
function ActionElementNonContentEditableError(argumentName) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionElementNonContentEditableError) || this;
_this.argumentName = argumentName;
return _this;
}
return ActionElementNonContentEditableError;
}(TestRunErrorBase));
var ActionRootContainerNotFoundError = /** @class */ (function (_super) {
__extends(ActionRootContainerNotFoundError, _super);
function ActionRootContainerNotFoundError() {
return _super.call(this, TEST_RUN_ERRORS.actionRootContainerNotFoundError) || this;
}
return ActionRootContainerNotFoundError;
}(TestRunErrorBase));
var ActionIncorrectKeysError = /** @class */ (function (_super) {
__extends(ActionIncorrectKeysError, _super);
function ActionIncorrectKeysError(argumentName) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionIncorrectKeysError) || this;
_this.argumentName = argumentName;
return _this;
}
return ActionIncorrectKeysError;
}(TestRunErrorBase));
var ActionCannotFindFileToUploadError = /** @class */ (function (_super) {
__extends(ActionCannotFindFileToUploadError, _super);
function ActionCannotFindFileToUploadError(filePaths, scannedFilePaths) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionCannotFindFileToUploadError) || this;
_this.filePaths = filePaths;
_this.scannedFilePaths = scannedFilePaths;
return _this;
}
return ActionCannotFindFileToUploadError;
}(TestRunErrorBase));
var ActionElementIsNotFileInputError = /** @class */ (function (_super) {
__extends(ActionElementIsNotFileInputError, _super);
function ActionElementIsNotFileInputError() {
return _super.call(this, TEST_RUN_ERRORS.actionElementIsNotFileInputError) || this;
}
return ActionElementIsNotFileInputError;
}(TestRunErrorBase));
var ActionInvalidScrollTargetError = /** @class */ (function (_super) {
__extends(ActionInvalidScrollTargetError, _super);
function ActionInvalidScrollTargetError(scrollTargetXValid, scrollTargetYValid) {
var _this = _super.call(this, TEST_RUN_ERRORS.actionInvalidScrollTargetError) || this;
if (!scrollTargetXValid) {
if (!scrollTargetYValid)
_this.properties = 'scrollTargetX and scrollTargetY properties';
else
_this.properties = 'scrollTargetX property';
}
else
_this.properties = 'scrollTargetY property';
return _this;
}
return ActionInvalidScrollTargetError;
}(TestRunErrorBase));
var InvalidElementScreenshotDimensionsError = /** @class */ (function (_super) {
__extends(InvalidElementScreenshotDimensionsError, _super);
function InvalidElementScreenshotDimensionsError(width, height) {
var _this = _super.call(this, TEST_RUN_ERRORS.invalidElementScreenshotDimensionsError) || this;
var widthIsInvalid = width <= 0;
var heightIsInvalid = height <= 0;
if (widthIsInvalid) {
if (heightIsInvalid) {
_this.verb = 'are';
_this.dimensions = 'width and height';
}
else {
_this.verb = 'is';
_this.dimensions = 'width';
}
}
else {
_this.verb = 'is';
_this.dimensions = 'height';
}
return _this;
}
return InvalidElementScreenshotDimensionsError;
}(TestRunErrorBase));
// Iframe errors
//--------------------------------------------------------------------
var ActionElementNotIframeError = /** @class */ (function (_super) {
__extends(ActionElementNotIframeError, _super);
function ActionElementNotIframeError(callsite) {
return _super.call(this, TEST_RUN_ERRORS.actionElementNotIframeError, callsite) || this;
}
return ActionElementNotIframeError;
}(TestRunErrorBase));
var ActionIframeIsNotLoadedError = /** @class */ (function (_super) {
__extends(ActionIframeIsNotLoadedError, _super);
function ActionIframeIsNotLoadedError() {
return _super.call(this, TEST_RUN_ERRORS.actionIframeIsNotLoadedError) || this;
}
return ActionIframeIsNotLoadedError;
}(TestRunErrorBase));
var CurrentIframeIsNotLoadedError = /** @class */ (function (_super) {
__extends(CurrentIframeIsNotLoadedError, _super);
function CurrentIframeIsNotLoadedError() {
return _super.call(this, TEST_RUN_ERRORS.currentIframeIsNotLoadedError) || this;
}
return CurrentIframeIsNotLoadedError;
}(TestRunErrorBase));
var ChildWindowNotFoundError = /** @class */ (function (_super) {
__extends(ChildWindowNotFoundError, _super);
function ChildWindowNotFoundError() {
return _super.call(this, TEST_RUN_ERRORS.childWindowNotFoundError) || this;
}
return ChildWindowNotFoundError;
}(TestRunErrorBase));
var ChildWindowIsNotLoadedError = /** @class */ (function (_super) {
__extends(ChildWindowIsNotLoadedError, _super);
function ChildWindowIsNotLoadedError() {
return _super.call(this, TEST_RUN_ERRORS.childWindowIsNotLoadedError) || this;
}
return ChildWindowIsNotLoadedError;
}(TestRunErrorBase));
var CannotSwitchToWindowError = /** @class */ (function (_super) {
__extends(CannotSwitchToWindowError, _super);
function CannotSwitchToWindowError() {
return _super.call(this, TEST_RUN_ERRORS.cannotSwitchToWindowError) || this;
}
return CannotSwitchToWindowError;
}(TestRunErrorBase));
var CloseChildWindowError = /** @class */ (function (_super) {
__extends(CloseChildWindowError, _super);
function CloseChildWindowError() {
return _super.call(this, TEST_RUN_ERRORS.closeChildWindowError) || this;
}
return CloseChildWindowError;
}(TestRunErrorBase));
var CannotCloseWindowWithChildrenError = /** @class */ (function (_super) {
__extends(CannotCloseWindowWithChildrenError, _super);
function CannotCloseWindowWithChildrenError() {
return _super.call(this, TEST_RUN_ERRORS.cannotCloseWindowWithChildrenError) || this;
}
return CannotCloseWindowWithChildrenError;
}(TestRunErrorBase));
var CannotCloseWindowWithoutParentError = /** @class */ (function (_super) {
__extends(CannotCloseWindowWithoutParentError, _super);
function CannotCloseWindowWithoutParentError() {
return _super.call(this, TEST_RUN_ERRORS.cannotCloseWindowWithoutParent) || this;
}
return CannotCloseWindowWithoutParentError;
}(TestRunErrorBase));
var SwitchToWindowPredicateError = /** @class */ (function (_super) {
__extends(SwitchToWindowPredicateError, _super);
function SwitchToWindowPredicateError(errMsg) {
var _this = _super.call(this, TEST_RUN_ERRORS.switchToWindowPredicateError) || this;
_this.errMsg = errMsg;
return _this;
}
return SwitchToWindowPredicateError;
}(TestRunErrorBase));
var WindowNotFoundError = /** @class */ (function (_super) {
__extends(WindowNotFoundError, _super);
function WindowNotFoundError() {
return _super.call(this, TEST_RUN_ERRORS.targetWindowNotFoundError) || this;
}
return WindowNotFoundError;
}(TestRunErrorBase));
var ParentWindowNotFoundError = /** @class */ (function (_super) {
__extends(ParentWindowNotFoundError, _super);
function ParentWindowNotFoundError() {
return _super.call(this, TEST_RUN_ERRORS.parentWindowNotFoundError) || this;
}
return ParentWindowNotFoundError;
}(TestRunErrorBase));
var PreviousWindowNotFoundError = /** @class */ (function (_super) {
__extends(PreviousWindowNotFoundError, _super);
function PreviousWindowNotFoundError() {
return _super.call(this, TEST_RUN_ERRORS.previousWindowNotFoundError) || this;
}
return PreviousWindowNotFoundError;
}(TestRunErrorBase));
var ChildWindowClosedBeforeSwitchingError = /** @class */ (function (_super) {
__extends(ChildWindowClosedBeforeSwitchingError, _super);
function ChildWindowClosedBeforeSwitchingError() {
return _super.call(this, TEST_RUN_ERRORS.childWindowClosedBeforeSwitchingError) || this;
}
return ChildWindowClosedBeforeSwitchingError;
}(TestRunErrorBase));
var CannotRestoreChildWindowError = /** @class */ (function (_super) {
__extends(CannotRestoreChildWindowError, _super);
function CannotRestoreChildWindowError() {
return _super.call(this, TEST_RUN_ERRORS.cannotRestoreChildWindowError) || this;
}
return CannotRestoreChildWindowError;
}(TestRunErrorBase));
var CurrentIframeNotFoundError = /** @class */ (function (_super) {
__extends(CurrentIframeNotFoundError, _super);
function CurrentIframeNotFoundError() {
return _super.call(this, TEST_RUN_ERRORS.currentIframeNotFoundError) || this;
}
return CurrentIframeNotFoundError;
}(TestRunErrorBase));
var CurrentIframeIsInvisibleError = /** @class */ (function (_super) {
__extends(CurrentIframeIsInvisibleError, _super);
function CurrentIframeIsInvisibleError() {
return _super.call(this, TEST_RUN_ERRORS.currentIframeIsInvisibleError) || this;
}
return CurrentIframeIsInvisibleError;
}(TestRunErrorBase));
// Native dialog errors
//--------------------------------------------------------------------
var NativeDialogNotHandledError = /** @class */ (function (_super) {
__extends(NativeDialogNotHandledError, _super);
function NativeDialogNotHandledError(dialogType, url) {
var _this = _super.call(this, TEST_RUN_ERRORS.nativeDialogNotHandledError) || this;
_this.dialogType = dialogType;
_this.pageUrl = url;
return _this;
}
return NativeDialogNotHandledError;
}(TestRunErrorBase));
var UncaughtErrorInNativeDialogHandler = /** @class */ (function (_super) {
__extends(UncaughtErrorInNativeDialogHandler, _super);
function UncaughtErrorInNativeDialogHandler(dialogType, errMsg, url) {
var _this = _super.call(this, TEST_RUN_ERRORS.uncaughtErrorInNativeDialogHandler) || this;
_this.dialogType = dialogType;
_this.errMsg = errMsg;
_this.pageUrl = url;
return _this;
}
return UncaughtErrorInNativeDialogHandler;
}(TestRunErrorBase));
var MultipleWindowsModeIsNotSupportedInNativeAutomationModeError = /** @class */ (function (_super) {
__extends(MultipleWindowsModeIsNotSupportedInNativeAutomationModeError, _super);
function MultipleWindowsModeIsNotSupportedInNativeAutomationModeError() {
return _super.call(this, TEST_RUN_ERRORS.multipleWindowsModeIsNotSupportedInNativeAutomationError) || this;
}
return MultipleWindowsModeIsNotSupportedInNativeAutomationModeError;
}(TestRunErrorBase));
var Errors = /*#__PURE__*/Object.freeze({
__proto__: null,
TestRunErrorBase: TestRunErrorBase,
ClientFunctionExecutionInterruptionError: ClientFunctionExecutionInterruptionError,
DomNodeClientFunctionResultError: DomNodeClientFunctionResultError,
SelectorErrorBase: SelectorErrorBase,
InvalidSelectorResultError: InvalidSelectorResultError,
CannotObtainInfoForElementSpecifiedBySelectorError: CannotObtainInfoForElementSpecifiedBySelectorError,
UncaughtErrorOnPage: UncaughtErrorOnPage,
UncaughtErrorInClientFunctionCode: UncaughtErrorInClientFunctionCode,
UncaughtErrorInCustomDOMPropertyCode: UncaughtErrorInCustomDOMPropertyCode,
UncaughtErrorInCustomClientScriptCode: UncaughtErrorInCustomClientScriptCode,
UncaughtErrorInCustomClientScriptLoadedFromModule: UncaughtErrorInCustomClientScriptLoadedFromModule,
ActionIntegerOptionError: ActionIntegerOptionError,
ActionPositiveIntegerOptionError: ActionPositiveIntegerOptionError,
ActionBooleanOptionError: ActionBooleanOptionError,
ActionSpeedOptionError: ActionSpeedOptionError,
ActionStringOptionError: ActionStringOptionError,
ActionStringOrRegexOptionError: ActionStringOrRegexOptionError,
ActionDateOptionError: ActionDateOptionError,
ActionNumberOptionError: ActionNumberOptionError,
ActionUrlOptionError: ActionUrlOptionError,
ActionUrlSearchParamsOptionError: ActionUrlSearchParamsOptionError,
ActionObjectOptionError: ActionObjectOptionError,
ActionFunctionOptionError: ActionFunctionOptionError,
ActionInvalidObjectPropertyError: ActionInvalidObjectPropertyError,
ActionElementNotFoundError: ActionElementNotFoundError,
ActionElementIsInvisibleError: ActionElementIsInvisibleError,
ActionSelectorMatchesWrongNodeTypeError: ActionSelectorMatchesWrongNodeTypeError,
ActionAdditionalElementNotFoundError: ActionA