@testwizard/commands-video
Version:
31 lines (21 loc) • 842 B
JavaScript
;
const Commands = require('@testwizard/commands-core');
const Result = require('./SnapShotResult');
class SnapShotCommand extends Commands.CommandBase {
constructor(testObject) {
super(testObject, 'SnapShot');
}
async execute(fileName, imageFormat, quality) {
if (fileName === undefined)
throw new Error('fileName is required');
if (imageFormat === undefined)
throw new Error('imageFormat is required');
const requestObj = [fileName, imageFormat];
if (quality !== undefined) {
requestObj.push(quality);
}
const json = await this.executeCommand(requestObj);
return new Result(json, 'snapShot was successful', 'snapShot failed');
}
}
module.exports = SnapShotCommand;