+ Start a Discussion
Mitch McConnellMitch McConnell 

Seeing Javascript errors in Apex test class

We have a button on the Opportunity page that does some Javascript validation, mostly pretty
basic stuff, like which profiles have access, no duplicates, etc.  The Javascript simply puts
up an Alert box if one of the errors is detected.

I would still like to be able to automate tests for these conditions, but the normal way I have done
this in the past was to catch an exception and test the error message.

Clearly, this will not work for this type of Javascript validation.  

Is there any way I can call something like 'addError' from Javascript?  I Googled and have not
been able to find a way to set an error that my Apex test class could detect.

Thanks,

Mitch

Is there any way to