Merge pull request #4313 from vector-im/rav/deflakify_joining_test

Attempts to deflakify the joining test
This commit is contained in:
Richard van der Hoff 2017-06-15 16:29:37 +01:00 committed by GitHub
commit 584e4c04da
2 changed files with 28 additions and 29 deletions

View file

@ -68,7 +68,7 @@ describe('joining a room', function () {
}
});
it('should not get stuck at a spinner', function(done) {
it('should not get stuck at a spinner', function() {
var ROOM_ALIAS = '#alias:localhost';
var ROOM_ID = '!id:localhost';
@ -119,8 +119,8 @@ describe('joining a room', function () {
httpBackend.when('POST', '/publicRooms').respond(200, {chunk: []});
httpBackend.when('GET', '/thirdparty/protocols').respond(200, {});
return q.all([
httpBackend.flush('/publicRooms'),
httpBackend.flush('/thirdparty/protocols'),
httpBackend.flush('/publicRooms'),
]);
}).then(() => {
var roomDir = ReactTestUtils.findRenderedComponentWithType(
@ -140,12 +140,14 @@ describe('joining a room', function () {
.respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'});
return q.all([
httpBackend.flush('/directory/room/'+encodeURIComponent(ROOM_ALIAS)),
httpBackend.flush('/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync"),
httpBackend.flush('/directory/room/'+encodeURIComponent(ROOM_ALIAS), 1, 200),
httpBackend.flush('/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync", 1, 200),
]);
}).then(() => {
httpBackend.verifyNoOutstandingExpectation();
return q.delay(1);
}).then(() => {
// we should now have a roomview, with a preview bar
roomView = ReactTestUtils.findRenderedComponentWithType(
matrixChat, RoomView);
@ -208,7 +210,7 @@ describe('joining a room', function () {
}).then(() => {
// now the room should have loaded
expect(roomView.state.room).toExist();
}).done(done, done);
});
});
});
});