2021-12-02 12:12:14 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
2021-12-02 02:10:05 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const e = require('../core/elements');
|
|
|
|
const { USER_LIST_VLIST_BOTS_LISTENING } = require('../core/constants');
|
|
|
|
|
|
|
|
class VirtualizeList {
|
|
|
|
constructor(browser, page) {
|
|
|
|
this.page1 = new Page(browser, page);
|
|
|
|
this.browser = browser;
|
|
|
|
this.pagesArray = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Join BigBlueButton meeting
|
|
|
|
async init() {
|
|
|
|
await this.page1.init(true, true, { fullName: 'BroadCaster1' });
|
2023-02-14 21:59:46 +08:00
|
|
|
await this.page1.waitForSelector(e.currentUser);
|
2021-12-02 02:10:05 +08:00
|
|
|
for (let i = 1; i <= parseInt(USER_LIST_VLIST_BOTS_LISTENING); i++) {
|
|
|
|
const newPage = await this.browser.newPage();
|
|
|
|
const viewerPage = new Page(this.browser, newPage);
|
|
|
|
const fullName = `Viewer-${i}`;
|
|
|
|
await viewerPage.init(false, true, { fullName, meetingId: this.page1.meetingId });
|
|
|
|
|
|
|
|
console.log(`${fullName} joined`);
|
2021-12-02 13:30:38 +08:00
|
|
|
this.pagesArray.push(viewerPage);
|
2021-12-02 02:10:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async test() {
|
2022-04-21 19:19:08 +08:00
|
|
|
const USER_LIST_VLIST_VISIBLE_USERS = await this.page1.getSelectorCount(e.userListItem);
|
2021-12-02 02:10:05 +08:00
|
|
|
const totalNumberOfUsersMongo = await this.page1.page.evaluate(() => {
|
|
|
|
const collection = require('/imports/api/users/index.js');
|
|
|
|
return collection.default._collection.find().count();
|
|
|
|
});
|
|
|
|
await expect(USER_LIST_VLIST_VISIBLE_USERS).toBeLessThan(totalNumberOfUsersMongo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-04 01:01:36 +08:00
|
|
|
exports.VirtualizeList = VirtualizeList;
|