-
-
Save tsuhachev/1745360 to your computer and use it in GitHub Desktop.
Revisions
-
Gabe Kopley revised this gist
Dec 13, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # in features/support/env.rb require 'selenium/webdriver' # we need a firefox extension to start intercepting javascript errors before the page -
Gabe Kopley revised this gist
Nov 17, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ require 'selenium/webdriver' # we need a firefox extension to start intercepting javascript errors before the page # scripts load Capybara.register_driver :selenium do |app| profile = Selenium::WebDriver::Firefox::Profile.new # see https://github.com/mguillem/JSErrorCollector -
Gabe Kopley created this gist
Nov 17, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ # in features/env.rb require 'selenium/webdriver' # we need a firefox extension to start intercepting javascript errors before the page # script load Capybara.register_driver :selenium do |app| profile = Selenium::WebDriver::Firefox::Profile.new # see https://github.com/mguillem/JSErrorCollector profile.add_extension File.join(Rails.root, "features/support/extensions/JSErrorCollector.xpi") Capybara::Selenium::Driver.new app, :profile => profile end After do |scenario| if page.driver.to_s.match("Selenium") errors = page.execute_script("return window.JSErrorCollector_errors.pump()") if errors.any? puts '-------------------------------------------------------------' puts "Found #{errors.length} javascript #{pluralize(errors.length, 'error')}" puts '-------------------------------------------------------------' errors.each do |error| puts " #{error["errorMessage"]} (#{error["sourceName"]}:#{error["lineNumber"]})" end raise "Javascript #{pluralize(errors.length, 'error')} detected, see above" end end end