2020-02-08 02:03:06 +08:00
|
|
|
const Page = require('../core/page');
|
2020-02-10 21:47:24 +08:00
|
|
|
const params = require('../params');
|
2020-02-20 01:28:27 +08:00
|
|
|
const util = require('../chat/util');
|
2020-02-08 02:03:06 +08:00
|
|
|
|
2020-02-13 04:18:41 +08:00
|
|
|
class MultiUsers {
|
2020-02-08 02:03:06 +08:00
|
|
|
constructor() {
|
2020-02-13 04:18:41 +08:00
|
|
|
this.page1 = new Page();
|
|
|
|
this.page2 = new Page();
|
2020-02-22 02:06:05 +08:00
|
|
|
this.page3 = new Page();
|
2020-02-08 02:03:06 +08:00
|
|
|
}
|
|
|
|
|
2020-02-13 04:18:41 +08:00
|
|
|
// Join BigBlueButton meeting
|
2020-02-13 21:32:03 +08:00
|
|
|
async init(meetingId) {
|
|
|
|
await this.page1.init(Page.getArgs(), meetingId, params);
|
|
|
|
await this.page2.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'User2' });
|
2020-02-08 02:03:06 +08:00
|
|
|
}
|
|
|
|
|
2020-02-11 06:09:17 +08:00
|
|
|
// Run the test for the page
|
|
|
|
async checkForOtherUser() {
|
2020-02-13 04:18:41 +08:00
|
|
|
const firstCheck = await this.page1.page.evaluate(() => document.querySelectorAll('[data-test="userListItem"]').length > 0);
|
|
|
|
const secondCheck = await this.page2.page.evaluate(() => document.querySelectorAll('[data-test="userListItem"]').length > 0);
|
|
|
|
return {
|
|
|
|
firstCheck,
|
|
|
|
secondCheck,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-02-20 01:28:27 +08:00
|
|
|
async multiUsersPublicChat() {
|
|
|
|
await util.sendPublicChatMessage(this.page1, this.page2);
|
|
|
|
const responsePublicMessage = await util.checkForPublicMessageReception(this.page1, this.page2);
|
|
|
|
const checkPublicChat = responsePublicMessage == true;
|
|
|
|
return checkPublicChat == true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async multiUsersPrivateChat() {
|
|
|
|
await util.openPrivateChatMessage(this.page1, this.page2);
|
|
|
|
await util.sendPrivateChatMessage(this.page1, this.page2);
|
|
|
|
const responsePrivateMessage = await util.checkForPrivateMessageReception(this.page1, this.page2);
|
|
|
|
const checkPrivateChat = responsePrivateMessage == true;
|
|
|
|
return checkPrivateChat == true;
|
|
|
|
}
|
|
|
|
|
2020-02-13 04:18:41 +08:00
|
|
|
async test() {
|
2020-02-19 01:18:55 +08:00
|
|
|
const checks = await this.checkForOtherUser();
|
2020-02-13 04:18:41 +08:00
|
|
|
return checks.firstCheck !== false && checks.secondCheck !== false;
|
2020-02-08 02:03:06 +08:00
|
|
|
}
|
2020-02-11 06:09:17 +08:00
|
|
|
|
|
|
|
// Close all Pages
|
2020-06-17 23:29:43 +08:00
|
|
|
async close(page1, page2) {
|
|
|
|
await page1.close();
|
|
|
|
await page2.close();
|
2020-02-11 06:09:17 +08:00
|
|
|
}
|
2020-03-21 04:31:58 +08:00
|
|
|
|
2020-03-23 20:15:10 +08:00
|
|
|
async closePage(page) {
|
|
|
|
await page.close();
|
2020-03-21 04:31:58 +08:00
|
|
|
}
|
2020-02-08 02:03:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = MultiUsers;
|