bigbluebutton-Github/bigbluebutton-tests/puppeteer/user/status.js

87 lines
2.6 KiB
JavaScript
Raw Normal View History

const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
2018-11-23 20:55:16 +08:00
const Page = require('../core/page');
const e = require('../core/elements');
2018-11-23 20:55:16 +08:00
const util = require('./util');
const utilScreenshare = require('../screenshare/util');
const { sleep } = require('../core/helper');
2021-10-07 22:29:18 +08:00
const { checkElementLengthEqualTo } = require('../core/util');
2018-11-23 20:55:16 +08:00
class Status extends Page {
constructor() {
2021-09-23 03:22:47 +08:00
super();
2018-11-23 20:55:16 +08:00
}
async test() {
try {
await util.setStatus(this, e.applaud);
2021-10-07 22:29:18 +08:00
const resp1 = await this.hasElement(e.applauseIcon);
await sleep(1000);
await util.setStatus(this, e.away);
2021-10-07 22:29:18 +08:00
const resp2 = await this.hasElement(e.awayIcon);
2018-11-23 20:55:16 +08:00
return resp1 === resp2;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
2018-11-23 20:55:16 +08:00
}
2021-04-02 08:54:55 +08:00
async mobileTagName() {
try {
await this.waitAndClick(e.userList);
await this.waitForSelector(e.firstUser);
2021-04-02 08:54:55 +08:00
2021-10-07 22:29:18 +08:00
const response = await this.hasElement(e.mobileUser);
return response === true;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
2021-04-02 08:54:55 +08:00
}
async findConnectionStatusModal() {
try {
await util.connectionStatus(this);
2021-10-07 22:29:18 +08:00
const resp = await this.hasElement(e.connectionStatusModal);
return resp === true;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
async disableScreenshareFromConnectionStatus() {
try {
await utilScreenshare.startScreenshare(this);
await util.connectionStatus(this);
await this.waitAndClickElement(e.dataSavingScreenshare);
await this.waitAndClickElement(e.closeConnectionStatusModal);
2021-10-07 22:29:18 +08:00
const webcamsIsDisabledInDataSaving = await this.hasElement(e.screenshareLocked);
return webcamsIsDisabledInDataSaving === true;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
2018-11-23 20:55:16 +08:00
async reportUserInConnectionIssues() {
try {
await this.page.evaluate(() => window.dispatchEvent(new CustomEvent('socketstats', { detail: { rtt: 2000 } })));
await this.joinMicrophone();
2021-10-07 22:29:18 +08:00
await this.shareWebcam(true, ELEMENT_WAIT_LONGER_TIME);
await utilScreenshare.startScreenshare(this);
await util.connectionStatus(this);
await sleep(5000);
2021-08-21 04:33:57 +08:00
const connectionStatusItemEmpty = await this.page.evaluate(checkElementLengthEqualTo, e.connectionStatusItemEmpty, 0);
2021-10-07 22:29:18 +08:00
const connectionStatusItemUser = await this.hasElement(e.connectionStatusItemUser);
return connectionStatusItemUser && connectionStatusItemEmpty;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
}
2018-11-23 20:55:16 +08:00
module.exports = exports = Status;