bigbluebutton-Github/bigbluebutton-tests/playwright/virtualizedlist/virtualize.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

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' });
await this.page1.waitForSelector(e.anyUser);
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() {
const USER_LIST_VLIST_VISIBLE_USERS = await this.page1.getSelectorCount(e.anyUser);
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;