move range and delay over to util module

This commit is contained in:
Bruno Windels
2018-09-12 18:38:42 +02:00
parent 5745e9ed0c
commit 923ae90576
3 changed files with 32 additions and 11 deletions
+3 -10
View File
@@ -21,6 +21,7 @@ const join = require('./tests/join');
const sendMessage = require('./tests/send-message');
const acceptInvite = require('./tests/accept-invite');
const invite = require('./tests/invite');
const {delay, range} = require('./util');
const {
receiveMessage,
checkTimelineContains,
@@ -49,14 +50,6 @@ module.exports = async function scenario(createSession, restCreator) {
await aLazyLoadingTest(alice, bob, charlies);
}
function range(start, amount, step = 1) {
const r = [];
for (let i = 0; i < amount; ++i) {
r.push(start + (i * step));
}
return r;
}
async function createRestUsers(restCreator) {
const usernames = range(1, 10).map((i) => `charly-${i}`);
const charlies = await restCreator.createSessionRange(usernames, 'testtest');
@@ -88,12 +81,12 @@ async function createE2ERoomAndTalk(alice, bob) {
const bobDevice = await getE2EDeviceFromSettings(bob);
// wait some time for the encryption warning dialog
// to appear after closing the settings
await bob.delay(1000);
await delay(1000);
await acceptDialogMaybe(bob, "encryption");
const aliceDevice = await getE2EDeviceFromSettings(alice);
// wait some time for the encryption warning dialog
// to appear after closing the settings
await alice.delay(1000);
await delay(1000);
await acceptDialogMaybe(alice, "encryption");
await verifyDeviceForUser(bob, "alice", aliceDevice);
await verifyDeviceForUser(alice, "bob", bobDevice);