-
Notifications
You must be signed in to change notification settings - Fork 57
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
Migrate to MUI 5 #3437
Comments
Hello, Thank you very much for this detailed ticket and the associated pull request! To update the snapshots, you first have to delete them, an then execute the test script in the dedicated package. Last thing, you commit messages should look like this:
(you can also check commits in git history to see the format of the commit messages) Regards, |
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Thanks for the answer! I've added But now there are a lot off errors for <div
- class="makeStyles-subscribers-126"
+ class="css-1aqjzxi-subscribers"
/> (Just a side note: That's one more reason to dislike CSS-in-JS :) From my point of view these autogenerated CSS class names only add complexity and improve nothing) New I'll try to find a way to remove random hashes from CSS class names... |
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
I've fixed vitest snapshots Defined a custom snapshot serializer in Updated vitest to latest version, because Also I've fixed some Cypress tests. It seems that
For sure it would be better to find an origin of the error and fix it. But it's hard to reproduce, it seems to be a known bug and people recommend to ignore it https://stackoverflow.com/a/50387233/632199 Two Cypress tests are still unstable:
They work fine locally, so I can't reproduce the problem. However in GutHub they sometimes pass, sometimes fail. |
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Bug: eclipse-sirius#3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com> Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
Bug: #3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com> Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
Bug: #3437 Signed-off-by: Denis Nikiforov <denis.nikif@gmail.com> Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com> Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
The pull request: #3438
I suggest updating MUI to version 5 as Material UI 4 is outdated and does not receive security or performance updates. Also it's a complicated task to combine different versions of MUI in a single application. We managed it in our MUI 5 application based on Sirius Web, but it is really painful.
Also it will allow one to migrate to React 18 later.
What is changed
<TreeView>
component moved to a separate project:<Autocomplete>
component:It requires
getOptionKey
if labels are not uniquerenderOption
should return<li {...props}>
Nested
<Chip>
doesn't requirekey
property, because it's already returned bygetTagProps()
<TextField>
and<Select>
are outlined by default in MUI 5, so added the following to the theme:makeStyles
is replaced by TSS versionhttps://mui.com/material-ui/migration/migrating-from-jss/
Also it doesn't support functions for each individual style property. Only a single function is supported
I didn't use the following version, because it doesn't work:
I guess that now it's recommended to use
styled
instead ofmakeStyles
. But it's your decision, so I leftmakeStyles
as is with slight syntax changes.When we migrated our own app to MUI 5 we decided to drop CSS-in-JS completely, because:
integration-tests/cypress/e2e/project/diagrams/collapse.cy.ts
at check.should('have.css', 'border-bottom', '1px solid rgb(51, 176, 195)')
is failed on my machine, because the border width is0.8px
. So I prefer to check existence of a CSS-class insteadBut it's just our private opinion on CSS-in-JS, not absolute truth
For example in
packages/forms/frontend/sirius-components-widget-reference/src/modals/CreateModal.tsx
nth-child(2)
inmakeStyles
caused runtime warnings so I replaced it by a separate CSS-class inpackages/core/frontend/sirius-components-core/src/workbench/RepresentationNavigation.tsx
I had to add the following line at the beginning of
packages/core/frontend/sirius-components-core/src/index.ts
to fix the error "styled_default is not a function":See for details vitejs/vite#12423 (comment)
<Select>
role attribute is changed frombutton
tocombobox
in MUI . So I updated Cypress tests<Tooltip>
addsaria-label
instead oftitle
to a nested<Link>
Tooltips works for disabled buttons only if the later one is surrounded by span
https://mui.com/material-ui/react-tooltip/#disabled-elements
theme.spacing(1)
returns string8px
instead of number8
. So I had to addparseInt()
inpackages/portals/frontend/sirius-components-portals/src/representations/PortalRepresentation.tsx
theme.palette.text.hint
is removed theme.palette.text.hint is going away mui/material-ui-pickers#1681Slight MUI 5 API changes:
<Popper>
doesn't supporttransition
attribute. If the attribute is specified then Popper is shown in the left upper corner.Removed
trnasition
frompackages/diagrams/frontend/sirius-components-diagrams/src/renderer/palette/tool-section/ToolSection.tsx
andpackages/diagrams/frontend/sirius-components-diagrams/src/renderer/palette/group-tool/GroupPalette.tsx
@emotion/react
peer dependency tosirius-components-forms
to fix "You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used."Cypress tests
I've fixed most of the tests after migration. But there are still some problems. Tests work unstable on my machine. Maybe it works better in your environment. Could you please help to fix it?
Some tests are failed when Cypress is run in a headless mode, probably because of problems with a clipboard or something else.
When run in an interactive mode the following tests are failed for Chrome:
integration-tests/cypress/e2e/project/diagrams/collapse.cy.ts
expected '<div.nopan>' to have CSS property 'border-bottom' with the value '1px solid rgb(51, 176, 195)', but the value was '0.8px solid rgb(51, 176, 195)'
I tried to change Zoom factor in a browser, but it doesn't help. I think the test should not rely on a particular border width.
For Electron the following tests are failed:
integration-tests/cypress/e2e/project/diagrams/collapse.cy.ts
In file
integration-tests/cypress/workbench/Explorer.ts
the test is failed oncy.getByTestId('new-object-modal').should('not.exist')
. But if I addcy.wait(2000)
before this line, the test is passed:integration-tests/cypress/e2e/project/diagrams/group-palette.cy.ts
Error: "expected [data-testid="GroupPalette"] to exist in the DOM"
integration-tests/cypress/e2e/project/diagrams/node-aspect-ratio.cy.ts
Error: "Expected to find element: [data-testid="option-Node"], but never found it."
Vitest
React component snapshots are outdated after migration. And to be honest I have no idea how to fix it
The text was updated successfully, but these errors were encountered: