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

Fix flaky tests #2812

Merged
merged 9 commits into from
Oct 20, 2023
Merged

Fix flaky tests #2812

merged 9 commits into from
Oct 20, 2023

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented Oct 17, 2023

  • Wait for bounding boxes to be available/stable
  • Wait for data to load if it's possible in some tests

Includes replacing Container with Box in some components, unrelated but it seems like Container is more appropriate for page-wide wrappers.

@apedroferreira apedroferreira self-assigned this Oct 17, 2023
@apedroferreira apedroferreira changed the title Attempt to fix flaky tests Don't use absolute position in DataGrid Oct 18, 2023
@apedroferreira apedroferreira requested a review from a team October 18, 2023 17:15
@apedroferreira apedroferreira marked this pull request as ready for review October 18, 2023 17:17
bharatkashyap
bharatkashyap previously approved these changes Oct 18, 2023
Copy link
Member

@bharatkashyap bharatkashyap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like its failing CI again

@bharatkashyap bharatkashyap dismissed their stale review October 18, 2023 20:08

Tests results changed

@apedroferreira apedroferreira marked this pull request as draft October 18, 2023 22:12
@apedroferreira
Copy link
Member Author

Seems like its failing CI again

Yep, I ran the CI one more time and it failed, will keep trying to figure this out, I still don't know what's causing the issues.

@apedroferreira apedroferreira changed the title Don't use absolute position in DataGrid Fix flaky tests Oct 19, 2023
@@ -1,8 +1,6 @@
import { Page, Locator, expect } from '@playwright/test';

export default async function clickCenter(page: Page, targetLocator: Locator) {
await expect(targetLocator).toBeAttached();

const targetBoundingBox = await targetLocator.boundingBox();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe try something like

await expect(async () => {
  const targetBoundingBox = await targetLocator.boundingBox();
  expect(targetBoundingBox).toBeTruthy();
  expect(targetBoundingBox.width).toBeGreaterThan(0)
  expect(targetBoundingBox.height).toBeGreaterThan(0)
}).toPass();

(writing on my phone)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My latest commit seems to fix the flaky tests (partially if not fully, the only one I'm not sure about is can create new custom components, we can see after merging).
I had added that line before as an attempt, but I removed it in that last commit because it wasn't doing anything, the problems were unrelated to that logic there it seems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about that awaitable .toPass though, actually I'll add it too!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with these fixes, is the container in the datagrid still necessary?

Copy link
Member Author

@apedroferreira apedroferreira Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not, they seemed to make the data providers test more stable before the other fixes but it could have been just a coincidence. (actually I haven't seen those tests fail again since I changed that)
But these changes will also be needed for the upcoming resizing improvements, that's also why I tried getting them in anyway. And I've seen some issues with the grid height not matching the dotted highlight borders before.
If there's a reason why we're using absolute position I can revert that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just wouldn't expect to find a container component there. feels more like a top level thing, given that its behavior depends on viewport width

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah Container in components isn't the most appropriate, I've changed all components with a Container to a Box with 100% width and reverted the DataGrid until if we actually see that we need any changes there.

@apedroferreira apedroferreira marked this pull request as ready for review October 19, 2023 19:14
Copy link
Member

@bharatkashyap bharatkashyap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌Thanks for taking this up!

@apedroferreira apedroferreira merged commit 1a3960e into mui:master Oct 20, 2023
11 checks passed
@apedroferreira apedroferreira deleted the fix-flaky-tests branch October 20, 2023 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants