diff --git a/Makefile b/Makefile index fa0086a5..b60d1d1a 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SESSION_SECRET?=unguessable # default secret for development and test mode endif .PHONY: test -test: lint mocha selenium_all +test: selenium-repeat install: @npm install @@ -66,10 +66,10 @@ selenium: bin/run_selenium_test.sh "python -m unittest discover -v test/functional" .PHONY: selenium-repeat -REPEAT_TIMES ?= 10 -REPEAT_TEST ?= -m unittest discover -v test/functional +REPEAT_TIMES ?= 80 +REPEAT_TEST ?= -m unittest discover -v test/frontend selenium-repeat: - bin/run_selenium_test.sh "bin/repeat_loop.sh $(REPEAT_TIMES) python $(REPEAT_TEST)" + FULL_SELENIUM_DEBUG=1 bin/run_selenium_test.sh "bin/repeat_loop.sh $(REPEAT_TIMES) python $(REPEAT_TEST)" .PHONY: frontend frontend: diff --git a/config/test.json b/config/test.json index 6fcdd02f..66be59c3 100644 --- a/config/test.json +++ b/config/test.json @@ -2,7 +2,7 @@ "DEBUG": true, "PENDING_CALL_TIMEOUT": 4000, "FAKE_MEDIA_STREAMS": true, - "LOG_LEVEL": "error", + "LOG_LEVEL": "info", "PERSONA_INCLUDE_URL": "/test/functional/persona.js", "LONG_POLLING_TIMEOUT": 4000, "CONVERSATION_IGNORE_DISPLAY_TIME": 1000 diff --git a/static/js/sidebar/app.js b/static/js/sidebar/app.js index f3dd9724..b26b1d51 100644 --- a/static/js/sidebar/app.js +++ b/static/js/sidebar/app.js @@ -163,12 +163,17 @@ var SidebarApp = (function(app, $) { }; SidebarApp.prototype._setupDebugLogging = function() { - if (!app.options.DEBUG) - return; + //if (!app.options.DEBUG) + // return; // worker port events logging - this.appPort.on("talkilla.debug", function(event) { - console.log("worker event", event.label, event.data); + this.appPort.on('talkilla.debug', function(event) { + console.log('worker event', event.label, event.data); + dump('worker event "' + event.label + '"\n'); + try { + dump('event.data' + JSON.stringify(event.data) + "\n"); + } catch (x) { + } }); }; diff --git a/test/frontend/test_frontend_all.py b/test/frontend/test_frontend_all.py index 055c5e96..5a5858ca 100644 --- a/test/frontend/test_frontend_all.py +++ b/test/frontend/test_frontend_all.py @@ -12,6 +12,12 @@ SERVER_PREFIX = 'http://localhost:3000/test/frontend/' +# Utility function to aid debugging. Call this in a try/except/raise block +# to get a url dumped which is a screenshot of the frame that the driver is +# showing. +# XXX Make the tests do this automatically on failure +def output_base64_screenshot(driver): + print("data:image/png;base64," + driver.get_screenshot_as_base64()) class FrontEndSuite(unittest.TestCase): @@ -51,6 +57,7 @@ def check_coverage(self): print("\n Code coverage: %s" % coverage) def get_failure_details(self): + output_base64_screenshot(self.drvr) fail_nodes = self.drvr.find_elements_by_css_selector('.test.fail') details = ["%d failure(s) encountered:" % len(fail_nodes)] for node in fail_nodes: diff --git a/test/frontend/worker/spa_events_test.js b/test/frontend/worker/spa_events_test.js index b3fa3e13..37dd007d 100644 --- a/test/frontend/worker/spa_events_test.js +++ b/test/frontend/worker/spa_events_test.js @@ -427,6 +427,7 @@ describe("SPA events", function() { beforeEach(function() { browserPort = {postEvent: sandbox.spy()}; tkWorker.users.set('alice',{}); + sandbox.stub(tkWorker.contactsDb, "add"); }); afterEach(function() {