Check for JavaScript Errors
The Step Builder allows you to add steps which perform actions which cannot be recorded. The below described step can be found in the Common section of Step Builder.
Add Step to Check for JS Errors
Insert a Check For JS Errors step to verify if there are any JS errors generated on the page. If not modified the default added step will check for any JS errors and will pass if there are none. If some errors are detected the step will fail and list the errors and their count per error text in the step failure details.
The execution log file also contains the failure information.
Exclude JS Errors
You can specify, though, which errors to be excluded from that count. The text of all errors to be excluded can be listed in the ExcludedErrors property of the step. This field can be also data driven.
The check is if the error text contains the text listed in the ExcludedErrors field. The result after execution specifies there are no errors containing the populated error text.
Multiple errors can be excluded as well - separate the errors text with '|'. Be aware that single space charachter is also taken into account and could cause false positive results.
The log of the test execution provides details which are the excluded errors and if there are any other.
Note: The JS error check step detects only JavaScript errors. Any errors related to not loaded resources will not be detected. An example for such console error is listed below:
Failed to load resource: the server responded with a status of 404 (Not Found)