@testwizard/commands-mobile
Version:
26 lines (19 loc) • 741 B
JavaScript
;
const Commands = require('@testwizard/commands-core');
const Result = require('./ScreenshotResult');
class ScreenshotJPGCommand extends Commands.CommandBase {
constructor(testObject) {
super(testObject, 'Mobile.ScreenshotJPG');
}
async execute(fileName, quality) {
if (fileName === undefined)
throw new Error('fileName is required');
const requestObj = [fileName];
if (quality !== undefined) {
requestObj.push(quality);
}
const json = await this.executeCommand(requestObj);
return new Result(json, 'screenshotJPG was successful', 'screenshotJPG failed');
}
}
module.exports = ScreenshotJPGCommand;