Skip to content

Commit f6bd77c

Browse files
committed
fix: add await for tests
1 parent ec96144 commit f6bd77c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/elements/content-sharing/stories/tests/ContentSharingV2-visual.stories.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { expect, screen, userEvent, within } from 'storybook/test';
2+
import { expect, screen, userEvent, waitFor, within } from 'storybook/test';
33

44
import { TYPE_FILE } from '../../../../constants';
55
import {
@@ -52,14 +52,16 @@ export const withCollaborators = {
5252
},
5353
play: async context => {
5454
await withModernization.play(context);
55-
const sharedWithAvatars = screen.getByRole('button', { name: 'Shared with D R D' });
56-
expect(sharedWithAvatars).toBeVisible();
57-
await userEvent.click(sharedWithAvatars);
55+
await waitFor(async () => {
56+
const sharedWithAvatars = screen.getByRole('button', { name: 'Shared with D R D' });
57+
expect(sharedWithAvatars).toBeVisible();
58+
await userEvent.click(sharedWithAvatars);
5859

59-
expect(screen.getByRole('link', { name: 'Manage All' })).toBeVisible();
60-
expect(screen.getByRole('grid', { name: 'Collaborators' })).toBeVisible();
61-
expect(screen.getByRole('row', { name: /Detective Parrot/ })).toBeVisible();
62-
expect(screen.getByRole('button', { name: 'Done' })).toBeVisible();
60+
expect(screen.getByRole('link', { name: 'Manage All' })).toBeVisible();
61+
expect(screen.getByRole('grid', { name: 'Collaborators' })).toBeVisible();
62+
expect(screen.getByRole('row', { name: /Detective Parrot/ })).toBeVisible();
63+
expect(screen.getByRole('button', { name: 'Done' })).toBeVisible();
64+
});
6365
},
6466
};
6567

0 commit comments

Comments
 (0)