Possibility to opt out of removing `data-testid` from icons on production
Summary
Removing the data-testid from icons only for production is very confusing because if you run e2e tests with the production version, as we do, you might have your tests running locally when implementing them, because you use the dev version, but have them fail on CI that uses the prod version. If you forget about this point you might have to wait for the CI to finish to figure out the issue. This also makes debugging very difficult unless you're aware of this subtlety.
Is it possible to add some flag/env var to opt out of removing the data-testid?
Related PR.
Examples
No response
Motivation
No response
Search keywords: icons, testid, data-testid
The decision to only show testids in dev was an idea to find middle ground between users relying on them for tests and avoiding them ending up in production ssr content. For now the remedy would be to provide your own data-testid to the icons you want to test. We're exploring a property to enable this testid globally.
This property is exactly what I'm asking for, thanks 🙌
I am currently updating a production app to MUI v7 and this is the main blocker we are getting at this point. We do use a few of the default data-testid in our e2e suites, and it would be much appreciated to be able to opt-out
Hi there, I got the same problem while upgrading MUI. Another idea, what about removing data-testid from development, too?
Hi! Same as other devs have mentioned, we are using data-testid in our e2e testing. Is there an ETA for putting back the data-testid, or at least the flag to enable it, please? Thanks in advance.
Bump, bringing it back would be great.
Indeed, this was a very useful feature. Any timeline to bring it back?
This is the only thing that we need in a project to upgrade from v6 to v7. Please, consider bringing it back guys!
Just wrote a few Playwright tests just to realize they don't pass in CI because of this 😁
I'm running my tests with a dev build locally to make it more convenient, but in CI I use the production build to get closer to the real thing.
This caught me in CI as well - How about a theme property for toggling this?
Bump this up. This breaks all automated playwrigth tests. Releasing production code takes a lot of time because all QA testing are now done manually...
Any update on this issue? Miss this feature
This behavior is really obnoxious. It will be extremely difficult to explain to devs writing playwright tests why their tests are working against a local dev server but failing against a production build in CI. I don't really care which behavior is used, just please make it consistent in all environments (or provide a way to make it consistent)
Its nice we have control ourselves when to add it. But on generics, like inside Calendar the month selection testid is now gone and we have to write ugly things for it (aria-label).
Also its way confusing that on dev it shows. We have dev during local (when we write tests), but prod in ci. That makes everything confusing! Its there or its not. Simple. Please take into consideration these inner components from MUI itself. Like DataGrid Actions vertical icon ...
We have dev during local (when we write tests), but prod in ci.
Yes, this ☝️