diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index 892ba8526..03a4d11e1 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -16,6 +16,8 @@ limitations under the License. /* loading.js: test the myriad paths we have for loading the application */ +import 'skin-sdk'; + import React from 'react'; import ReactDOM from 'react-dom'; import ReactTestUtils from 'react-addons-test-utils'; @@ -152,6 +154,9 @@ describe('loading:', function () { }).respond(403, "Guest access is disabled"); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // we expect a single component ReactTestUtils.findRenderedComponentWithType( @@ -175,6 +180,9 @@ describe('loading:', function () { }).respond(403, "Guest access is disabled"); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // we expect a single component let login = ReactTestUtils.findRenderedComponentWithType( @@ -189,6 +197,9 @@ describe('loading:', function () { }); login.onPasswordLogin("user", "pass") return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // we expect a spinner ReactTestUtils.findRenderedComponentWithType( @@ -198,6 +209,9 @@ describe('loading:', function () { httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' }); httpBackend.when('GET', '/sync').respond(200, {}); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // once the sync completes, we should have a room view httpBackend.verifyNoOutstandingExpectation(); @@ -285,6 +299,9 @@ describe('loading:', function () { }); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // now we should have a spinner with a logout link assertAtSyncingSpinner(matrixChat); @@ -320,6 +337,9 @@ describe('loading:', function () { }); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // now we should have a spinner with a logout link assertAtSyncingSpinner(matrixChat); @@ -356,12 +376,18 @@ describe('loading:', function () { }); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // now we should have a spinner with a logout link assertAtSyncingSpinner(matrixChat); httpBackend.when('GET', '/sync').respond(200, {}); return httpBackend.flush(); + }).then(() => { + // Wait for another trip around the event loop for the UI to update + return q.delay(1); }).then(() => { // once the sync completes, we should have a room view httpBackend.verifyNoOutstandingExpectation();