Skip to content

Commit 7b5f2c2

Browse files
test(mosaic): fix flaky invitation revoke feature tests (#10178)
1 parent a0ea270 commit 7b5f2c2

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎packages/mosaic/src/features/organization-profile/__tests__/organization-profile-invitations.feature.test.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ describe('connected organization invitations', () => {
123123
await user.click(within(screen.getByRole('alertdialog')).getByRole('button', { name: 'Revoke invitation' }));
124124
await waitFor(() => expect(revoke.requests).toHaveLength(1));
125125
revoke.fail('network_error', 'Unavailable');
126-
expect(await within(screen.getByRole('alertdialog')).findByRole('alert')).toHaveTextContent(
127-
'Unable to reach the server. Check your connection and try again.',
126+
await waitFor(() =>
127+
expect(within(screen.getByRole('alertdialog')).getByRole('alert')).toHaveTextContent(
128+
'Unable to reach the server. Check your connection and try again.',
129+
),
128130
);
129131
expect(fapi.organizationInvitations[0]?.status).toBe('pending');
130132
const retry = serve(['org:sys_memberships:manage']);
@@ -140,8 +142,10 @@ describe('connected organization invitations', () => {
140142
await user.click(screen.getByRole('menuitem', { name: 'Revoke invitation' }));
141143
fapi.organizationInvitations = [{ ...invitation, status: 'accepted' }];
142144
await user.click(within(screen.getByRole('alertdialog')).getByRole('button', { name: 'Revoke invitation' }));
143-
expect(await within(screen.getByRole('alertdialog')).findByRole('alert')).toHaveTextContent(
144-
'This invitation is no longer pending.',
145+
await waitFor(() =>
146+
expect(within(screen.getByRole('alertdialog')).getByRole('alert')).toHaveTextContent(
147+
'This invitation is no longer pending.',
148+
),
145149
);
146150
expect(fapi.organizationInvitations[0]?.status).toBe('accepted');
147151
});

‎packages/mosaic/src/features/organization-profile/__tests__/organization-profile-members-panel.feature.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ describe('OrganizationProfileMembersPanel', () => {
316316
expect(role).toBeDisabled();
317317
expect(screen.getByRole('button', { name: 'Manage Bob Smith' })).toBeDisabled();
318318
update.fail('role_rejected', 'Role rejected by server');
319-
expect(await screen.findByRole('alert')).toHaveTextContent('Role rejected by server');
319+
await waitFor(() => expect(screen.getByRole('alert')).toHaveTextContent('Role rejected by server'));
320320
expect(screen.getByRole('alert')).toHaveAttribute('data-color', 'negative');
321321
const retry = serve(['org:sys_memberships:read', 'org:sys_memberships:manage']);
322322
await user.click(await screen.findByRole('combobox', { name: /^Change role for Bob Smith/ }));

0 commit comments

Comments
 (0)