Skip to content

[test] Sync regression test layout with Base UI / Material UI #17564

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

Closed
wants to merge 5 commits into from

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Apr 26, 2025

I wanted to run the regression tests in dev mode to debug #17538.

But since #17214, it's no longer possible. I'm bringing this back, progressively making Base UI the gold reference (rather than Material UI) for code-infra.

Copy link

github-actions bot commented Apr 26, 2025

Thanks for adding a type label to the PR! 👍

@oliviertassinari oliviertassinari changed the title Fix regression [test] Sync regression test layout with Base UI / Material UI Apr 26, 2025
@mui-bot
Copy link

mui-bot commented Apr 26, 2025

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

Generated by 🚫 dangerJS against 60a3728

@oliviertassinari oliviertassinari added test type: regression A bug that reintroduces previously resolved issues or breaks existing functionality. labels Apr 27, 2025
Copy link
Contributor

@romgrk romgrk Apr 27, 2025

Choose a reason for hiding this comment

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

Wouldn't we want to move towards ESM? I'd bring the changes here to the core instead of the other way around.

Also, right now the e2e & regression setups are close mirrors of each other, if we change one of them we should change both. This applies for .mocharc, vite.config.js and package.json.

Copy link
Member Author

@oliviertassinari oliviertassinari Apr 28, 2025

Choose a reason for hiding this comment

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

Wouldn't we want to move towards ESM?

Yeah, but if you run pnpm run mocha in HEAD from the /test/regressions folder, it crash on ESM vs. CJS import conflict, which seems expected since we set "type": "module", in that folder package but not in the root package. So I think it's a bug fix.

if we change one of them we should change both. This applies for .mocharc, vite.config.js and package.json.

The priority seems reversed, if there is something to copy it's first Base UI or Material UI, and second MUI X.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not rename to the file to .mjs instead then?

The priority seems reversed, if there is something to copy it's first Base UI or Material UI, and second MUI X.

What I meant is that in X, test/regressions and test/e2e are very similar. Same file/folder layout, same npm scripts. If we're applying changes to one of those folders, they should be applied to both folders.

Copy link
Contributor

Choose a reason for hiding this comment

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

In #17214 I tried to move deps & config towards where they're used. Calling the commands such as mocha from the root means we need all the deps for all the test setups (unit, regressions, e2e) mashed into the root package.json.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, a variant of this PR: #17583, but I don't really see the value, having the same depends between the different test env seems OK.

