Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

[Testing] Intermittent failures debugging #226

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions static/js/sidebar/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
});
};

Expand Down
7 changes: 7 additions & 0 deletions test/frontend/test_frontend_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions test/frontend/worker/spa_events_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down