Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Fix flaky column pinning tests #16219

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,9 @@ describe('<DataGridPro /> - Column pinning', () => {
const menuIconButton = columnCell.querySelector('button[aria-label="Menu"]')!;
await user.click(menuIconButton);
await user.click(screen.getByRole('menuitem', { name: 'Pin to left' }));
expect($(`.${gridClasses['cell--pinnedLeft']}[data-field="id"]`)).not.to.equal(null);
await waitFor(() => {
expect($(`.${gridClasses['cell--pinnedLeft']}[data-field="id"]`)).not.to.equal(null);
});
});

it('should pin the column to the right when clicking the "Pin to right" pinning button', async () => {
Expand All @@ -478,7 +480,9 @@ describe('<DataGridPro /> - Column pinning', () => {
const menuIconButton = columnCell.querySelector('button[aria-label="Menu"]')!;
await user.click(menuIconButton);
await user.click(screen.getByRole('menuitem', { name: 'Pin to right' }));
expect($(`.${gridClasses['cell--pinnedRight']}[data-field="id"]`)).not.to.equal(null);
await waitFor(() => {
expect($(`.${gridClasses['cell--pinnedRight']}[data-field="id"]`)).not.to.equal(null);
});
});

it('should allow to invert the side when clicking on "Pin to right" pinning button on a left pinned column', async () => {
Expand All @@ -487,7 +491,9 @@ describe('<DataGridPro /> - Column pinning', () => {
const menuIconButton = columnCell.querySelector('button[aria-label="Menu"]')!;
await user.click(menuIconButton);
await user.click(screen.getByRole('menuitem', { name: 'Pin to right' }));
expect($(`.${gridClasses['cell--pinnedLeft']}[data-field="id"]`)).to.equal(null);
await waitFor(() => {
expect($(`.${gridClasses['cell--pinnedLeft']}[data-field="id"]`)).to.equal(null);
});
expect($(`.${gridClasses['cell--pinnedRight']}[data-field="id"]`)).not.to.equal(null);
});

Expand All @@ -497,7 +503,9 @@ describe('<DataGridPro /> - Column pinning', () => {
const menuIconButton = columnCell.querySelector('button[aria-label="Menu"]')!;
await user.click(menuIconButton);
await user.click(screen.getByRole('menuitem', { name: 'Pin to left' }));
expect($(`.${gridClasses['cell--pinnedRight']}[data-field="id"]`)).to.equal(null);
await waitFor(() => {
expect($(`.${gridClasses['cell--pinnedRight']}[data-field="id"]`)).to.equal(null);
});
expect($(`.${gridClasses['cell--pinnedLeft']}[data-field="id"]`)).not.to.equal(null);
});

Expand Down
Loading