Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1476)

Unified Diff: tools/testing/run_selenium.py

Issue 11043007: Add the ability to get the Javascript console errors in Firefox in the test output when tests fail. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/testing/run_selenium.py
===================================================================
--- tools/testing/run_selenium.py (revision 12980)
+++ tools/testing/run_selenium.py (working copy)
@@ -164,11 +164,14 @@
options.binary_location = os.path.join(dartium_dir, 'chrome')
return selenium.webdriver.Chrome(chrome_options=options)
elif browser == 'ff':
+ script_dir = os.path.dirname(os.path.abspath(__file__))
profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile()
profile.set_preference('dom.max_script_run_time', 0)
profile.set_preference('dom.max_chrome_script_run_time', 0)
profile.set_preference('app.update.auto', True)
profile.set_preference('app.update.enabled', True)
+ xpi = os.path.join(script_dir, 'extensions', 'firefox', 'ConsoleCollector.xpi')
+ profile.add_extension(xpi);
return selenium.webdriver.Firefox(firefox_profile=profile)
elif browser == 'ie' and platform.system() == 'Windows':
return selenium.webdriver.Ie()
@@ -220,7 +223,7 @@
# TODO(efortuna): Figure out why this crashes.... and avoid?
pass
-def report_results(mode, source):
+def report_results(mode, source, browser_name, browser):
# TODO(vsm): Add a failure check for Dromaeo.
if mode != 'correctness':
# We're running a performance test.
@@ -244,6 +247,13 @@
index += len('<body>')
end_index = source.find('</body')
print unicode(source[index : end_index]).encode("utf-8")
+ if browser_name == 'ff':
+ logs = browser.execute_script(
+ "return window.ConsoleCollector.read()");
+ for msg in logs:
+ print('%s:%s:%s:%s %s' %(
+ msg['source'], msg['line'], msg['column'],
+ msg['category'], msg['message']))
return 1
@@ -306,7 +316,7 @@
# print one of:
# >>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}
- status = report_results(mode, source)
+ status = report_results(mode, source, browser_name, browser)
if status == 0:
print '>>> TEST PASS'
elif source == TIMEOUT_ERROR_MSG:
@@ -330,7 +340,7 @@
try:
output = run_test_in_browser(browser, html_out, timeout, mode)
- return report_results(mode, output)
+ return report_results(mode, output, browser_name, browser)
finally:
close_browser(browser)

Powered by Google App Engine
This is Rietveld 408576698