From 244265d52bba9432c9caaf44ecb18d76612cd11b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 11 Aug 2016 11:40:40 +0100 Subject: [PATCH] Make sure that we clear localstorage before *all* tests This was causing flaky tests, as sometimes the joining test would inherit an "mx_is_guest" setting from a previous test run. --- test/app-tests/loading.js | 2 -- test/test-utils.js | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index 898e5bf9..892ba852 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -59,8 +59,6 @@ describe('loading:', function () { windowLocation = null; matrixChat = null; - - window.localStorage.clear(); }); afterEach(function() { diff --git a/test/test-utils.js b/test/test-utils.js index ad58b805..53528e5c 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -12,6 +12,10 @@ module.exports.beforeEach = function(context) { console.log(); console.log(desc); console.log(new Array(1 + desc.length).join("=")); + + // some tests store things in localstorage. Improve independence of tests + // by making sure that they don't inherit any old state. + window.localStorage.clear(); }; /**