Is there a method to associate an error message with a protractor click function? I am envisioning something like the example line below:
button.click('Button not clickable');
Currently, when an element cannot be located, I receive the non-specific error 'Failed: Cannot call method click of undefined'. The lack of a specific line number and file where the error occurred makes it challenging to pinpoint the exact cause of the issue.
I would anticipate functionality similar to the following line, in which I can add an error message to the toBeTruthy statement:
expect(button.isDisplayed()).toBeTruthy('Button not displayed');
If this line fails, the error message could read 'Element not found, Button not displayed', providing clearer insight into the problem.
Is there a way to include an error message with a click action?