11import { DEFAULT_USER_CREDENTIALS , IS_EE } from './config/constants' ;
22import { Users } from './fixtures/userStates' ;
3- import { Registration } from './page-objects' ;
3+ import { Registration , HomeChannel } from './page-objects' ;
4+ import { Modal } from './page-objects/modal' ;
45import { setSettingValueById } from './utils/setSettingValueById' ;
56import { test , expect } from './utils/test' ;
67
78test . describe . serial ( 'Presence' , ( ) => {
89 let poRegistration : Registration ;
10+ let poHomeChannel : HomeChannel ;
911
1012 test . beforeEach ( async ( { page } ) => {
1113 poRegistration = new Registration ( page ) ;
14+ poHomeChannel = new HomeChannel ( page ) ;
1215
1316 await page . goto ( '/home' ) ;
1417 } ) ;
@@ -22,12 +25,44 @@ test.describe.serial('Presence', () => {
2225 } ) ;
2326
2427 test . describe ( 'Login using default settings' , ( ) => {
25- test ( 'expect user to be online after log in' , async ( { page } ) => {
26- await poRegistration . username . type ( 'user1' ) ;
27- await poRegistration . inputPassword . type ( DEFAULT_USER_CREDENTIALS . password ) ;
28+ test ( 'should user be online after log in' , async ( ) => {
29+ await poRegistration . username . fill ( 'user1' ) ;
30+ await poRegistration . inputPassword . fill ( DEFAULT_USER_CREDENTIALS . password ) ;
2831 await poRegistration . btnLogin . click ( ) ;
2932
30- await expect ( page . getByRole ( 'button' , { name : 'User menu' } ) . locator ( '.rcx-status-bullet--online' ) ) . toBeVisible ( ) ;
33+ await expect ( poHomeChannel . sidenav . btnUserProfileMenu ) . toBeVisible ( ) ;
34+ } ) ;
35+ } ) ;
36+
37+ test . describe ( 'Custom status' , ( ) => {
38+ test . use ( { storageState : Users . admin . state } ) ;
39+
40+ test ( 'should user custom status be reactive' , async ( { browser } ) => {
41+ await test . step ( 'user1 custom status should be empty' , async ( ) => {
42+ await poHomeChannel . sidenav . openChat ( 'user1' ) ;
43+
44+ await expect ( poHomeChannel . content . channelHeader ) . not . toContainText ( 'new status' ) ;
45+ } ) ;
46+
47+ await test . step ( 'update user1 custom status' , async ( ) => {
48+ const user1Page = await browser . newPage ( { storageState : Users . user1 . state } ) ;
49+ await user1Page . goto ( '/home' ) ;
50+ const user1Channel = new HomeChannel ( user1Page ) ;
51+ const user1Modal = new Modal ( user1Page ) ;
52+
53+ await user1Channel . sidenav . btnUserProfileMenu . click ( ) ;
54+ await user1Channel . sidenav . getUserProfileMenuOption ( 'Custom Status' ) . click ( ) ;
55+ await user1Modal . getModalByName ( 'Edit Status' ) . getByRole ( 'textbox' , { name : 'Status message' } ) . fill ( 'new status' ) ;
56+ await user1Modal . getModalByName ( 'Edit Status' ) . getByRole ( 'button' , { name : 'Save' } ) . click ( ) ;
57+
58+ await user1Page . close ( ) ;
59+ } ) ;
60+
61+ await test . step ( 'should user1 custom status be updated' , async ( ) => {
62+ await poHomeChannel . sidenav . openChat ( 'user1' ) ;
63+
64+ await expect ( poHomeChannel . content . channelHeader ) . toContainText ( 'new status' ) ;
65+ } ) ;
3166 } ) ;
3267 } ) ;
3368
0 commit comments