bigbluebutton-Github/bigbluebutton-tests/playwright/user/guestPolicy.js

115 lines
5.6 KiB
JavaScript
Raw Normal View History

2022-01-20 03:50:59 +08:00
const { MultiUsers } = require("./multiusers");
const e = require('../core/elements');
const { sleep } = require('../core/helpers');
2022-02-04 04:10:26 +08:00
const { setGuestPolicyOption } = require("./util");
2022-10-11 01:47:44 +08:00
const { ELEMENT_WAIT_LONGER_TIME } = require("../core/constants");
2022-01-20 03:50:59 +08:00
class GuestPolicy extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
2022-10-11 01:47:44 +08:00
async messageToGuestLobby() {
2022-02-04 04:10:26 +08:00
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
await this.modPage.hasElement(e.waitingUsersBtn, 'should display the waiting users button');
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.type(e.waitingUsersLobbyMessage, 'test');
await this.modPage.waitAndClick(e.sendLobbyMessage);
await this.modPage.hasText(e.lobbyMessage, /test/, 'should the lobby message contain the text "test"');
2022-10-11 01:47:44 +08:00
}
async allowEveryone() {
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
await this.userPage.hasText(e.guestMessage, /wait/, 'should the guest message contain the text "wait" for the attendee');
await this.userPage.hasText(e.positionInWaitingQueue, /first/, 'should the position in waiting queue contain the text "first" for the attendee');
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.waitAndClick(e.allowEveryone);
await this.userPage.hasText(e.guestMessage, /approved/, 'should the guest message contain the text "approved" for the attendee', ELEMENT_WAIT_LONGER_TIME);
await this.modPage.hasElement(e.viewerAvatar, 'should display the viewer avatar for the moderator', ELEMENT_WAIT_LONGER_TIME);
await this.userPage.hasElement(e.audioModal, 'should display the audio modal for the attendee');
2022-10-11 01:47:44 +08:00
}
async denyEveryone() {
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.waitAndClick(e.denyEveryone);
await this.userPage.hasText(e.guestMessage, /denied/, 'should the guest message contain the text "denied" for the attendee',ELEMENT_WAIT_LONGER_TIME);
2022-10-11 01:47:44 +08:00
}
async rememberChoice() {
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.waitAndClick(e.rememberCheckboxId);
await this.modPage.hasElementEnabled(e.rememberCheckboxId, 'should display the remember checkbox id as enabled');
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.denyEveryone);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
await this.userPage.hasElement(e.deniedMessageElement, 'should display the denied message for the attendee');
2022-10-11 01:47:44 +08:00
}
async messageToSpecificUser() {
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.waitAndClick(e.privateMessageGuest);
await this.modPage.type(e.inputPrivateLobbyMesssage, 'test');
await this.modPage.waitAndClick(e.sendPrivateLobbyMessage);
await this.userPage.hasText(e.guestMessage, /test/, 'should the guest message contain the text "test" for the attendee', ELEMENT_WAIT_LONGER_TIME);
2022-10-11 01:47:44 +08:00
}
async acceptSpecificUser() {
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
await this.userPage.hasText(e.guestMessage, /wait/, 'should the guest message contain the text "wait" for the attendee');
await this.userPage.hasText(e.positionInWaitingQueue, /first/, 'should the position in waiting queue contain the text "first"');
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.waitAndClick(e.acceptGuest);
await this.userPage.hasText(e.guestMessage, /approved/, 'should the guest message contain the text "approved" for the attendee', ELEMENT_WAIT_LONGER_TIME);
2022-10-11 01:47:44 +08:00
await this.modPage.waitForSelector(e.viewerAvatar, ELEMENT_WAIT_LONGER_TIME);
await this.userPage.hasElement(e.audioModal, 'should display the audio modal for the attendee');
2022-10-11 01:47:44 +08:00
}
async denySpecificUser() {
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
2022-10-11 01:47:44 +08:00
await this.modPage.waitAndClick(e.waitingUsersBtn);
await this.modPage.waitAndClick(e.denyGuest);
await this.userPage.hasText(e.guestMessage, /denied/, 'should the guest message contain the text "denied" for the attendee', ELEMENT_WAIT_LONGER_TIME);
2022-01-20 03:50:59 +08:00
}
async alwaysAccept() {
2022-02-04 04:10:26 +08:00
await setGuestPolicyOption(this.modPage, e.askModerator);
await setGuestPolicyOption(this.modPage, e.alwaysAccept);
await sleep(500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
await this.userPage.hasElement(e.audioModal, 'should display the audio modal for the attendee');
2022-01-20 03:50:59 +08:00
}
async alwaysDeny() {
2022-02-04 04:10:26 +08:00
await setGuestPolicyOption(this.modPage, e.alwaysDeny);
2022-01-20 03:50:59 +08:00
await sleep(1500);
await this.initUserPage(false, this.context, { shouldCheckAllInitialSteps: false });
await this.userPage.hasElement(e.deniedMessageElement, 'should display the denied message for the attendee');
2022-01-20 03:50:59 +08:00
}
}
exports.GuestPolicy = GuestPolicy;