107 lines
14 KiB
JavaScript
107 lines
14 KiB
JavaScript
|
"use strict";
|
||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.MaximizeWindowCommand = exports.ResizeWindowToFitDeviceCommand = exports.ResizeWindowCommand = exports.TakeScreenshotOnFailCommand = exports.TakeElementScreenshotCommand = exports.TakeScreenshotCommand = exports.TakeScreenshotBaseCommand = void 0;
|
||
|
const type_1 = __importDefault(require("./type"));
|
||
|
const base_1 = require("./base");
|
||
|
const options_1 = require("./options");
|
||
|
const initializers_1 = require("./validations/initializers");
|
||
|
const argument_1 = require("./validations/argument");
|
||
|
const utils_1 = require("../../screenshots/utils");
|
||
|
const lodash_1 = require("lodash");
|
||
|
function initResizeToFitDeviceOptions(name, val, initOptions, validate = true) {
|
||
|
return new options_1.ResizeToFitDeviceOptions(val, validate);
|
||
|
}
|
||
|
function initElementScreenshotOptions(name, val, initOptions, validate = true) {
|
||
|
return new options_1.ElementScreenshotOptions(val, validate);
|
||
|
}
|
||
|
// Commands
|
||
|
class TakeScreenshotBaseCommand extends base_1.ActionCommandBase {
|
||
|
constructor(obj, testRun, type, validateProperties) {
|
||
|
super(obj, testRun, type, validateProperties);
|
||
|
this.markSeed = null;
|
||
|
this.markData = '';
|
||
|
}
|
||
|
generateScreenshotMark() {
|
||
|
Object.assign(this, (0, utils_1.generateScreenshotMark)());
|
||
|
}
|
||
|
}
|
||
|
exports.TakeScreenshotBaseCommand = TakeScreenshotBaseCommand;
|
||
|
class TakeScreenshotCommand extends TakeScreenshotBaseCommand {
|
||
|
constructor(obj, testRun, validateProperties) {
|
||
|
super(obj, testRun, type_1.default.takeScreenshot, validateProperties);
|
||
|
}
|
||
|
getAssignableProperties() {
|
||
|
return [
|
||
|
{ name: 'path', type: argument_1.screenshotPathArgument, defaultValue: '' },
|
||
|
{ name: 'fullPage', type: argument_1.booleanArgument, defaultValue: void 0 },
|
||
|
{ name: 'thumbnails', type: argument_1.booleanArgument, defaultValue: void 0 },
|
||
|
];
|
||
|
}
|
||
|
}
|
||
|
exports.TakeScreenshotCommand = TakeScreenshotCommand;
|
||
|
TakeScreenshotCommand.methodName = (0, lodash_1.camelCase)(type_1.default.takeScreenshot);
|
||
|
class TakeElementScreenshotCommand extends TakeScreenshotBaseCommand {
|
||
|
constructor(obj, testRun, validateProperties) {
|
||
|
super(obj, testRun, type_1.default.takeElementScreenshot, validateProperties);
|
||
|
}
|
||
|
getAssignableProperties() {
|
||
|
return [
|
||
|
{ name: 'selector', init: initializers_1.initSelector, required: true },
|
||
|
{ name: 'options', init: initElementScreenshotOptions, required: true },
|
||
|
{ name: 'path', type: argument_1.screenshotPathArgument, defaultValue: '' },
|
||
|
];
|
||
|
}
|
||
|
}
|
||
|
exports.TakeElementScreenshotCommand = TakeElementScreenshotCommand;
|
||
|
TakeElementScreenshotCommand.methodName = (0, lodash_1.camelCase)(type_1.default.takeElementScreenshot);
|
||
|
class TakeScreenshotOnFailCommand extends TakeScreenshotBaseCommand {
|
||
|
constructor(obj, testRun) {
|
||
|
super(obj, testRun, type_1.default.takeScreenshotOnFail);
|
||
|
}
|
||
|
getAssignableProperties() {
|
||
|
return [
|
||
|
{ name: 'fullPage', type: argument_1.booleanArgument, defaultValue: false },
|
||
|
{ name: 'failedActionId', type: argument_1.stringArgument },
|
||
|
];
|
||
|
}
|
||
|
}
|
||
|
exports.TakeScreenshotOnFailCommand = TakeScreenshotOnFailCommand;
|
||
|
TakeScreenshotOnFailCommand.methodName = (0, lodash_1.camelCase)(type_1.default.takeScreenshotOnFail);
|
||
|
class ResizeWindowCommand extends base_1.ActionCommandBase {
|
||
|
constructor(obj, testRun) {
|
||
|
super(obj, testRun, type_1.default.resizeWindow);
|
||
|
}
|
||
|
getAssignableProperties() {
|
||
|
return [
|
||
|
{ name: 'width', type: argument_1.positiveIntegerArgument, required: true },
|
||
|
{ name: 'height', type: argument_1.positiveIntegerArgument, required: true },
|
||
|
];
|
||
|
}
|
||
|
}
|
||
|
exports.ResizeWindowCommand = ResizeWindowCommand;
|
||
|
ResizeWindowCommand.methodName = (0, lodash_1.camelCase)(type_1.default.resizeWindow);
|
||
|
class ResizeWindowToFitDeviceCommand extends base_1.ActionCommandBase {
|
||
|
constructor(obj, testRun, validateProperties) {
|
||
|
super(obj, testRun, type_1.default.resizeWindowToFitDevice, validateProperties);
|
||
|
}
|
||
|
getAssignableProperties() {
|
||
|
return [
|
||
|
{ name: 'device', type: argument_1.resizeWindowDeviceArgument, required: true },
|
||
|
{ name: 'options', type: argument_1.actionOptions, init: initResizeToFitDeviceOptions, required: true },
|
||
|
];
|
||
|
}
|
||
|
}
|
||
|
exports.ResizeWindowToFitDeviceCommand = ResizeWindowToFitDeviceCommand;
|
||
|
ResizeWindowToFitDeviceCommand.methodName = (0, lodash_1.camelCase)(type_1.default.resizeWindowToFitDevice);
|
||
|
class MaximizeWindowCommand extends base_1.ActionCommandBase {
|
||
|
constructor() {
|
||
|
super();
|
||
|
this.type = type_1.default.maximizeWindow;
|
||
|
}
|
||
|
}
|
||
|
exports.MaximizeWindowCommand = MaximizeWindowCommand;
|
||
|
MaximizeWindowCommand.methodName = (0, lodash_1.camelCase)(type_1.default.maximizeWindow);
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJvd3Nlci1tYW5pcHVsYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGVzdC1ydW4vY29tbWFuZHMvYnJvd3Nlci1tYW5pcHVsYXRpb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQTBCO0FBQzFCLGlDQUEyQztBQUMzQyx1Q0FBK0U7QUFDL0UsNkRBQTBEO0FBRTFELHFEQU9nQztBQUVoQyxtREFBaUU7QUFDakUsbUNBQW1DO0FBRW5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