@testwizard/commands-video
Version:
43 lines (33 loc) • 1.5 kB
JavaScript
;
const Commands = require('@testwizard/commands-core');
const Result = require('./WaitForSampleResult');
class WaitForSampleNoMatchCommand extends Commands.CommandBase {
constructor(testObject) {
super(testObject, 'WaitForSampleNoMatch');
}
async execute(x, y, width, height, minSimilarity, timeout, tolerance, distanceMethod, maxDistance) {
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 (minSimilarity === undefined)
throw new Error('minSimilarity is required');
if (timeout === undefined)
throw new Error('timeout is required');
const requestObj = [x, y, width, height, minSimilarity, timeout, tolerance];
if (tolerance !== undefined)
requestObj.push(tolerance);
if (distanceMethod !== undefined) {
requestObj.push(distanceMethod);
if (maxDistance !== undefined)
requestObj.push(maxDistance);
}
const json = await this.executeCommand(requestObj);
return new Result(json, 'waitForSampleNoMatch was successful', 'waitForSampleNoMatch failed');
}
}
module.exports = WaitForSampleNoMatchCommand;