Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/mosaic-fix-flaky-feature-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 3 additions & 1 deletion packages/mosaic/src/__tests__/feature/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ import type { UserEvent } from '@testing-library/user-event';

export async function openMenu(user: UserEvent, trigger: HTMLElement) {
await user.click(trigger);
return screen.findByRole('menu');
const menu = await screen.findByRole('menu');
await new Promise(requestAnimationFrame);
return menu;
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ describe('OrganizationProfileMembersPanel', () => {
await waitFor(() => expect(members.requests).toHaveLength(1));
expect(screen.getByRole('button', { name: 'Manage Bob Smith' })).toBeDisabled();
members.release();
await openMenu(user, await screen.findByRole('button', { name: 'Manage Bob Smith' }));
await waitFor(() => expect(screen.getByRole('button', { name: 'Manage Bob Smith' })).toBeEnabled());
await openMenu(user, screen.getByRole('button', { name: 'Manage Bob Smith' }));
await user.click(screen.getByRole('menuitem', { name: 'Remove from organization' }));
const dialog = await screen.findByRole('alertdialog', { name: 'Remove Bob Smith?' });
await user.click(within(dialog).getByRole('button', { name: 'Remove from organization' }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('enterprise accounts', () => {
expect(screen.getByRole('alert')).toHaveTextContent('The connection could not start. Please try again.'),
);
expect(screen.getByRole('button', { name: 'Connect Acme Okta' })).toBeEnabled();
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
await waitFor(() => expect(screen.queryByRole('progressbar')).not.toBeInTheDocument());
serveFapi(signedIn());
await user.click(screen.getByRole('button', { name: 'Connect Acme Okta' }));
await waitFor(() =>
Expand Down
Loading