@testwizard/commands-video
Version:
37 lines (30 loc) • 1.35 kB
JavaScript
;
const Commands = require('@testwizard/commands-core');
const Result = require('./WaitForColorResult');
class WaitForColorCommand extends Commands.CommandBase {
constructor(testObject) {
super(testObject, 'WaitForColor');
}
async execute(x, y, width, height, refColor, tolerance, minSimilarity, timeout) {
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 (refColor === undefined)
throw new Error('refColor is required');
if (tolerance === undefined)
throw new Error('tolerance 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, refColor, tolerance, minSimilarity, timeout];
const json = await this.executeCommand(requestObj);
return new Result(json, 'waitForColor was successful', 'waitForColor failed');
}
}
module.exports = WaitForColorCommand;