While working on assert lib for page object I faced and issue described here.
There is no way to check if property is a property or a function without calling it, for example:
create({
clickOnMe: clickable('a'),
href: attribute('href', a),
});
So to check if property is a function I need to call it like this:
typeof page.clickOnMe === 'function' // true
typeof page.href=== 'function' // false
The problem with this is that we actually execute getter and if it raises an error, our check will fail.
typeof page.href === 'function' // Element not found!
Do you think it's possible to store it somehow?
While working on assert lib for page object I faced and issue described here.
There is no way to check if property is a property or a function without calling it, for example:
So to check if property is a function I need to call it like this:
The problem with this is that we actually execute getter and if it raises an error, our check will fail.
Do you think it's possible to store it somehow?