Skip to content

Commit c5b72f0

Browse files
author
Weblate
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 76f6a19 + b9b0e98 commit c5b72f0

1 file changed

Lines changed: 10 additions & 24 deletions

File tree

‎test/app-tests/joining.js‎

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,17 @@ describe('joining a room', function () {
100100
// wait for /sync to happen. This may take some time, as the client
101101
// has to initialise indexeddb.
102102
console.log("waiting for /sync");
103-
let syncDone = false;
104103
httpBackend.when('GET', '/sync')
105-
.check((r) => {syncDone = true;})
106104
.respond(200, {});
107-
function awaitSync(attempts) {
108-
if (syncDone) {
109-
return Promise.resolve();
110-
}
111-
if (!attempts) {
112-
throw new Error("Gave up waiting for /sync")
113-
}
114-
return httpBackend.flush().then(() => awaitSync(attempts-1));
115-
}
116105

117-
return awaitSync(10).then(() => {
106+
return httpBackend.flushAllExpected().then(() => {
118107
// wait for the directory requests
119108
httpBackend.when('POST', '/publicRooms').respond(200, {chunk: []});
120109
httpBackend.when('GET', '/thirdparty/protocols').respond(200, {});
121-
return Promise.all([
122-
httpBackend.flush('/thirdparty/protocols'),
123-
httpBackend.flush('/publicRooms'),
124-
]);
110+
return httpBackend.flushAllExpected();
125111
}).then(() => {
112+
console.log(`${Date.now()} App made requests for directory view; switching to a room.`);
113+
126114
var roomDir = ReactTestUtils.findRenderedComponentWithType(
127115
matrixChat, RoomDirectory);
128116

@@ -139,19 +127,17 @@ describe('joining a room', function () {
139127
httpBackend.when('GET', '/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync")
140128
.respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'});
141129

142-
return Promise.all([
143-
httpBackend.flush('/directory/room/'+encodeURIComponent(ROOM_ALIAS), 1, 200),
144-
httpBackend.flush('/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync", 1, 200),
145-
]);
130+
return httpBackend.flushAllExpected();
146131
}).then(() => {
147-
httpBackend.verifyNoOutstandingExpectation();
132+
console.log(`${Date.now()} App made room preview request`);
148133

149-
return Promise.delay(1);
150-
}).then(() => {
151-
// we should now have a roomview, with a preview bar
134+
// we should now have a roomview
152135
roomView = ReactTestUtils.findRenderedComponentWithType(
153136
matrixChat, RoomView);
154137

138+
// the preview bar may take a tick to be displayed
139+
return Promise.delay(1);
140+
}).then(() => {
155141
const previewBar = ReactTestUtils.findRenderedComponentWithType(
156142
roomView, RoomPreviewBar);
157143

0 commit comments

Comments
 (0)