2018-08-07 18:58:58 +03:00
|
|
|
/*
|
|
|
|
Copyright 2018 New Vector Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
const signup = require('./tests/signup');
|
|
|
|
const join = require('./tests/join');
|
2018-08-08 13:17:36 +03:00
|
|
|
const sendMessage = require('./tests/send-message');
|
|
|
|
const receiveMessage = require('./tests/receive-message');
|
2018-08-07 18:58:58 +03:00
|
|
|
const createRoom = require('./tests/create-room');
|
2018-08-08 12:39:17 +03:00
|
|
|
const changeRoomSettings = require('./tests/room-settings');
|
2018-08-07 18:58:58 +03:00
|
|
|
const acceptServerNoticesInviteAndConsent = require('./tests/server-notices-consent');
|
|
|
|
|
|
|
|
module.exports = async function scenario(createSession) {
|
|
|
|
async function createUser(username) {
|
|
|
|
const session = await createSession(username);
|
|
|
|
await signup(session, session.username, 'testtest');
|
|
|
|
const noticesName = "Server Notices";
|
|
|
|
await acceptServerNoticesInviteAndConsent(session, noticesName);
|
|
|
|
return session;
|
|
|
|
}
|
|
|
|
|
|
|
|
const alice = await createUser("alice");
|
|
|
|
const bob = await createUser("bob");
|
|
|
|
const room = 'test';
|
|
|
|
await createRoom(alice, room);
|
2018-08-08 12:39:17 +03:00
|
|
|
await changeRoomSettings(alice, {directory: true, visibility: "public_no_guests"});
|
|
|
|
await join(bob, room);
|
2018-08-08 13:17:36 +03:00
|
|
|
await sendMessage(bob, "hi Alice!");
|
|
|
|
await receiveMessage(alice, {sender: "bob", body: "hi Alice!"});
|
2018-08-07 18:58:58 +03:00
|
|
|
}
|