Test if members joining while user is offline are received after returning online with LL enabled

This commit is contained in:
Bruno Windels 2018-09-14 12:44:01 +02:00
parent 6deb595fec
commit 16b2f09915
3 changed files with 33 additions and 5 deletions

View File

@ -25,7 +25,7 @@ module.exports = class RestMultiSession {
this.sessions = sessions; this.sessions = sessions;
} }
slice(start, end, groupName) { slice(groupName, start, end) {
return new RestMultiSession(this.sessions.slice(start, end), groupName); return new RestMultiSession(this.sessions.slice(start, end), groupName);
} }

View File

@ -31,9 +31,15 @@ const assert = require('assert');
module.exports = async function lazyLoadingScenarios(alice, bob, charlies) { module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
console.log(" creating a room for lazy loading member scenarios:"); console.log(" creating a room for lazy loading member scenarios:");
await enableLazyLoading(alice); await enableLazyLoading(alice);
await setupRoomWithBobAliceAndCharlies(alice, bob, charlies); const charly1to5 = charlies.slice("charly-1..5", 0, 5);
await checkPaginatedDisplayNames(alice, charlies); const charly6to10 = charlies.slice("charly-6..10", 5);
await checkMemberList(alice, charlies); assert(charly1to5.sessions.length, 5);
assert(charly6to10.sessions.length, 5);
await setupRoomWithBobAliceAndCharlies(alice, bob, charly1to5);
await checkPaginatedDisplayNames(alice, charly1to5);
await checkMemberList(alice, charly1to5);
await joinCharliesWhileAliceIsOffline(alice, charly6to10);
await checkMemberList(alice, charly6to10);
} }
const room = "Lazy Loading Test"; const room = "Lazy Loading Test";
@ -70,7 +76,7 @@ async function checkPaginatedDisplayNames(alice, charlies) {
}); });
}, messages); }, messages);
}, []); }, []);
await checkTimelineContains(alice, expectedMessages, "Charly #1-10"); await checkTimelineContains(alice, expectedMessages, "Charly #1-5");
} }
async function checkMemberList(alice, charlies) { async function checkMemberList(alice, charlies) {
@ -85,3 +91,18 @@ async function checkMemberList(alice, charlies) {
}); });
alice.log.done(); alice.log.done();
} }
async function joinCharliesWhileAliceIsOffline(alice, charly6to10) {
await alice.setOffline(true);
await delay(1000);
const members6to10 = await charly6to10.join(alias);
const member6 = members6to10.rooms[0];
member6.log.step("sends 20 messages").mute();
for(let i = 20; i >= 1; --i) {
await member6.talk("where is charly?");
}
member6.log.unmute().done();
await delay(1000);
await alice.setOffline(false);
await delay(1000);
}

View File

@ -173,6 +173,13 @@ module.exports = class RiotSession {
return delay(ms); return delay(ms);
} }
async setOffline(enabled) {
const description = enabled ? "offline" : "back online";
this.log.step(`goes ${description}`);
await this.page.setOfflineMode(enabled);
this.log.done();
}
close() { close() {
return this.browser.close(); return this.browser.close();
} }