Innovenergy_trunk/frontend/node_modules/testcafe/lib/client-functions/client-function-builder.js

176 lines
27 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = require("lodash");
const test_run_tracker_1 = __importDefault(require("../api/test-run-tracker"));
const builder_symbol_1 = __importDefault(require("./builder-symbol"));
const replicator_1 = require("./replicator");
const observation_1 = require("../test-run/commands/observation");
const compile_client_function_1 = __importDefault(require("../compiler/compile-client-function"));
const runtime_1 = require("../errors/runtime");
const type_assertions_1 = require("../errors/runtime/type-assertions");
const types_1 = require("../errors/types");
const get_callsite_1 = require("../errors/get-callsite");
const re_executable_promise_1 = __importDefault(require("../utils/re-executable-promise"));
const marker_symbol_1 = __importDefault(require("../test-run/marker-symbol"));
const selector_api_execution_mode_1 = __importDefault(require("./selector-api-execution-mode"));
const check_element_delay_1 = __importDefault(require("../client/driver/command-executors/client-functions/selector-executor/check-element-delay"));
const templates_1 = __importDefault(require("../errors/test-run/templates"));
const dedent_1 = __importDefault(require("dedent"));
const DEFAULT_EXECUTION_CALLSITE_NAME = '__$$clientFunction$$';
class ClientFunctionBuilder {
constructor(fn, options, callsiteNames = {}) {
this.callsiteNames = {
instantiation: callsiteNames.instantiation,
execution: callsiteNames.execution || DEFAULT_EXECUTION_CALLSITE_NAME,
};
if ((0, lodash_1.isNil)(options))
options = {};
this._validateOptions(options);
this.fn = fn;
this.options = options;
this.compiledFnCode = this._getCompiledFnCode();
if (!this.compiledFnCode)
throw this._createInvalidFnTypeError();
this.replicator = (0, replicator_1.createReplicator)(this._getReplicatorTransforms());
}
_renderError(error) {
// The rendered template is shown in the Watch panel of browser dev tools or IDE.
// Viewport size is unlimited there.
const viewportWidth = Number.MIN_SAFE_INTEGER;
const renderedMessage = templates_1.default[error.code](error, viewportWidth);
return (0, dedent_1.default)(renderedMessage);
}
_decorateFunction(clientFn) {
clientFn[builder_symbol_1.default] = this;
clientFn.with = options => {
return this._getClientFnWithOverriddenOptions(options);
};
}
_getClientFnWithOverriddenOptions(options) {
if (typeof options === 'object')
options = (0, lodash_1.assign)({}, this.options, options);
const builder = new this.constructor(this.fn, options, {
instantiation: 'with',
execution: this.callsiteNames.execution,
});
return builder.getFunction();
}
getBoundTestRun() {
// NOTE: `boundTestRun` can be either TestController or TestRun instance.
if (this.options.boundTestRun)
return this.options.boundTestRun.testRun || this.options.boundTestRun;
return null;
}
_getTestRun() {
return this.getBoundTestRun() || test_run_tracker_1.default.resolveContextTestRun();
}
_getObservedCallsites() {
var _a;
return ((_a = this._getTestRun()) === null || _a === void 0 ? void 0 : _a.observedCallsites) || null;
}
getFunction() {
const builder = this;
const clientFn = function __$$clientFunction$$() {
const testRun = builder._getTestRun();
const callsite = (0, get_callsite_1.getCallsiteForMethod)(builder.callsiteNames.execution);
const args = [];
// OPTIMIZATION: don't leak `arguments` object.
for (let i = 0; i < arguments.length; i++)
args.push(arguments[i]);
if (selector_api_execution_mode_1.default.isSync)
return builder._executeCommandSync(args, testRun, callsite);
return builder._executeCommand(args, testRun, callsite);
};
this._decorateFunction(clientFn);
return clientFn;
}
getCommand(args = []) {
const encodedArgs = this.replicator.encode(args);
const encodedDependencies = this.replicator.encode(this.getFunctionDependencies());
return this._createTestRunCommand(encodedArgs, encodedDependencies);
}
// Overridable methods
getFunctionDependencies() {
return this.options.dependencies || {};
}
_createTestRunCommand(encodedArgs, encodedDependencies) {
return new observation_1.ExecuteClientFunctionCommand({
instantiationCallsiteName: this.callsiteNames.instantiation,
fnCode: this.compiledFnCode,
args: encodedArgs,
dependencies: encodedDependencies,
}, this._getTestRun());
}
_getCompiledFnCode() {
if (typeof this.fn === 'function')
return (0, compile_client_function_1.default)(this.fn.toString(), this.options.dependencies, this.callsiteNames.instantiation, this.callsiteNames.instantiation);
return null;
}
_createInvalidFnTypeError() {
return new runtime_1.ClientFunctionAPIError(this.callsiteNames.instantiation, this.callsiteNames.instantiation, types_1.RUNTIME_ERRORS.clientFunctionCodeIsNotAFunction, typeof this.fn);
}
_executeCommand(args, testRun, callsite) {
// NOTE: should be kept outside of lazy promise to preserve
// correct callsite in case of replicator error.
const command = this.getCommand(args);
return re_executable_promise_1.default.fromFn(async () => {
if (!testRun) {
const err = new runtime_1.ClientFunctionAPIError(this.callsiteNames.execution, this.callsiteNames.instantiation, types_1.RUNTIME_ERRORS.clientFunctionCannotResolveTestRun);
// NOTE: force callsite here, because more likely it will
// be impossible to resolve it by method name from a lazy promise.
err.callsite = callsite;
throw err;
}
const result = await testRun.executeCommand(command, callsite);
return this._processResult(result, args);
});
}
_executeCommandSync(args, testRun, callsite) {
// NOTE: should be kept outside of lazy promise to preserve
// correct callsite in case of replicator error.
const command = this.getCommand(args);
if (!testRun) {
const err = new runtime_1.ClientFunctionAPIError(this.callsiteNames.execution, this.callsiteNames.instantiation, types_1.RUNTIME_ERRORS.clientFunctionCannotResolveTestRun);
// NOTE: force callsite here, because more likely it will
// be impossible to resolve it by method name from a lazy promise.
err.callsite = callsite;
throw err;
}
// NOTE: reset the command timeout to minimal check interval to
// ensure the find element loop will execute only one time.
if (typeof command.timeout !== 'number')
command.timeout = check_element_delay_1.default;
try {
const result = testRun.executeCommandSync(command, callsite);
return this._processResult(result, args);
}
catch (err) {
throw this._renderError(err);
}
}
_processResult(result) {
return this.replicator.decode(result);
}
_validateOptions(options) {
(0, type_assertions_1.assertType)(type_assertions_1.is.nonNullObject, this.callsiteNames.instantiation, 'The "options" argument', options);
if (!(0, lodash_1.isNil)(options.boundTestRun)) {
// NOTE: `boundTestRun` can be either TestController or TestRun instance.
const boundTestRun = options.boundTestRun.testRun || options.boundTestRun;
if (!boundTestRun[marker_symbol_1.default])
throw new runtime_1.APIError(this.callsiteNames.instantiation, types_1.RUNTIME_ERRORS.invalidClientFunctionTestRunBinding);
}
if (!(0, lodash_1.isNil)(options.dependencies))
(0, type_assertions_1.assertType)(type_assertions_1.is.nonNullObject, this.callsiteNames.instantiation, 'The "dependencies" option', options.dependencies);
}
_getReplicatorTransforms() {
return [
new replicator_1.FunctionTransform(this.callsiteNames),
];
}
}
exports.default = ClientFunctionBuilder;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpZW50LWZ1bmN0aW9uLWJ1aWxkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpZW50LWZ1bmN0aW9ucy9jbGllbnQtZnVuY3Rpb24tYnVpbGRlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLG1DQUE0RDtBQUM1RCwrRUFBcUQ7QUFDckQsc0VBQXFEO0FBQ3JELDZDQUFtRTtBQUNuRSxrRUFBZ0Y7QUFDaEYsa0dBQXdFO0FBQ3hFLCtDQUFxRTtBQUNyRSx1RUFBbUU7QUFDbkUsMkNBQWlEO0FBQ2pELHlEQUE4RDtBQUM5RCwyRkFBaUU7QUFDakUsOEVBQXNEO0FBQ3RELGdHQUFxRTtBQUNyRSxvSkFBNEg7QUFDNUgsNkVBQXFEO0FBQ3JELG9EQUE0QjtBQUU1QixNQUFNLCtCQUErQixHQUFHLHNCQUFzQixDQUFDO0FBRS9ELE1BQXFCLHFCQUFxQjtJQUN0QyxZQUFhLEVBQUUsRUFBRSxPQUFPLEVBQUUsYUFBYSxHQUFHLEVBQUU7UUFDeEMsSUFBSSxDQUFDLGFBQWEsR0FBRztZQUNqQixhQUFhLEVBQUUsYUFBYSxDQUFDLGFBQWE7WUFDMUMsU0FBUyxFQUFNLGFBQWEsQ0FBQyxTQUFTLElBQUksK0JBQStCO1NBQzVFLENBQUM7UUFFRixJQUFJLElBQUEsY0FBaUIsRUFBQyxPQUFPLENBQUM7WUFDMUIsT0FBTyxHQUFHLEVBQUUsQ0FBQztRQUVqQixJQUFJLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLENBQUM7UUFFL0IsSUFBSSxD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