@testwizard/commands-video
Version:
33 lines (26 loc) • 1.08 kB
JavaScript
;
const Commands = require('@testwizard/commands-core');
const Result = require('./CompareResult');
class CompareCommand extends Commands.CommandBase {
constructor(testObject) {
super(testObject, 'Compare');
}
async execute(x, y, width, height, filePath, tolerance) {
if (x === undefined)
throw new Error('x is required');
if (y === undefined)
throw new Error('y is required');
if (width === undefined)
throw new Error('width is required');
if (height === undefined)
throw new Error('height is required');
if (filePath === undefined)
throw new Error('filePath is required');
if (tolerance === undefined)
throw new Error('tolerance is required');
const requestObj = [x, y, width, height, filePath, tolerance];
const json = await this.executeCommand(requestObj);
return new Result(json, 'compare was successful', 'compare failed');
}
}
module.exports = CompareCommand;