2021-12-02 12:12:14 +08:00
const { MultiUsers } = require ( '../user/multiusers' ) ;
2021-11-30 21:42:57 +08:00
const e = require ( '../core/elements' ) ;
const { ELEMENT _WAIT _LONGER _TIME } = require ( '../core/constants' ) ;
2022-09-23 04:17:15 +08:00
const { expect } = require ( '@playwright/test' ) ;
2021-11-30 21:42:57 +08:00
2021-12-02 12:12:14 +08:00
class Create extends MultiUsers {
2021-11-30 21:42:57 +08:00
constructor ( browser , context ) {
2021-12-02 12:12:14 +08:00
super ( browser , context ) ;
2021-11-30 21:42:57 +08:00
}
2023-02-14 21:59:46 +08:00
// Create BreakoutRooms
2022-12-31 05:49:18 +08:00
async create ( captureNotes = false , captureWhiteboard = false ) {
2021-12-02 12:12:14 +08:00
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
2023-11-29 04:10:46 +08:00
// assign user to first room
await this . modPage . dragDropSelector ( e . attendeeNotAssigned , e . breakoutBox1 ) ;
2022-12-31 05:49:18 +08:00
2023-02-14 21:59:46 +08:00
if ( captureNotes ) await this . modPage . page . check ( e . captureBreakoutSharedNotes ) ;
if ( captureWhiteboard ) await this . modPage . page . check ( e . captureBreakoutWhiteboard ) ;
2022-09-30 19:17:15 +08:00
await this . modPage . waitAndClick ( e . modalConfirmButton , ELEMENT _WAIT _LONGER _TIME ) ;
2024-07-31 06:49:02 +08:00
await this . userPage . hasElement ( e . modalConfirmButton , 'should appear the modal confirm button to join breakout' ) ;
2022-09-30 19:17:15 +08:00
await this . userPage . waitAndClick ( e . modalDismissButton ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasElement ( e . breakoutRoomsItem , 'should have the breakout room item' ) ;
2022-09-30 19:17:15 +08:00
}
2023-01-31 22:01:56 +08:00
async createToAllowChooseOwnRoom ( ) {
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
await this . modPage . waitAndClick ( e . allowChoiceRoom ) ;
await this . modPage . waitAndClick ( e . modalConfirmButton , ELEMENT _WAIT _LONGER _TIME ) ;
await this . userPage . hasElement ( e . modalConfirmButton ) ;
await this . modPage . hasElement ( e . breakoutRoomsItem ) ;
}
2022-09-30 19:17:15 +08:00
async changeNumberOfRooms ( ) {
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
await this . modPage . waitAndClick ( e . randomlyAssign ) ;
2022-09-10 00:54:50 +08:00
await this . modPage . getLocator ( e . selectNumberOfRooms ) . selectOption ( '7' ) ;
2022-09-30 19:17:15 +08:00
await this . modPage . waitAndClick ( e . modalConfirmButton , ELEMENT _WAIT _LONGER _TIME ) ;
await this . modPage . waitAndClick ( e . breakoutRoomsItem ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . checkElementCount ( e . userNameBreakoutRoom7 , 1 , 'should have one user on the breakout room number 7' ) ;
2022-09-30 19:17:15 +08:00
}
2022-09-10 00:54:50 +08:00
2022-09-30 19:17:15 +08:00
async changeDurationTime ( ) {
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
await this . modPage . waitAndClick ( e . randomlyAssign ) ;
2023-07-31 22:24:25 +08:00
const createButtonLocator = this . modPage . getLocator ( e . modalConfirmButton ) ;
2022-09-30 19:17:15 +08:00
//test minimum 5 minutes
await this . modPage . getLocator ( e . durationTime ) . press ( 'Backspace' ) ;
await this . modPage . getLocator ( e . durationTime ) . press ( 'Backspace' ) ;
await this . modPage . type ( e . durationTime , '5' ) ;
2024-07-31 06:49:02 +08:00
await expect ( createButtonLocator , 'should have the create button for the breakout rooms enabled.' ) . toBeEnabled ( ) ;
2022-09-30 19:17:15 +08:00
2023-07-31 22:24:25 +08:00
await this . modPage . page . fill ( e . durationTime , '4' ) ;
2024-07-31 06:49:02 +08:00
await expect ( createButtonLocator , 'should have the breakout room create button disabled.' ) . toBeDisabled ( ) ;
await this . modPage . hasElement ( e . minimumDurationWarnBreakout , 'should have at least 5 minutes of breakout room duration time.' ) ;
2023-07-31 22:24:25 +08:00
// await this.modPage.getLocator(e.durationTime).press('Backspace');
await this . modPage . page . fill ( e . durationTime , '15' ) ;
2022-09-30 19:17:15 +08:00
await this . modPage . waitAndClick ( e . modalConfirmButton , ELEMENT _WAIT _LONGER _TIME ) ;
await this . modPage . waitAndClick ( e . breakoutRoomsItem ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . breakoutRemainingTime , /14:[0-5][0-9]/ , 'should have the breakout room remaining time between 14:00 and 14:59 minutes' , ELEMENT _WAIT _LONGER _TIME ) ;
2022-09-30 19:17:15 +08:00
}
async changeRoomsName ( ) {
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
await this . modPage . waitAndClick ( e . randomlyAssign ) ;
//Change room's name
await this . modPage . type ( e . roomNameInput , 'Test' ) ;
await this . modPage . waitAndClick ( e . modalConfirmButton , ELEMENT _WAIT _LONGER _TIME ) ;
await this . modPage . waitAndClick ( e . breakoutRoomsItem ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . roomName1Test , /Test/ , 'should display the correct breakout room name' ) ;
2022-09-30 19:17:15 +08:00
}
async removeAndResetAssignments ( ) {
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
2022-09-10 00:54:50 +08:00
2023-11-29 04:10:46 +08:00
// Reset assignments
await this . modPage . dragDropSelector ( e . attendeeNotAssigned , e . breakoutBox1 ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . breakoutBox1 , /Attendee/ , 'should have an attende on second breakout room box' ) ;
2022-09-10 00:54:50 +08:00
await this . modPage . waitAndClick ( e . resetAssignments ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . breakoutBox0 , /Attendee/ , 'should have and attende on first breakout room box' ) ;
2022-09-10 00:54:50 +08:00
2023-11-29 04:10:46 +08:00
// Remove specific assignment
await this . modPage . dragDropSelector ( e . attendeeNotAssigned , e . breakoutBox1 ) ;
await this . modPage . waitAndClick ( ` ${ e . breakoutBox1 } span[role="button"] ` ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . breakoutBox0 , /Attendee/ , 'should have and attende on first breakout room box' ) ;
2022-09-30 19:17:15 +08:00
}
2022-09-10 00:54:50 +08:00
2022-09-30 19:17:15 +08:00
async dragDropUserInRoom ( ) {
await this . modPage . waitAndClick ( e . manageUsers ) ;
await this . modPage . waitAndClick ( e . createBreakoutRooms ) ;
2022-09-16 02:31:10 +08:00
2022-09-30 19:17:15 +08:00
//testing no user assigned
2023-04-06 22:43:50 +08:00
const modalConfirmButton = this . modPage . getLocator ( e . modalConfirmButton ) ;
2024-07-31 06:49:02 +08:00
await expect ( modalConfirmButton , 'should designate a user to a specific a breakout room, before creating it' ) . toBeDisabled ( ) ;
await this . modPage . hasElement ( e . warningNoUserAssigned , 'should designate a user to a specific a breakout room, before creating it' ) ;
2022-09-16 02:31:10 +08:00
2023-11-29 04:10:46 +08:00
await this . modPage . dragDropSelector ( e . attendeeNotAssigned , e . breakoutBox1 ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . breakoutBox1 , /Attendee/ , 'should have the attende on the second breakout room' ) ;
2023-07-31 22:24:25 +08:00
await expect ( modalConfirmButton ) . toBeEnabled ( ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . wasRemoved ( e . warningNoUserAssigned , 'should designate a user to a specific a breakout room, before creating it' ) ;
2021-12-02 12:12:14 +08:00
await this . modPage . waitAndClick ( e . modalConfirmButton , ELEMENT _WAIT _LONGER _TIME ) ;
2022-09-30 19:17:15 +08:00
await this . userPage . waitAndClick ( e . modalConfirmButton ) ;
2021-11-30 21:42:57 +08:00
2022-09-30 19:17:15 +08:00
await this . modPage . waitAndClick ( e . breakoutRoomsItem ) ;
2024-07-31 06:49:02 +08:00
await this . modPage . hasText ( e . userNameBreakoutRoom , /Attendee/ , 'should have the attende name on the first breakout room' , ELEMENT _WAIT _LONGER _TIME ) ;
2021-11-30 21:42:57 +08:00
}
}
2021-12-04 01:01:36 +08:00
exports . Create = Create ;