-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathbefore-after-bot-created-room.js
More file actions
36 lines (32 loc) · 1.2 KB
/
before-after-bot-created-room.js
File metadata and controls
36 lines (32 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Common Before and After logic for the initial test room
let common = require('../common/common');
let framework = common.framework;
let testInfo = common.testInfo;
let when = common.when;
module.exports = {
registerBeforeAndAfterHooks: function() {
let botCreatedTestRoom, botCreatedRoomBot;
// Create a room as user to have test bot which will create other rooms
before('Bot creates new room test', () => {
testInfo.config.testName = 'Bot creates new room test';
return common.botCreateSpace(framework, testInfo)
.then((b) => {
botCreatedRoomBot = b;
testInfo.config.botUnderTest = b;
botCreatedTestRoom = b.room;
testInfo.config.roomUnderTest = b.room;
return when(botCreatedRoomBot);
});
});
// Bot deletes room
after('bot deletes room it created',() => {
if ((!botCreatedRoomBot) || (!botCreatedTestRoom)) {
return Promise.resolve();
}
testInfo.config.testName = 'bot deletes room it created';
testInfo.config.botUnderTest = botCreatedRoomBot;
testInfo.config.roomUnderTest = botCreatedTestRoom;
return common.botDeletesSpace(framework, testInfo);
});
}
};