Skip to content

Commit 22e87d9

Browse files
committed
fix: multi-layout.test.tsx
1 parent c5855a1 commit 22e87d9

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/app-layout/__tests__/multi-layout.test.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ async function renderAsync(jsx: React.ReactElement) {
3838
await delay();
3939
const firstLayout = createWrapper().find('[data-testid="first"]')!.findAppLayout()!;
4040
const secondLayout = createWrapper().find('[data-testid="second"]')!.findAppLayout()!;
41-
expect(findAllToolbars()).toHaveLength(1);
41+
await waitFor(() => {
42+
expect(findAllToolbars()).toHaveLength(1);
43+
});
4244
expect(findToolbar(firstLayout)).toBeTruthy();
4345
expect(findToolbar(secondLayout)).toBeFalsy();
4446
return { firstLayout, secondLayout };
@@ -166,8 +168,10 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
166168
content={<AppLayout navigationHide={true} data-testid="second" />}
167169
/>
168170
);
169-
expect(firstLayout.findSplitPanel()).toBeTruthy();
170-
expect(secondLayout.findSplitPanel()).toBeFalsy();
171+
await waitFor(() => {
172+
expect(firstLayout.findSplitPanel()).toBeTruthy();
173+
expect(secondLayout.findSplitPanel()).toBeFalsy();
174+
});
171175
expect(firstLayout.findSplitPanelOpenButton()).toBeTruthy();
172176
expect(secondLayout.findSplitPanelOpenButton()).toBeFalsy();
173177
expect(firstLayout.findSplitPanel()!.findOpenPanelBottom()).toBeFalsy();
@@ -221,7 +225,9 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
221225
expect(findToolbar(thirdLayout)).toBeFalsy();
222226
expect(findAllToolbars()).toHaveLength(1);
223227
expect(firstLayout.findNavigationToggle()).toBeTruthy();
224-
expect(firstLayout.findToolsToggle()).toBeTruthy();
228+
await waitFor(() => {
229+
expect(firstLayout.findToolsToggle()).toBeTruthy();
230+
});
225231
expect(firstLayout.findSplitPanelOpenButton()).toBeTruthy();
226232
});
227233

@@ -282,7 +288,9 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
282288
/>
283289
);
284290

285-
expect(firstLayout.findToolsToggle()).toBeTruthy();
291+
await waitFor(() => {
292+
expect(firstLayout.findToolsToggle()).toBeTruthy();
293+
});
286294
expect(firstLayout.findToolsToggle().getElement()).toHaveAttribute('aria-expanded', 'false');
287295

288296
firstLayout.findToolsToggle().click();
@@ -368,9 +376,11 @@ describeEachAppLayout({ themes: ['refresh-toolbar'], sizes: ['desktop'] }, () =>
368376
content={<AppLayout {...defaultAppLayoutProps} data-testid="second" drawers={[testDrawer]} />}
369377
/>
370378
);
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+
});
374384
expect(firstLayout.findDrawersTriggers()).toHaveLength(0);
375385
expect(firstLayout.findOpenToolsPanel()).toBeFalsy();
376386

0 commit comments

Comments
 (0)