Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%# Make sure you ONLY include this code in RAILS_ENV=test or cucumber %>
- <%# Note: Selenium treats alert()s as kind of failed expectation. %>
- <script type="text/javascript">
- window.cucumberOriginalAlert = window.alert;
- window.cucumberErrors = [];
- window.onerror = function() {
- var args = []; // typical arguments are Message, File, Line#
- for (var i = 0; i < arguments.length; i++) {
- args.push(arguments[i]);
- }
- cucumberErrors.push(args.join(", "));
- if (!window.cucumberErrorReporter) {
- window.cucumberErrorReporter = setInterval(function() {
- // Wait for selenium to replace the alert function, or we'll cause a REAL alert (bad!)
- if (window.alert != window.cucumberOriginalAlert) {
- alert(cucumberErrors.join("\n"));
- clearInterval(window.cucumberErrorReporter);
- }
- }, 100);
- }
- };
- </script>
Add Comment
Please, Sign In to add comment