Comment on lines +22 to +54
'@mui/x-data-grid': path.resolve(import.meta.dirname, '../../packages/x-data-grid/src'),
'@mui/x-data-grid-generator': path.resolve(
import.meta.dirname,
'../../packages/x-data-grid-generator/src',
),
'@mui/x-data-grid-pro': path.resolve(
import.meta.dirname,
'../../packages/x-data-grid-pro/src',
),
'@mui/x-data-grid-premium': path.resolve(
import.meta.dirname,
'../../packages/x-data-grid-premium/src',
),
'@mui/x-date-pickers': path.resolve(import.meta.dirname, '../../packages/x-date-pickers/src'),
'@mui/x-date-pickers-pro': path.resolve(
import.meta.dirname,
'../../packages/x-date-pickers-pro/src',
),
'@mui/x-charts': path.resolve(import.meta.dirname, '../../packages/x-charts/src'),
'@mui/x-charts-pro': path.resolve(import.meta.dirname, '../../packages/x-charts-pro/src'),
'@mui/x-tree-view': path.resolve(import.meta.dirname, '../../packages/x-tree-view/src'),
'@mui/x-tree-view-pro': path.resolve(
import.meta.dirname,
'../../packages/x-tree-view-pro/src',
),
'@mui/x-license': path.resolve(import.meta.dirname, '../../packages/x-license/src'),
'@mui/x-telemetry': path.resolve(import.meta.dirname, '../../packages/x-telemetry/src'),
'@mui/x-internals': path.resolve(import.meta.dirname, '../../packages/x-internals/src'),
'@mui/material-nextjs': path.resolve(
import.meta.dirname,
'../../node_modules/@mui/monorepo/packages/mui-material-nextjs/src',
),
docs: path.resolve(import.meta.dirname, '../../node_modules/@mui/monorepo/docs'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I have tried to move away from alias lists. If we do want them back, we should probably find a way to avoid having multiple copies of it.

Copy link
Member Author

@oliviertassinari oliviertassinari Apr 28, 2025

Choose a reason for hiding this comment

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

Without this, we have to build the whole project and have it in watch mode to debug/run the visual regression tests, which feels super slow (+200s on my end). Too slow to be usable in practice. #17584

https://github.com/mui/base-ui/blob/a7451a08424f12d913c8355cccf3274ef5f3e055/package.json#L38 or https://github.com/mui/material-ui/blob/a705e1f15075b2deb59263868bfa7b1d9f84cdd4/package.json#L75 seems better.

we should probably find a way to avoid having multiple copies of it.

Oh yeah, once we remove babel alias. I'm not worried about this, I think it's about copying the Base UI repo or Material UI repo. They should get this right. We shouldn't have to think about this in the MUI X repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah, once we remove babel alias. I'm not worried about this, I think it's about copying the Base UI repo or Material UI repo. They should get this right. We shouldn't have to think about this in the MUI X repo.

Sorry I don't understand what you mean there. Could we create an aliases.js file at the root to avoid repeating the alias list?

@oliviertassinari oliviertassinari marked this pull request as draft April 27, 2025 14:34
"private": true,
"type": "module",
"scripts": {
Copy link
Member Author

Choose a reason for hiding this comment

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

It seems simpler to have all the actions at the root. I don't actually mind actually, but we might as well copy the references (Base UI, Material UI).

@@ -43,8 +43,11 @@
"test:e2e": "pnpm run release:build && cd test/e2e && pnpm run start",
"test:e2e-website": "npx playwright test test/e2e-website --config test/e2e-website/playwright.config.ts",
"test:e2e-website:dev": "PLAYWRIGHT_TEST_BASE_URL=http://localhost:3001 npx playwright test test/e2e-website --config test/e2e-website/playwright.config.ts",
"test:regressions": "pnpm run release:build && cd test/regressions && pnpm run start",
"test:regressions:dev": "cd test/regressions && pnpm run start",
Copy link
Member Author

@oliviertassinari oliviertassinari Apr 27, 2025

Choose a reason for hiding this comment

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

test:regressions:dev doesn't work

"test:regressions:dev": "cd test/regressions && pnpm run start",
"test:regressions": "cross-env NODE_ENV=production pnpm test:regressions:build && concurrently --success first --kill-others \"pnpm test:regressions:run\" \"pnpm test:regressions:server\"",
"test:regressions:build": "cross-env TEST_BUILD=true vite build --config test/regressions/vite.config.js",
"test:regressions:dev": "pnpm test:regressions:build && pnpm test:regressions:server",
Copy link
Member Author

@oliviertassinari oliviertassinari Apr 28, 2025

Choose a reason for hiding this comment

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

I would want to use this here:

Suggested change
"test:regressions:dev": "pnpm test:regressions:build && pnpm test:regressions:server",
"test:regressions:dev": "cross-env TEST_BUILD=true vite --config test/regressions/vite.config.js --port 5001",

but Vite seems unable to build properly in dev mode compared to webpack, so falling back to this 🙃. Sad, I don't understand.

Comment on lines +22 to +54
'@mui/x-data-grid': path.resolve(import.meta.dirname, '../../packages/x-data-grid/src'),
'@mui/x-data-grid-generator': path.resolve(
import.meta.dirname,
'../../packages/x-data-grid-generator/src',
),
'@mui/x-data-grid-pro': path.resolve(
import.meta.dirname,
'../../packages/x-data-grid-pro/src',
),
'@mui/x-data-grid-premium': path.resolve(
import.meta.dirname,
'../../packages/x-data-grid-premium/src',
),
'@mui/x-date-pickers': path.resolve(import.meta.dirname, '../../packages/x-date-pickers/src'),
'@mui/x-date-pickers-pro': path.resolve(
import.meta.dirname,
'../../packages/x-date-pickers-pro/src',
),
'@mui/x-charts': path.resolve(import.meta.dirname, '../../packages/x-charts/src'),
'@mui/x-charts-pro': path.resolve(import.meta.dirname, '../../packages/x-charts-pro/src'),
'@mui/x-tree-view': path.resolve(import.meta.dirname, '../../packages/x-tree-view/src'),
'@mui/x-tree-view-pro': path.resolve(
import.meta.dirname,
'../../packages/x-tree-view-pro/src',
),
'@mui/x-license': path.resolve(import.meta.dirname, '../../packages/x-license/src'),
'@mui/x-telemetry': path.resolve(import.meta.dirname, '../../packages/x-telemetry/src'),
'@mui/x-internals': path.resolve(import.meta.dirname, '../../packages/x-internals/src'),
'@mui/material-nextjs': path.resolve(
import.meta.dirname,
'../../node_modules/@mui/monorepo/packages/mui-material-nextjs/src',
),
docs: path.resolve(import.meta.dirname, '../../node_modules/@mui/monorepo/docs'),
Copy link
Member Author

@oliviertassinari oliviertassinari Apr 28, 2025

Choose a reason for hiding this comment

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

Without this, we have to build the whole project and have it in watch mode to debug/run the visual regression tests, which feels super slow (+200s on my end). Too slow to be usable in practice. #17584

https://github.com/mui/base-ui/blob/a7451a08424f12d913c8355cccf3274ef5f3e055/package.json#L38 or https://github.com/mui/material-ui/blob/a705e1f15075b2deb59263868bfa7b1d9f84cdd4/package.json#L75 seems better.

we should probably find a way to avoid having multiple copies of it.

Oh yeah, once we remove babel alias. I'm not worried about this, I think it's about copying the Base UI repo or Material UI repo. They should get this right. We shouldn't have to think about this in the MUI X repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, a variant of this PR: #17583, but I don't really see the value, having the same depends between the different test env seems OK.

@oliviertassinari oliviertassinari added the type: bug A bug or unintended behavior in the components. label Apr 28, 2025
@oliviertassinari oliviertassinari marked this pull request as ready for review April 28, 2025 01:35
@oliviertassinari oliviertassinari removed the type: regression A bug that reintroduces previously resolved issues or breaks existing functionality. label Apr 28, 2025
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label May 5, 2025
Copy link

github-actions bot commented May 5, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link

This pull request has been inactive for 30 days. Please remove the stale label or leave a comment to keep it open. Otherwise, it will be closed in 15 days.

@github-actions github-actions bot added the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Jun 11, 2025
Copy link

This pull request has been closed due to 15 days of inactivity after being marked stale.

@github-actions github-actions bot closed this Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: out-of-date The pull request has merge conflicts and can't be merged stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. test type: bug A bug or unintended behavior in the components.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants