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

136 lines
5.6 KiB
JavaScript
Raw Normal View History

2021-11-23 01:06:59 +08:00
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');
2023-05-16 20:51:25 +08:00
const { MultiUsers } = require('../user/multiusers');
const { generateSettingsData } = require('../core/settings');
2023-05-19 22:22:51 +08:00
const { expect } = require('@playwright/test');
2021-11-23 01:06:59 +08:00
2023-05-16 20:51:25 +08:00
class Audio extends MultiUsers {
constructor(browser, context) {
super(browser, context);
2021-11-23 01:06:59 +08:00
}
async joinAudio() {
2023-05-16 20:51:25 +08:00
this.modPage.settings = await generateSettingsData(this.modPage);
const { autoJoinAudioModal, listenOnlyCallTimeout } = this.modPage.settings;
2023-05-23 21:43:08 +08:00
if (!autoJoinAudioModal) await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.joinAudio);
2023-05-16 20:51:25 +08:00
await this.modPage.waitAndClick(e.listenOnlyButton);
await this.modPage.waitForSelector(e.establishingAudioLabel);
await this.modPage.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.waitForSelector(e.leaveListenOnly, listenOnlyCallTimeout);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.hasElement(e.leaveAudio);
await this.modPage.waitAndClick(e.leaveAudio);
2021-11-23 01:06:59 +08:00
}
async joinMicrophone() {
2023-05-23 21:43:08 +08:00
await this.modPage.waitAndClick(e.joinAudio);
await connectMicrophone(this.modPage);
2023-05-19 22:22:51 +08:00
2023-05-16 20:51:25 +08:00
await this.modPage.hasElement(e.muteMicButton);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.hasElement(e.leaveAudio);
await this.modPage.waitAndClick(e.leaveAudio);
2022-07-16 04:54:16 +08:00
}
2022-03-29 21:53:07 +08:00
2022-07-16 04:54:16 +08:00
async muteYourselfByButton() {
2023-05-23 21:43:08 +08:00
await this.modPage.waitAndClick(e.joinAudio);
await connectMicrophone(this.modPage);
2023-05-18 20:39:06 +08:00
2023-08-23 04:25:50 +08:00
await this.modPage.hasElement(e.isTalking);
2023-05-16 20:51:25 +08:00
await this.modPage.waitAndClick(e.muteMicButton);
await this.modPage.wasRemoved(e.isTalking);
await this.modPage.hasElement(e.wasTalking);
await this.modPage.wasRemoved(e.muteMicButton);
await this.modPage.hasElement(e.unmuteMicButton);
await this.modPage.wasRemoved(e.talkingIndicator, ELEMENT_WAIT_LONGER_TIME);
2023-05-18 20:39:06 +08:00
await this.modPage.waitAndClick(e.unmuteMicButton);
2023-05-16 20:51:25 +08:00
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.waitAndClick(e.leaveAudio);
2022-07-16 04:54:16 +08:00
}
async changeAudioInput() {
2023-05-23 21:43:08 +08:00
await this.modPage.waitAndClick(e.joinAudio);
await connectMicrophone(this.modPage);
2023-05-16 20:51:25 +08:00
await this.modPage.waitAndClick(e.audioDropdownMenu);
await isAudioItemSelected(this.modPage, e.defaultInputAudioDevice);
await this.modPage.waitAndClick(e.secondInputAudioDevice);
await this.modPage.hasElement(e.isTalking);
await this.modPage.hasElement(e.muteMicButton);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await isAudioItemSelected(this.modPage, e.secondInputAudioDevice);
2023-05-18 20:39:06 +08:00
await this.modPage.waitAndClick(e.leaveAudio);
2022-07-16 04:54:16 +08:00
}
async keepMuteStateOnRejoin() {
2023-05-23 21:43:08 +08:00
await this.modPage.waitAndClick(e.joinAudio);
await connectMicrophone(this.modPage);
const isMuted = await this.modPage.checkElement(e.unmuteMicButton);
if (isMuted) {
await this.modPage.waitAndClick(e.unmuteMicButton);
await this.modPage.hasElement(e.isTalking);
}
2023-08-23 04:25:50 +08:00
await this.modPage.hasElement(e.isTalking);
2023-05-18 20:39:06 +08:00
await this.modPage.waitAndClick(e.muteMicButton);
await this.modPage.hasElement(e.wasTalking);
await this.modPage.wasRemoved(e.muteMicButton);
await this.modPage.hasElement(e.unmuteMicButton);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.waitAndClick(e.leaveAudio);
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.microphoneButton);
await this.modPage.waitAndClick(e.joinEchoTestButton);
await this.modPage.waitForSelector(e.establishingAudioLabel);
await this.modPage.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.hasElement(e.unmuteMicButton);
2023-05-19 22:22:51 +08:00
await this.modPage.waitAndClick(e.unmuteMicButton);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.waitAndClick(e.leaveAudio);
2022-07-16 04:54:16 +08:00
}
async muteYourselfByTalkingIndicator() {
2023-05-23 21:43:08 +08:00
await this.modPage.waitAndClick(e.joinAudio);
await connectMicrophone(this.modPage);
const isMuted = await this.modPage.checkElement(e.unmuteMicButton);
if (isMuted) {
await this.modPage.waitAndClick(e.unmuteMicButton);
await this.modPage.hasElement(e.isTalking);
}
2023-05-19 22:22:51 +08:00
await this.modPage.waitAndClick(e.talkingIndicator);
await this.modPage.hasElement(e.wasTalking);
2023-08-23 04:25:50 +08:00
await this.modPage.hasElement(e.wasTalking);
2023-05-19 22:22:51 +08:00
await this.modPage.wasRemoved(e.muteMicButton);
await this.modPage.hasElement(e.unmuteMicButton);
await this.modPage.wasRemoved(e.isTalking);
await this.modPage.wasRemoved(e.talkingIndicator, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.waitAndClick(e.leaveAudio);
}
async muteAnotherUser() {
2023-05-23 21:43:08 +08:00
await this.modPage.waitAndClick(e.joinAudio);
await connectMicrophone(this.modPage);
await this.userPage.waitAndClick(e.joinAudio);
await this.userPage.joinMicrophone();
2023-05-19 22:22:51 +08:00
await this.userPage.waitAndClick(e.muteMicButton);
await this.modPage.waitAndClick(e.isTalking);
await this.userPage.hasElement(e.unmuteMicButton);
const moderatorWasTalkingLocator = await this.modPage.getLocator(e.wasTalking).first();
const userWasTalkingLocator = await this.userPage.getLocator(e.wasTalking).last();
await expect(moderatorWasTalkingLocator).toBeVisible();
await expect(userWasTalkingLocator).toBeVisible();
await this.userPage.wasRemoved(e.talkingIndicator, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.wasRemoved(e.talkingIndicator);
2021-11-23 01:06:59 +08:00
}
}
2021-12-04 01:01:36 +08:00
exports.Audio = Audio;