From a694be3a954b8a0a005ef1366b831840fdca6550 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 15 Jan 2014 14:51:11 +0000 Subject: [PATCH 1/4] Add basic debugging info --- Makefile | 6 +++--- config/test.json | 2 +- static/js/sidebar/app.js | 13 +++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index fa0086a5..c2c0034a 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_TIMES ?= 3 REPEAT_TEST ?= -m unittest discover -v test/functional 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) { + } }); }; From 44507d59567064983e7737ba700c0f037e038cc9 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Sat, 25 Jan 2014 10:47:27 +0000 Subject: [PATCH 2/4] Debug frontend tests for a bit --- Makefile | 4 ++-- test/frontend/test_frontend_all.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c2c0034a..817b3932 100644 --- a/Makefile +++ b/Makefile @@ -66,8 +66,8 @@ selenium: bin/run_selenium_test.sh "python -m unittest discover -v test/functional" .PHONY: selenium-repeat -REPEAT_TIMES ?= 3 -REPEAT_TEST ?= -m unittest discover -v test/functional +REPEAT_TIMES ?= 20 +REPEAT_TEST ?= -m unittest discover -v test/frontend selenium-repeat: FULL_SELENIUM_DEBUG=1 bin/run_selenium_test.sh "bin/repeat_loop.sh $(REPEAT_TIMES) python $(REPEAT_TEST)" 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: From 314b896483a6127752b23ee08150dee294c09c55 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Sat, 25 Jan 2014 11:07:55 +0000 Subject: [PATCH 3/4] Stub add contacts in instantshare test --- test/frontend/worker/spa_events_test.js | 1 + 1 file changed, 1 insertion(+) 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() { From a405885b43ff54f19f62622ac0826966067f48d1 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Sat, 25 Jan 2014 11:17:24 +0000 Subject: [PATCH 4/4] More repeats --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 817b3932..b60d1d1a 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ selenium: bin/run_selenium_test.sh "python -m unittest discover -v test/functional" .PHONY: selenium-repeat -REPEAT_TIMES ?= 20 +REPEAT_TIMES ?= 80 REPEAT_TEST ?= -m unittest discover -v test/frontend selenium-repeat: FULL_SELENIUM_DEBUG=1 bin/run_selenium_test.sh "bin/repeat_loop.sh $(REPEAT_TIMES) python $(REPEAT_TEST)"