bigbluebutton-Github/bigbluebutton-tests/playwright/audio/audio.js
2022-03-29 10:53:07 -03:00

42 lines
1.4 KiB
JavaScript

const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require('../core/constants');
class Audio extends Page {
constructor(browser, page) {
super(browser, page);
}
async joinAudio() {
const { autoJoinAudioModal, listenOnlyCallTimeout } = this.settings;
if (!autoJoinAudioModal) await this.waitAndClick(e.joinAudio);
await this.waitAndClick(e.listenOnlyButton);
await this.wasRemoved(e.connecting);
await this.waitForSelector(e.leaveAudio, listenOnlyCallTimeout);
await this.waitForSelector(e.whiteboard);
await this.hasElement(e.leaveAudio);
}
async joinMicrophone() {
const {
autoJoinAudioModal,
skipEchoTest,
skipEchoTestOnJoin,
listenOnlyCallTimeout,
} = this.settings;
if (!autoJoinAudioModal) await this.waitAndClick(e.joinAudio);
await this.waitAndClick(e.microphoneButton);
const shouldSkipEchoTest = skipEchoTest || skipEchoTestOnJoin;
if (!shouldSkipEchoTest) {
await this.waitForSelector(e.connectingToEchoTest);
await this.wasRemoved(e.connectingToEchoTest, ELEMENT_WAIT_LONGER_TIME);
await this.waitAndClick(e.echoYesButton, listenOnlyCallTimeout);
}
await this.waitForSelector(e.whiteboard, shouldSkipEchoTest ? listenOnlyCallTimeout : ELEMENT_WAIT_TIME);
await this.hasElement(e.isTalking);
}
}
exports.Audio = Audio;