Skip to content

Commit 8097b15

Browse files
authored
Merge pull request #2730 from vector-im/dbkr/fix_test_breakage
Fix broken tests
2 parents b06cff7 + 67cf423 commit 8097b15

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/app-tests/loading.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ describe('loading:', function () {
154154
}).respond(403, "Guest access is disabled");
155155

156156
return httpBackend.flush();
157+
}).then(() => {
158+
// Wait for another trip around the event loop for the UI to update
159+
return q.delay(1);
157160
}).then(() => {
158161
// we expect a single <Login> component
159162
ReactTestUtils.findRenderedComponentWithType(
@@ -177,6 +180,9 @@ describe('loading:', function () {
177180
}).respond(403, "Guest access is disabled");
178181

179182
return httpBackend.flush();
183+
}).then(() => {
184+
// Wait for another trip around the event loop for the UI to update
185+
return q.delay(1);
180186
}).then(() => {
181187
// we expect a single <Login> component
182188
let login = ReactTestUtils.findRenderedComponentWithType(
@@ -191,6 +197,9 @@ describe('loading:', function () {
191197
});
192198
login.onPasswordLogin("user", "pass")
193199
return httpBackend.flush();
200+
}).then(() => {
201+
// Wait for another trip around the event loop for the UI to update
202+
return q.delay(1);
194203
}).then(() => {
195204
// we expect a spinner
196205
ReactTestUtils.findRenderedComponentWithType(
@@ -200,6 +209,9 @@ describe('loading:', function () {
200209
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });
201210
httpBackend.when('GET', '/sync').respond(200, {});
202211
return httpBackend.flush();
212+
}).then(() => {
213+
// Wait for another trip around the event loop for the UI to update
214+
return q.delay(1);
203215
}).then(() => {
204216
// once the sync completes, we should have a room view
205217
httpBackend.verifyNoOutstandingExpectation();
@@ -287,6 +299,9 @@ describe('loading:', function () {
287299
});
288300

289301
return httpBackend.flush();
302+
}).then(() => {
303+
// Wait for another trip around the event loop for the UI to update
304+
return q.delay(1);
290305
}).then(() => {
291306
// now we should have a spinner with a logout link
292307
assertAtSyncingSpinner(matrixChat);
@@ -322,6 +337,9 @@ describe('loading:', function () {
322337
});
323338

324339
return httpBackend.flush();
340+
}).then(() => {
341+
// Wait for another trip around the event loop for the UI to update
342+
return q.delay(1);
325343
}).then(() => {
326344
// now we should have a spinner with a logout link
327345
assertAtSyncingSpinner(matrixChat);
@@ -358,12 +376,18 @@ describe('loading:', function () {
358376
});
359377

360378
return httpBackend.flush();
379+
}).then(() => {
380+
// Wait for another trip around the event loop for the UI to update
381+
return q.delay(1);
361382
}).then(() => {
362383
// now we should have a spinner with a logout link
363384
assertAtSyncingSpinner(matrixChat);
364385

365386
httpBackend.when('GET', '/sync').respond(200, {});
366387
return httpBackend.flush();
388+
}).then(() => {
389+
// Wait for another trip around the event loop for the UI to update
390+
return q.delay(1);
367391
}).then(() => {
368392
// once the sync completes, we should have a room view
369393
httpBackend.verifyNoOutstandingExpectation();

0 commit comments

Comments
 (0)