Open anatoliyarkhipov opened 6 years ago
For example, in a condition like this I want to pass the selector argument:
selector
const condition = (selector) => { return !! $(selector).attr('disabled') }
But it looks like there is no way to do this except of constructing condition as string:
// like this const condition = `return !! $(${selector}).attr('disabled')` // or this const conditionFunc = () => { return !! $({{SELECTOR}}).attr('disabled') } const condition = conditionFunc.toString().replace('{{SELECTOR}}', selector)
Not a big deal in the exampe, but there might be really big condition functions where such constructing can really bother.
Wouldn't it be as simple to add support for arguments as to add the extra argument for the execute call here?
execute
https://github.com/mobify/nightwatch-commands/blob/4d3984a7943d59deed832fd48258222071d141d6/commands/waitForCondition.js#L49-L69
For example, in a condition like this I want to pass the
selector
argument:But it looks like there is no way to do this except of constructing condition as string:
Not a big deal in the exampe, but there might be really big condition functions where such constructing can really bother.
Wouldn't it be as simple to add support for arguments as to add the extra argument for the
execute
call here?https://github.com/mobify/nightwatch-commands/blob/4d3984a7943d59deed832fd48258222071d141d6/commands/waitForCondition.js#L49-L69