create second user and join room first user creates

This commit is contained in:
Bruno Windels 2018-08-07 17:23:01 +02:00
parent 4c0ab117bf
commit 5fe3861190

View file

@ -27,6 +27,21 @@ const riotserver = 'http://localhost:5000';
let sessions = []; let sessions = [];
async function createUser(username, options, riotserver) {
const session = await RiotSession.create(username, options, riotserver);
sessions.push(session);
session.log.step("signs up");
await signup(session, session.username, 'testtest');
session.log.done();
const noticesName = "Server Notices";
session.log.step(`accepts "${noticesName}" invite and accepting terms & conditions`);
await acceptServerNoticesInviteAndConsent(session, noticesName);
session.log.done();
return session;
}
async function runTests() { async function runTests() {
console.log("running tests ..."); console.log("running tests ...");
const options = {}; const options = {};
@ -36,24 +51,21 @@ async function runTests() {
options.executablePath = path; options.executablePath = path;
} }
const alice = await RiotSession.create("alice", options, riotserver); const alice = await createUser("alice", options, riotserver);
sessions.push(alice); const bob = await createUser("bob", options, riotserver);
alice.log.step("signs up");
await signup(alice, alice.username, 'testtest');
alice.log.done();
const noticesName = "Server Notices";
alice.log.step(`accepts "${noticesName}" invite and accepting terms & conditions`);
await acceptServerNoticesInviteAndConsent(alice, noticesName);
alice.log.done();
const room = 'test'; const room = 'test';
alice.log.step(`creates room ${room}`); alice.log.step(`creates room ${room}`);
await createRoom(alice, room); await createRoom(alice, room);
alice.log.done(); alice.log.done();
bob.log.step(`joins room ${room}`);
await createRoom(bob, room);
bob.log.done();
await alice.close(); await alice.close();
await bob.close();
} }
function onSuccess() { function onSuccess() {