@@ -165,34 +165,30 @@ test.describe.serial('message-actions', () => {
165165 test . describe . serial ( 'expect reply in direct message' , ( ) => {
166166 test . use ( { storageState : Users . user2 . state } ) ;
167167
168- let originalCreateDRoles : string [ ] ;
168+ let defaultCreateDRoles : string [ ] ;
169169
170170 test . beforeAll ( async ( { api } ) => {
171- originalCreateDRoles = await getPermissionRoles ( api , 'create-d' ) ;
171+ defaultCreateDRoles = await getPermissionRoles ( api , 'create-d' ) ;
172172
173173 await sendTargetChannelMessage ( api , targetChannel , { msg : 'message from admin for reply in DM' } ) ;
174174 } ) ;
175175
176- test ( 'expect option not be visible without create-d permission and no existing DM' , async ( { api } ) => {
177- expect ( ( await api . post ( '/permissions.update' , { permissions : [ { _id : 'create-d' , roles : [ 'admin' ] } ] } ) ) . status ( ) ) . toBe ( 200 ) ;
178-
176+ test ( 'expect option be visible and redirect to DM' , async ( { page } ) => {
179177 await poHomeChannel . content . openLastMessageMenu ( ) ;
180- await expect ( poHomeChannel . content . btnOptionReplyInDm ) . toBeHidden ( ) ;
178+ await poHomeChannel . content . btnOptionReplyInDm . click ( ) ;
179+
180+ await expect ( page ) . toHaveURL ( / .* r e p l y / ) ;
181181 } ) ;
182182
183- test ( 'expect option be visible and redirect to DM' , async ( { page, api } ) => {
184- expect ( ( await api . post ( '/permissions.update' , { permissions : [ { _id : 'create-d' , roles : originalCreateDRoles } ] } ) ) . status ( ) ) . toBe (
185- 200 ,
186- ) ;
183+ test ( 'expect option not be visible without create-d permission and no existing DM' , async ( { api } ) => {
184+ expect ( ( await api . post ( '/permissions.update' , { permissions : [ { _id : 'create-d' , roles : [ 'admin' ] } ] } ) ) . status ( ) ) . toBe ( 200 ) ;
187185
188186 await poHomeChannel . content . openLastMessageMenu ( ) ;
189- await poHomeChannel . content . btnOptionReplyInDm . click ( ) ;
190-
191- await expect ( page ) . toHaveURL ( / .* r e p l y / ) ;
187+ await expect ( poHomeChannel . content . btnOptionReplyInDm ) . toBeHidden ( ) ;
192188 } ) ;
193189
194190 test . afterAll ( async ( { api } ) => {
195- expect ( ( await api . post ( '/permissions.update' , { permissions : [ { _id : 'create-d' , roles : originalCreateDRoles } ] } ) ) . status ( ) ) . toBe (
191+ expect ( ( await api . post ( '/permissions.update' , { permissions : [ { _id : 'create-d' , roles : defaultCreateDRoles } ] } ) ) . status ( ) ) . toBe (
196192 200 ,
197193 ) ;
198194 } ) ;
0 commit comments