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

[code-infra] Prepare some tests to work in vitest/playwright #14926

Merged
merged 5 commits into from
Oct 14, 2024

Conversation

JCQuintas
Copy link
Member

@JCQuintas JCQuintas commented Oct 11, 2024

Porting a change from #14508

Basically making the render independent from other test runs by not having a globally defined variable for the test.

Also removes done() from two tests 😅

### Scrollbars

The changes on columns.DataGridPro.test.tsx are due to playwright not displaying scrollbars by default.

If it is desirable to display the scrollbars, then I can revert this and force playwright to show them in headless mode instead.

@JCQuintas JCQuintas added test component: data grid This is the name of the generic UI component, not the React module! labels Oct 11, 2024
@JCQuintas JCQuintas self-assigned this Oct 11, 2024
@mui-bot
Copy link

mui-bot commented Oct 11, 2024

Deploy preview: https://deploy-preview-14926--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 20a142f

@JCQuintas JCQuintas requested a review from a team October 11, 2024 15:12
@JCQuintas JCQuintas changed the title [data-grid] Independent test rendering logic [DataGrid] Independent test rendering logic Oct 11, 2024
@JCQuintas JCQuintas changed the title [DataGrid] Independent test rendering logic [code-infra] Prepare some tests to work in vitest/playwright Oct 11, 2024
@JCQuintas JCQuintas added the scope: code-infra Specific to the core-infra product label Oct 11, 2024
@JCQuintas JCQuintas requested a review from a team October 11, 2024 22:20
Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd leave the approval right to xGrid because of the comment. 🤔

const isColDefWidth114Present = colDefWidthArgs.some((width) => width === 114);
expect(isColDefWidth114Present).to.equal(true);
const widthArgs = onColumnWidthChange.args.map((arg) => Math.round(arg[0].width));
expect(widthArgs).to.deep.equal([120, 64]);
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, this needs a review from xGrid as it looks like something functional has changed. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the scrollbar is not rendered, so the size is different.

It took me a while to find the actual issue.

As I said, there are two options:

  1. Test all without scrollbar
  2. Enable scrollbars to all playwright tests if the scrollbar is important

Copy link
Member Author

Choose a reason for hiding this comment

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

Noticed the CI is still erroring on the changes, I might have to go with 2 regardless for this specific error 😓

Copy link
Member

Choose a reason for hiding this comment

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

As I said, there are two options:

  1. Test all without scrollbar
  2. Enable scrollbars to all playwright tests if the scrollbar is important

But why did the behavior of the scrollbar change if the playwright package had not been bumped? 🤔
Is it the same issue blocking us here: #13672?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, they are unrelated.

Behaviour is based on the browser arguments, karma is using the playwright browser executable only, and passing its own arguments in, which means it shows scrollbars in headless mode.

Playwright on the other hand, passes their own arguments in, which means it will hide the scrollbars in headless mode .

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've reverted the changes specific to scrollbar, as the 2nd option seems to fix it cleanly.

Copy link
Member

Choose a reason for hiding this comment

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

Cool. 👍
LGTM then, I've restarted a flaky unit test. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! scope: code-infra Specific to the core-infra product test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants