2023-06-22 20:21:10 +08:00
const { expect , default : test } = require ( '@playwright/test' ) ;
const { MultiUsers } = require ( '../user/multiusers' ) ;
const e = require ( '../core/elements' ) ;
const c = require ( './constants' ) ;
const { VIDEO _LOADING _WAIT _TIME , ELEMENT _WAIT _LONGER _TIME , ELEMENT _WAIT _EXTRA _LONG _TIME } = require ( '../core/constants' ) ;
const util = require ( './util' ) ;
const { getSettings } = require ( '../core/settings' ) ;
const { waitAndClearDefaultPresentationNotification } = require ( '../notifications/util' ) ;
class CreateParameters extends MultiUsers {
constructor ( browser , context ) {
super ( browser , context ) ;
}
async recordMeeting ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . recordingIndicator , 'should the recording indicator to be displayed' ) ;
2023-06-22 20:21:10 +08:00
}
async bannerText ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . actions , 'should the actions button be displayed' ) ;
await this . modPage . hasElement ( e . notificationBannerBar , 'should display the banner text on the top of the meeting' ) ;
2023-06-22 20:21:10 +08:00
}
async bannerColor ( colorToRGB ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . notificationBannerBar , 'should display the banner bar' ) ;
2023-06-22 20:21:10 +08:00
const notificationLocator = this . modPage . getLocator ( e . notificationBannerBar ) ;
const notificationBarColor = await notificationLocator . evaluate ( ( elem ) => {
return getComputedStyle ( elem ) . backgroundColor ;
} , e . notificationBannerBar ) ;
2024-07-31 06:49:02 +08:00
await expect ( notificationBarColor , 'should display the banner bar with the color changed' ) . toBe ( colorToRGB ) ;
2023-06-22 20:21:10 +08:00
}
async maxParticipants ( context ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the first moderator' ) ;
await this . modPage2 . hasElement ( e . whiteboard , 'should display the whiteboard for the second moderator' ) ;
2023-06-22 20:21:10 +08:00
await this . initUserPage ( false , context ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . hasElement ( 'p[class="error-message"]' , 'should display the error message for the attendee, the number of max participants should not be passed' )
2023-06-22 20:21:10 +08:00
}
async duration ( context ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
await this . modPage . hasText ( e . timeRemaining , /[1-2]:[0-5][0-9]/ , 'should display the time remaining of the meeting decreasing' ) ;
2023-06-22 20:21:10 +08:00
}
async moderatorOnlyMessage ( context ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
await this . modPage . checkElementCount ( e . chatWelcomeMessageText , 2 , 'should display two welcome messages' ) ;
await this . modPage . hasText ( ` ${ e . chatWelcomeMessageText } >>nth=1 ` , 'Test' , 'should display the second welcome message with the word Test' ) ;
2023-06-22 20:21:10 +08:00
await this . initUserPage ( true , context ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . checkElementCount ( e . chatWelcomeMessageText , 1 , 'should display one welcome message for the attendee' ) ;
2023-06-22 20:21:10 +08:00
}
async webcamsOnlyForModerator ( context ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
2023-06-22 20:21:10 +08:00
await this . userPage2 . waitAndClick ( e . joinVideo ) ;
await this . userPage2 . waitAndClick ( e . startSharingWebcam ) ;
2024-07-31 06:49:02 +08:00
await this . userPage2 . hasElement ( e . webcamContainer , 'should display the attende 2 camera' ) ;
2023-06-22 20:21:10 +08:00
2024-07-31 06:49:02 +08:00
await this . modPage . checkElementCount ( e . webcamContainer , 1 , 'should display one camera from the attende 2 for the moderator' ) ;
await this . userPage2 . checkElementCount ( e . webcamContainer , 1 , 'should display one camera from the attendee 2 ' ) ;
2023-06-22 20:21:10 +08:00
await this . initUserPage ( true , context ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . checkElementCount ( e . webcamContainer , 0 , 'should not display any camera for the attendee 1' ) ;
2023-06-22 20:21:10 +08:00
}
async muteOnStart ( ) {
await this . modPage . waitAndClick ( e . joinAudio ) ;
await this . modPage . waitAndClick ( e . microphoneButton ) ;
await this . modPage . waitAndClick ( e . joinEchoTestButton ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . unmuteMicButton , 'should display the unmute microphone button for the moderator' ) ;
2023-06-22 20:21:10 +08:00
}
async allowModsToUnmuteUsers ( context ) {
await this . initUserPage ( false , context ) ;
await this . userPage . waitAndClick ( e . microphoneButton ) ;
await this . userPage . waitAndClick ( e . joinEchoTestButton ) ;
await this . userPage . waitAndClick ( e . muteMicButton ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . hasElement ( e . unmuteMicButton , 'should display the unmute microphone button for the attendee' ) ;
2023-06-22 20:21:10 +08:00
await this . modPage . waitAndClick ( e . userListItem ) ;
await this . modPage . waitAndClick ( e . unmuteUser ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . hasElement ( e . muteMicButton , 'should display the mute microphone button for the attendee' ) ;
2023-06-22 20:21:10 +08:00
}
async lockSettingsDisableCam ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
await this . userPage . hasElementDisabled ( e . joinVideo , 'should display the join video button disabled' ) ;
2023-06-22 20:21:10 +08:00
}
async lockSettingsDisableMic ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
await this . userPage . hasElement ( e . leaveListenOnly , 'should display the leave listen only' , ELEMENT _WAIT _LONGER _TIME ) ;
2023-06-22 20:21:10 +08:00
}
async lockSettingsDisablePublicChat ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard ) ;
2023-09-26 01:40:11 +08:00
await this . userPage . hasText ( e . errorTypingIndicator , /locked/ ) ;
2023-06-22 20:21:10 +08:00
}
async lockSettingsHideUserList ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
await this . modPage . checkElementCount ( e . userListItem , 2 , 'should display the two attendess for the moderator' ) ;
await this . userPage . checkElementCount ( e . userListItem , 1 , 'should display one user(the moderator) for the first attendee' ) ;
await this . userPage2 . checkElementCount ( e . userListItem , 1 , 'should display one user(the moderator) for the second attendee' ) ;
2023-06-22 20:21:10 +08:00
}
async allowModsToEjectCameras ( ) {
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . whiteboard , 'should display the whiteboard for the moderator' ) ;
2023-06-22 20:21:10 +08:00
await this . userPage . waitAndClick ( e . joinVideo ) ;
await this . userPage . waitAndClick ( e . startSharingWebcam ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . hasElement ( e . webcamContainer , 'should display the webcam container for the attendee' ) ;
2023-06-22 20:21:10 +08:00
await this . modPage . waitAndClick ( e . userListItem ) ;
await this . modPage . waitAndClick ( e . ejectCamera ) ;
}
}
exports . CreateParameters = CreateParameters ;