@@ -180,7 +180,9 @@ describe('<HeaderChatButton />', () => {
180
180
expect ( screen . queryByLabelText ( 'chat flyout mock' ) ) . not . toBeVisible ( ) ;
181
181
// sidecar hide
182
182
fireEvent . click ( toggleButton ) ;
183
- expect ( screen . queryByLabelText ( 'chat flyout mock' ) ) . toBeVisible ( ) ;
183
+ await waitFor ( ( ) => {
184
+ expect ( screen . queryByLabelText ( 'chat flyout mock' ) ) . toBeVisible ( ) ;
185
+ } ) ;
184
186
} ) ;
185
187
186
188
it ( 'should call send message without active conversation id after input text submitted' , async ( ) => {
@@ -246,11 +248,12 @@ describe('<HeaderChatButton />', () => {
246
248
code : 'Escape' ,
247
249
charCode : 27 ,
248
250
} ) ;
251
+
249
252
expect ( screen . getByLabelText ( 'chat input' ) ) . not . toHaveFocus ( ) ;
250
253
expect ( screen . getByTitle ( 'press Ctrl + / to start typing' ) ) . toBeInTheDocument ( ) ;
251
254
} ) ;
252
255
253
- it ( 'should focus on chat input when pressing global shortcut' , ( ) => {
256
+ it ( 'should focus on chat input when pressing global shortcut' , async ( ) => {
254
257
render (
255
258
< HeaderChatButton
256
259
application = { applicationServiceMock . createStartContract ( ) }
@@ -267,10 +270,12 @@ describe('<HeaderChatButton />', () => {
267
270
charCode : 111 ,
268
271
ctrlKey : true ,
269
272
} ) ;
270
- expect ( screen . getByLabelText ( 'chat input' ) ) . toHaveFocus ( ) ;
273
+ await waitFor ( ( ) => {
274
+ expect ( screen . getByLabelText ( 'chat input' ) ) . toHaveFocus ( ) ;
275
+ } ) ;
271
276
} ) ;
272
277
273
- it ( 'should not focus on chat input when no access and pressing global shortcut' , ( ) => {
278
+ it ( 'should not focus on chat input when no access and pressing global shortcut' , async ( ) => {
274
279
render (
275
280
< HeaderChatButton
276
281
application = { applicationServiceMock . createStartContract ( ) }
@@ -287,7 +292,9 @@ describe('<HeaderChatButton />', () => {
287
292
charCode : 111 ,
288
293
metaKey : true ,
289
294
} ) ;
290
- expect ( screen . getByLabelText ( 'chat input' ) ) . not . toHaveFocus ( ) ;
295
+ await waitFor ( ( ) => {
296
+ expect ( screen . getByLabelText ( 'chat input' ) ) . not . toHaveFocus ( ) ;
297
+ } ) ;
291
298
} ) ;
292
299
293
300
it ( 'should call sidecar hide and close when button unmount and chat flyout is visible' , async ( ) => {
@@ -307,11 +314,16 @@ describe('<HeaderChatButton />', () => {
307
314
308
315
fireEvent . click ( getByLabelText ( 'toggle chat flyout icon' ) ) ;
309
316
310
- expect ( sideCarHideMock ) . not . toHaveBeenCalled ( ) ;
311
- expect ( sideCarRefMock . close ) . not . toHaveBeenCalled ( ) ;
317
+ await waitFor ( ( ) => {
318
+ expect ( sideCarHideMock ) . not . toHaveBeenCalled ( ) ;
319
+ expect ( sideCarRefMock . close ) . not . toHaveBeenCalled ( ) ;
320
+ } ) ;
321
+
312
322
unmount ( ) ;
313
- expect ( sideCarHideMock ) . toHaveBeenCalled ( ) ;
314
- expect ( sideCarRefMock . close ) . toHaveBeenCalled ( ) ;
323
+ await waitFor ( ( ) => {
324
+ expect ( sideCarHideMock ) . toHaveBeenCalled ( ) ;
325
+ expect ( sideCarRefMock . close ) . toHaveBeenCalled ( ) ;
326
+ } ) ;
315
327
} ) ;
316
328
317
329
it ( 'should render toggle chat flyout button icon' , ( ) => {
0 commit comments