Innovenergy_trunk/frontend/node_modules/testcafe/lib/test-run/commands/from-object.js

116 lines
15 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 type_1 = __importDefault(require("./type"));
const actions_1 = require("./actions");
const assertion_1 = require("./assertion");
const browser_manipulation_1 = require("./browser-manipulation");
const observation_1 = require("./observation");
const lodash_1 = require("lodash");
function getCmdCtor(type) {
switch (type) {
case type_1.default.click:
return actions_1.ClickCommand;
case type_1.default.rightClick:
return actions_1.RightClickCommand;
case type_1.default.doubleClick:
return actions_1.DoubleClickCommand;
case type_1.default.hover:
return actions_1.HoverCommand;
case type_1.default.drag:
return actions_1.DragCommand;
case type_1.default.dragToElement:
return actions_1.DragToElementCommand;
case type_1.default.typeText:
return actions_1.TypeTextCommand;
case type_1.default.selectText:
return actions_1.SelectTextCommand;
case type_1.default.selectTextAreaContent:
return actions_1.SelectTextAreaContentCommand;
case type_1.default.selectEditableContent:
return actions_1.SelectEditableContentCommand;
case type_1.default.pressKey:
return actions_1.PressKeyCommand;
case type_1.default.wait:
return observation_1.WaitCommand;
case type_1.default.navigateTo:
return actions_1.NavigateToCommand;
case type_1.default.setFilesToUpload:
return actions_1.SetFilesToUploadCommand;
case type_1.default.clearUpload:
return actions_1.ClearUploadCommand;
case type_1.default.takeScreenshot:
return browser_manipulation_1.TakeScreenshotCommand;
case type_1.default.takeElementScreenshot:
return browser_manipulation_1.TakeElementScreenshotCommand;
case type_1.default.resizeWindow:
return browser_manipulation_1.ResizeWindowCommand;
case type_1.default.resizeWindowToFitDevice:
return browser_manipulation_1.ResizeWindowToFitDeviceCommand;
case type_1.default.maximizeWindow:
return browser_manipulation_1.MaximizeWindowCommand;
case type_1.default.switchToIframe:
return actions_1.SwitchToIframeCommand;
case type_1.default.switchToMainWindow:
return actions_1.SwitchToMainWindowCommand;
case type_1.default.setNativeDialogHandler:
return actions_1.SetNativeDialogHandlerCommand;
case type_1.default.setTestSpeed:
return actions_1.SetTestSpeedCommand;
case type_1.default.setPageLoadTimeout:
return actions_1.SetPageLoadTimeoutCommand;
case type_1.default.assertion:
return assertion_1.AssertionCommand;
case type_1.default.debug:
return observation_1.DebugCommand;
case type_1.default.executeExpression:
return actions_1.ExecuteExpressionCommand;
case type_1.default.executeAsyncExpression:
return actions_1.ExecuteAsyncExpressionCommand;
case type_1.default.recorder:
return actions_1.RecorderCommand;
case type_1.default.getCookies:
return actions_1.GetCookiesCommand;
case type_1.default.setCookies:
return actions_1.SetCookiesCommand;
case type_1.default.deleteCookies:
return actions_1.DeleteCookiesCommand;
case type_1.default.scroll:
return actions_1.ScrollCommand;
case type_1.default.request:
return actions_1.RequestCommand;
case type_1.default.getProxyUrl:
return actions_1.GetProxyUrlCommand;
default:
return null;
}
}
const STUDIO_PROPERTY_NAMES = {
studio: 'studio',
selector: 'selector',
note: 'note',
callsite: 'callsite',
};
function removeStudioRelatedProperties(commandObj) {
delete commandObj[STUDIO_PROPERTY_NAMES.studio];
delete commandObj[STUDIO_PROPERTY_NAMES.note];
delete commandObj[STUDIO_PROPERTY_NAMES.callsite];
const selectorValue = commandObj[STUDIO_PROPERTY_NAMES.selector];
if (!(0, lodash_1.isNil)(selectorValue))
return;
delete commandObj['selector'];
}
// Create command from object
function createCommandFromObject(obj, testRun) {
const CmdCtor = getCmdCtor(obj.type);
// NOTE: TestCafe Studio adds additional fields to the command object in RAW tests.
// They do not affect the execution of the command. Therefore, we should remove them before validation.
// We should change this mechanism in TestCafe Studio in the future to not add these properties to RAW tests.
removeStudioRelatedProperties(obj);
return CmdCtor && new CmdCtor(obj, testRun);
}
exports.default = createCommandFromObject;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJvbS1vYmplY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGVzdC1ydW4vY29tbW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QRS5yaWdodENsaWNrOlxuICAgICAgICAgICAgcmV0dXJuIFJpZ2h0Q2xpY2tDb21tYW5kO1xuXG4gICAgICAgIGNhc2UgVFlQRS5kb3VibGVDbGljazpcbiAgICAgICAgICAgIHJldHVybiBEb3VibGVDbGlja0NvbW1hbmQ7XG5cbiAgICAgICAgY2FzZSBUWVBFLmhvdmVyOlxuICAgICAgICAgICAgcmV0dXJuIEhvdmVyQ29tbWFuZDtcblxuICAgICAgICBjYXNlIFRZUEUuZHJhZzpcbiAgICAgICAgICAgIHJldHVybiBEcmFnQ29tbWFuZDtcblxuICAgICAgICBjYXNlIFRZUEUuZHJhZ1RvRWxlbWVudDpcbiAgICAgICAgICAgIHJldHVybiBEcmFnVG9FbGVtZW50Q29tbWFuZDtcblxuICAgICAgICBjYXNlIFRZUEUudHlwZVRleHQ6XG4gICAgICAgICAgICByZXR1cm4gVHlwZVRleHRDb21tYW5kO1xuXG4gICAgICAgIGNhc2UgVFlQRS5zZWxlY3RUZXh0OlxuICAgICAgICAgICAgcmV0dXJuIFNlbGVjdFRleHRDb21tYW5kO1xuXG4gICAgICAgIGNhc2UgVFlQRS5zZWxlY3RUZXh0QXJlYUNvbnRlbnQ6XG4gICAgICAgICAgICByZXR1cm4gU2VsZWN0VGV4dEFyZWFDb250ZW50Q29tbWFuZDtcblxuICAgICAgICBjYXNlIFRZUEUuc2VsZWN0RWRpdGFibGVDb250ZW50OlxuICAgICAgICAgICAgcmV0dXJuIFNlbGVjdEVkaXRhYmxlQ29udGVudENvbW1hbmQ7XG5cbiAgICAgICAgY2FzZSBUWVBFLnByZXNzS2V5OlxuICAgICAgICAgICAgcmV0dXJuIFByZXNzS2V5Q29tbWFuZDtcblxuICAgICAgICBjYXNlIFRZUEUud2FpdDpcbiAgICAgICAgICAgIHJldHVybiBXYWl0Q29tbWFuZDtcblxuICAgICAgICBjYXNlIFRZUEUubmF2aWdhdGVUbzpcbiAgICAgICAgICAgIHJldHVybiBOYXZpZ2F0ZVRvQ29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