Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Weblate 2017-07-13 12:33:54 +00:00
commit c5b72f0192
1 changed files with 10 additions and 24 deletions

View File

@ -100,29 +100,17 @@ describe('joining a room', function () {
// wait for /sync to happen. This may take some time, as the client // wait for /sync to happen. This may take some time, as the client
// has to initialise indexeddb. // has to initialise indexeddb.
console.log("waiting for /sync"); console.log("waiting for /sync");
let syncDone = false;
httpBackend.when('GET', '/sync') httpBackend.when('GET', '/sync')
.check((r) => {syncDone = true;})
.respond(200, {}); .respond(200, {});
function awaitSync(attempts) {
if (syncDone) {
return Promise.resolve();
}
if (!attempts) {
throw new Error("Gave up waiting for /sync")
}
return httpBackend.flush().then(() => awaitSync(attempts-1));
}
return awaitSync(10).then(() => { return httpBackend.flushAllExpected().then(() => {
// wait for the directory requests // wait for the directory requests
httpBackend.when('POST', '/publicRooms').respond(200, {chunk: []}); httpBackend.when('POST', '/publicRooms').respond(200, {chunk: []});
httpBackend.when('GET', '/thirdparty/protocols').respond(200, {}); httpBackend.when('GET', '/thirdparty/protocols').respond(200, {});
return Promise.all([ return httpBackend.flushAllExpected();
httpBackend.flush('/thirdparty/protocols'),
httpBackend.flush('/publicRooms'),
]);
}).then(() => { }).then(() => {
console.log(`${Date.now()} App made requests for directory view; switching to a room.`);
var roomDir = ReactTestUtils.findRenderedComponentWithType( var roomDir = ReactTestUtils.findRenderedComponentWithType(
matrixChat, RoomDirectory); matrixChat, RoomDirectory);
@ -139,19 +127,17 @@ describe('joining a room', function () {
httpBackend.when('GET', '/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync") httpBackend.when('GET', '/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync")
.respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'}); .respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'});
return Promise.all([ return httpBackend.flushAllExpected();
httpBackend.flush('/directory/room/'+encodeURIComponent(ROOM_ALIAS), 1, 200),
httpBackend.flush('/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync", 1, 200),
]);
}).then(() => { }).then(() => {
httpBackend.verifyNoOutstandingExpectation(); console.log(`${Date.now()} App made room preview request`);
return Promise.delay(1); // we should now have a roomview
}).then(() => {
// we should now have a roomview, with a preview bar
roomView = ReactTestUtils.findRenderedComponentWithType( roomView = ReactTestUtils.findRenderedComponentWithType(
matrixChat, RoomView); matrixChat, RoomView);
// the preview bar may take a tick to be displayed
return Promise.delay(1);
}).then(() => {
const previewBar = ReactTestUtils.findRenderedComponentWithType( const previewBar = ReactTestUtils.findRenderedComponentWithType(
roomView, RoomPreviewBar); roomView, RoomPreviewBar);