@@ -38,7 +38,9 @@ async function renderAsync(jsx: React.ReactElement) {
38
38
await delay ( ) ;
39
39
const firstLayout = createWrapper ( ) . find ( '[data-testid="first"]' ) ! . findAppLayout ( ) ! ;
40
40
const secondLayout = createWrapper ( ) . find ( '[data-testid="second"]' ) ! . findAppLayout ( ) ! ;
41
- expect ( findAllToolbars ( ) ) . toHaveLength ( 1 ) ;
41
+ await waitFor ( ( ) => {
42
+ expect ( findAllToolbars ( ) ) . toHaveLength ( 1 ) ;
43
+ } ) ;
42
44
expect ( findToolbar ( firstLayout ) ) . toBeTruthy ( ) ;
43
45
expect ( findToolbar ( secondLayout ) ) . toBeFalsy ( ) ;
44
46
return { firstLayout, secondLayout } ;
@@ -166,8 +168,10 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
166
168
content = { < AppLayout navigationHide = { true } data-testid = "second" /> }
167
169
/>
168
170
) ;
169
- expect ( firstLayout . findSplitPanel ( ) ) . toBeTruthy ( ) ;
170
- expect ( secondLayout . findSplitPanel ( ) ) . toBeFalsy ( ) ;
171
+ await waitFor ( ( ) => {
172
+ expect ( firstLayout . findSplitPanel ( ) ) . toBeTruthy ( ) ;
173
+ expect ( secondLayout . findSplitPanel ( ) ) . toBeFalsy ( ) ;
174
+ } ) ;
171
175
expect ( firstLayout . findSplitPanelOpenButton ( ) ) . toBeTruthy ( ) ;
172
176
expect ( secondLayout . findSplitPanelOpenButton ( ) ) . toBeFalsy ( ) ;
173
177
expect ( firstLayout . findSplitPanel ( ) ! . findOpenPanelBottom ( ) ) . toBeFalsy ( ) ;
@@ -221,7 +225,9 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
221
225
expect ( findToolbar ( thirdLayout ) ) . toBeFalsy ( ) ;
222
226
expect ( findAllToolbars ( ) ) . toHaveLength ( 1 ) ;
223
227
expect ( firstLayout . findNavigationToggle ( ) ) . toBeTruthy ( ) ;
224
- expect ( firstLayout . findToolsToggle ( ) ) . toBeTruthy ( ) ;
228
+ await waitFor ( ( ) => {
229
+ expect ( firstLayout . findToolsToggle ( ) ) . toBeTruthy ( ) ;
230
+ } ) ;
225
231
expect ( firstLayout . findSplitPanelOpenButton ( ) ) . toBeTruthy ( ) ;
226
232
} ) ;
227
233
@@ -282,7 +288,9 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
282
288
/>
283
289
) ;
284
290
285
- expect ( firstLayout . findToolsToggle ( ) ) . toBeTruthy ( ) ;
291
+ await waitFor ( ( ) => {
292
+ expect ( firstLayout . findToolsToggle ( ) ) . toBeTruthy ( ) ;
293
+ } ) ;
286
294
expect ( firstLayout . findToolsToggle ( ) . getElement ( ) ) . toHaveAttribute ( 'aria-expanded' , 'false' ) ;
287
295
288
296
firstLayout . findToolsToggle ( ) . click ( ) ;
@@ -368,9 +376,11 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
368
376
content = { < AppLayout { ...defaultAppLayoutProps } data-testid = "second" drawers = { [ testDrawer ] } /> }
369
377
/>
370
378
) ;
371
- expect ( console . warn ) . toHaveBeenCalledWith (
372
- expect . stringContaining ( 'Another app layout instance on this page already defines tools or drawers property' )
373
- ) ;
379
+ await waitFor ( ( ) => {
380
+ expect ( console . warn ) . toHaveBeenCalledWith (
381
+ expect . stringContaining ( 'Another app layout instance on this page already defines tools or drawers property' )
382
+ ) ;
383
+ } ) ;
374
384
expect ( firstLayout . findDrawersTriggers ( ) ) . toHaveLength ( 0 ) ;
375
385
expect ( firstLayout . findOpenToolsPanel ( ) ) . toBeFalsy ( ) ;
376
386
0 commit comments