fix app tests after force enabling lazy loading + removing feature flag

This commit is contained in:
Bruno Windels 2019-02-08 11:48:06 +00:00
parent 8630d0319d
commit 758723256e

View File

@ -172,12 +172,23 @@ describe('loading:', function() {
// http requests until we do. // http requests until we do.
// //
// returns a promise resolving to the received request // returns a promise resolving to the received request
async function expectAndAwaitSync(response) { async function expectAndAwaitSync(opts) {
response = response || {};
let syncRequest = null; let syncRequest = null;
const isGuest = opts && opts.isGuest;
if (!isGuest) {
httpBackend.when('GET', '/_matrix/client/versions')
.respond(200, {
"versions": ["r0.3.0"],
"unstable_features": {
"m.lazy_load_members": true
}
});
// the call to create the LL filter
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'llfid' });
}
httpBackend.when('GET', '/sync') httpBackend.when('GET', '/sync')
.check((r) => {syncRequest = r;}) .check((r) => {syncRequest = r;})
.respond(200, response); .respond(200, {});
for (let attempts = 10; attempts > 0; attempts--) { for (let attempts = 10; attempts > 0; attempts--) {
console.log(Date.now() + " waiting for /sync"); console.log(Date.now() + " waiting for /sync");
@ -404,7 +415,7 @@ describe('loading:', function() {
return awaitSyncingSpinner(matrixChat); return awaitSyncingSpinner(matrixChat);
}).then(() => { }).then(() => {
// we got a sync spinner - let the sync complete // we got a sync spinner - let the sync complete
return expectAndAwaitSync(); return expectAndAwaitSync({isGuest: true});
}).then(() => { }).then(() => {
// once the sync completes, we should have a home page // once the sync completes, we should have a home page
httpBackend.verifyNoOutstandingExpectation(); httpBackend.verifyNoOutstandingExpectation();
@ -434,7 +445,7 @@ describe('loading:', function() {
}).then(() => { }).then(() => {
return awaitSyncingSpinner(matrixChat); return awaitSyncingSpinner(matrixChat);
}).then(() => { }).then(() => {
return expectAndAwaitSync(); return expectAndAwaitSync({isGuest: true});
}).then((req) => { }).then((req) => {
expect(req.path).toStartWith(DEFAULT_HS_URL); expect(req.path).toStartWith(DEFAULT_HS_URL);
@ -468,7 +479,7 @@ describe('loading:', function() {
}).then(() => { }).then(() => {
return awaitSyncingSpinner(matrixChat); return awaitSyncingSpinner(matrixChat);
}).then(() => { }).then(() => {
return expectAndAwaitSync(); return expectAndAwaitSync({isGuest: true});
}).then(() => { }).then(() => {
// once the sync completes, we should have a room view // once the sync completes, we should have a room view
return awaitRoomView(matrixChat); return awaitRoomView(matrixChat);