bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/audio/util.js
Mohamed Amine Ben Salah d8c5aa46d9
multiple automated tests suites updates + add missing polling specs and move them with old ones to a polling test suite (#10766)
* updating old tests + collecting more snapshots [WIP]

* updates old test suites and collects more visual regressions screenshots

* remove snapshots and their collection temporary

* run tests from packages.json

* update test execution command/export constants from .env to core/constants.js

* update tests/puppeteer/README.md file

* update LOOP_INTERVAL variable call and assign timeouts to the webcam share spec

* redefine waitForSelector func in page.js, update chat test suite specs and add poll chat message test spec

* Merge remote-tracking branch 'upstream/develop' into updating-old-tests-visual-with-visual-regressions

* update webcam test specs collecting videoPreviewTimeout and use it to wait for videoPreview selector

* update custom parameters test suite

* update breakout test suite

* update webcam layout test suite

* update multiusers test suite

* update notifications test suite

* update presentation test suite

* whiteboard test suite

* screenshare test suite

* update sharednotes test suite

* user ELEMENT_WAIT_TIME variable from timeouts constants.js

* list TEST CONSTANTS by category

* add poll test suite and assigns the right unassigned timeouts

* set test pages to headless
2021-02-16 15:57:10 -05:00

45 lines
1.9 KiB
JavaScript

const ae = require('./elements');
const { ELEMENT_WAIT_TIME } = require('../core/constants');
async function joinAudio(test) {
await test.waitForSelector(ae.joinAudio, ELEMENT_WAIT_TIME);
await test.page.evaluate(clickTestElement, ae.joinAudio);
await test.waitForSelector(ae.listen, ELEMENT_WAIT_TIME);
await test.page.evaluate(clickTestElement, ae.listen);
await test.waitForSelector(ae.connectingStatus, ELEMENT_WAIT_TIME);
await test.elementRemoved(ae.connectingStatus);
const parsedSettings = await test.getSettingsYaml();
const listenOnlyCallTimeout = parseInt(parsedSettings.public.media.listenOnlyCallTimeout);
await test.waitForSelector(ae.leaveAudio, listenOnlyCallTimeout);
await test.waitForSelector(ae.whiteboard, ELEMENT_WAIT_TIME);
const resp = await test.page.evaluate(getTestElement, ae.leaveAudio);
return resp;
}
async function joinMicrophone(test) {
await test.waitForSelector(ae.joinAudio, ELEMENT_WAIT_TIME);
await test.page.evaluate(clickTestElement, ae.joinAudio);
await test.waitForSelector(ae.microphone, ELEMENT_WAIT_TIME);
await test.page.evaluate(clickTestElement, ae.microphone);
await test.waitForSelector(ae.connectingStatus, ELEMENT_WAIT_TIME);
await test.elementRemoved(ae.connectingStatus);
const parsedSettings = await test.getSettingsYaml();
const listenOnlyCallTimeout = parseInt(parsedSettings.public.media.listenOnlyCallTimeout);
await test.waitForSelector(ae.audioAudible, listenOnlyCallTimeout);
await test.click(ae.audioAudible, true);
await test.waitForSelector(ae.whiteboard, ELEMENT_WAIT_TIME);
const resp = await test.page.evaluate(getTestElement, ae.audioAudible);
return resp;
}
async function clickTestElement(element) {
document.querySelectorAll(element)[0].click();
}
async function getTestElement(element) {
return document.querySelectorAll(element).length >= 1 === true;
}
exports.joinAudio = joinAudio;
exports.joinMicrophone = joinMicrophone;