Closed Yogu closed 10 years ago
Looks cool, I think it might be fairly easy to integrate this. I'll look into it.
+1
We just do this in our app with the window.onerror, write them to an array, and then always check the JS errors in an execute() at the end of our tests. It's no where near as robust but gets you somewhere near there in the meantime.
Another way to solve this is probably #222 ?
@beatfactor What's the state on this issue? Why did you close it?
Because I don't think it will become part of the API. From what I can tell It could be implemented via a browser extension and a custom command/assertion. Would that work for you?
On Monday, September 1, 2014, Jan Melcher notifications@github.com wrote:
@beatfactor https://github.com/beatfactor What's the state on this issue? Why did you close it?
— Reply to this email directly or view it on GitHub https://github.com/beatfactor/nightwatch/issues/77#issuecomment-54093249 .
+1
@beatfactor It could be implemented via a browser extension using JSErrorCollector, but how can we integrate a custom extension in nightwatch?
From JSErrorCollector docs there's an example in ruby:
profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension File.join(Rails.root, "features/support/extensions/JSErrorCollector.xpi")
Capybara::Selenium::Driver.new app, :profile => profile
in python and chromeJSErrorCollector:
chrome_options = Options()
chrome_options.add_extension('extension.crx')
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('http://stuff-dharrya.rhcloud.com/get_js_error')
print(driver.execute_script('return window.JSErrorCollector_errors ? window.JSErrorCollector_errors.pump() : []'))
driver.quit()
Can we do the same thing in nightwatch?
What is the current state of request ? is there example how to solve ?
was this solved ?
@vvscode , @IndraniBiswas , This was solved as part of #609.
The route you have to go at it is a little roundabout, but the documentation is here: http://nightwatchjs.org/api/getLog.html
Has someone implemented this? Are there any working end-to-end examples available?
It would be cool if nightwatch failed a test when a javascript error occurs in the browser. I think the JSErrorCollector extension for firefox and for chrome can do this. Do you think it's possible to integrate them into nightwatch?