bigbluebutton-Github/bigbluebutton-tests/puppeteer/audio/util.js
2021-09-22 10:23:51 -03:00

29 lines
1.2 KiB
JavaScript

const e = require('../core/elements');
const { getElementLength } = require('../core/util');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
async function joinAudio(test) {
await test.waitAndClick(e.listenOnlyButton);
await test.waitForElementHandleToBeRemoved(e.connectingStatus);
const parsedSettings = await test.getSettingsYaml();
const listenOnlyCallTimeout = parseInt(parsedSettings.public.media.listenOnlyCallTimeout);
await test.waitForSelector(e.leaveAudio, listenOnlyCallTimeout);
await test.waitForSelector(e.whiteboard);
const resp = await test.page.evaluate(getElementLength, e.leaveAudio) >= 1;
return resp;
}
async function joinMicrophone(test) {
await test.waitAndClick(e.microphoneButton);
await test.waitForElementHandleToBeRemoved(e.connectingStatus, ELEMENT_WAIT_LONGER_TIME);
const parsedSettings = await test.getSettingsYaml();
const listenOnlyCallTimeout = parseInt(parsedSettings.public.media.listenOnlyCallTimeout);
await test.waitAndClick(e.echoYesButton, listenOnlyCallTimeout);
await test.waitForSelector(e.whiteboard);
const resp = await test.page.evaluate(getElementLength, e.echoYesButton) >= 1;
return resp;
}
exports.joinAudio = joinAudio;
exports.joinMicrophone = joinMicrophone;