bigbluebutton-Github/bigbluebutton-tests/playwright/audio/audio.js

78 lines
2.8 KiB
JavaScript
Raw Normal View History

2021-11-23 01:06:59 +08:00
const Page = require('../core/page');
const e = require('../core/elements');
2022-07-16 04:54:16 +08:00
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { connectMicrophone, isAudioItemSelected } = require('./util');
2021-11-23 01:06:59 +08:00
class Audio extends Page {
constructor(browser, page) {
super(browser, page);
}
async joinAudio() {
2022-03-29 21:53:07 +08:00
const { autoJoinAudioModal, listenOnlyCallTimeout } = this.settings;
if (!autoJoinAudioModal) await this.waitAndClick(e.joinAudio);
2021-11-23 01:06:59 +08:00
await this.waitAndClick(e.listenOnlyButton);
await this.waitForSelector(e.establishingAudioLabel);
await this.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
await this.waitForSelector(e.leaveListenOnly, listenOnlyCallTimeout);
await this.waitAndClick(e.audioDropdownMenu);
2022-01-29 03:52:22 +08:00
await this.hasElement(e.leaveAudio);
2021-11-23 01:06:59 +08:00
}
async joinMicrophone() {
2022-07-16 04:54:16 +08:00
await connectMicrophone(this);
await this.hasElement(e.muteMicButton);
await this.waitAndClick(e.audioDropdownMenu);
await this.hasElement(e.leaveAudio);
}
2022-03-29 21:53:07 +08:00
2022-07-16 04:54:16 +08:00
async muteYourselfByButton() {
await connectMicrophone(this);
await this.waitAndClick(e.muteMicButton);
await this.wasRemoved(e.isTalking);
await this.hasElement(e.wasTalking);
await this.wasRemoved(e.muteMicButton);
await this.hasElement(e.unmuteMicButton);
await this.wasRemoved(e.talkingIndicator, ELEMENT_WAIT_LONGER_TIME);
}
async changeAudioInput() {
await connectMicrophone(this);
await this.waitAndClick(e.audioDropdownMenu);
await isAudioItemSelected(this, e.defaultInputAudioDevice);
await this.waitAndClick(e.secondInputAudioDevice);
2022-01-29 03:52:22 +08:00
await this.hasElement(e.isTalking);
await this.hasElement(e.muteMicButton);
await this.waitAndClick(e.audioDropdownMenu);
2022-07-16 04:54:16 +08:00
await isAudioItemSelected(this, e.secondInputAudioDevice);
}
async keepMuteStateOnRejoin() {
await connectMicrophone(this);
await this.waitAndClick(e.muteMicButton);
await this.hasElement(e.wasTalking);
await this.wasRemoved(e.muteMicButton);
await this.hasElement(e.unmuteMicButton);
await this.waitAndClick(e.audioDropdownMenu);
await this.waitAndClick(e.leaveAudio);
await this.waitAndClick(e.joinAudio);
await this.waitAndClick(e.microphoneButton);
await this.waitAndClick(e.joinEchoTestButton);
await this.waitForSelector(e.establishingAudioLabel);
await this.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
await this.hasElement(e.unmuteMicButton);
}
async muteYourselfByTalkingIndicator() {
2022-07-16 04:54:16 +08:00
await connectMicrophone(this);
await this.waitAndClick(e.talkingIndicator);
await this.hasElement(e.wasTalking);
await this.wasRemoved(e.muteMicButton);
await this.hasElement(e.unmuteMicButton);
await this.wasRemoved(e.isTalking);
await this.wasRemoved(e.talkingIndicator, ELEMENT_WAIT_LONGER_TIME);
2021-11-23 01:06:59 +08:00
}
}
2021-12-04 01:01:36 +08:00
exports.Audio = Audio;