#Upgrading from 7.6.1 to 7.8.0 breaks all transition-related tests

14 messages · Page 1 of 1 (latest)

karmic mulch
#

I just upgraded Mantine from 7.6.1 to 7.8.0 and every single unit test for components that use modal/popover/etc. broke.
The tests normally click a button then get the popup content i.e.

const button = getByTestId('open-calendar-button');
fireEvent.click(button);
const dateButton = getByText('5');

I understand something changed in the behaviour of transitions; replacing get with await find in these tests solves the issues i.e.

fireEvent.click(button);
const dateButton = await findByText('5');

...but that's a LOT of tests.
I wonder if there's a way to revert the transition behavior in 7.8.0 to the way it was before (whatever the change is), to prevent everything form breaking?

winged isle
karmic mulch
#

That is very very strange... Maybe some changes specifically with modals or popovers?

winged isle
#
GitHub

A fully featured React components library. Contribute to mantinedev/mantine development by creating an account on GitHub.

GitHub

A fully featured React components library. Contribute to mantinedev/mantine development by creating an account on GitHub.

dense lava
#

We had the same issue when upgrading. All tests with modals started failing and we had to await these elements instead.

karmic mulch
karmic mulch
#

@winged isle Hey, I've reviewed the commits and understand there haven't been any real changes to these files. I wonder if maybe something else could have possible changed, perhaps in an internal hook?

I have over a hundred tests that break, all for the same reason:
Before, the test opened a modal/popover by clicking a button, either custom of Mantine's (i.e. date input calendar), and used getByTestId to immediately get a content, and that worked.

In 7.8, using get fails, and I must use await findByTestId instead. This is a hefty change and I do consider this to be a breaking change as it affects so many tests for us.

I understand it's a needle in a haystack but I'd love it if you could help figure this out, or let me know where to maybe look.

winged isle
karmic mulch
winged isle
#

You are welcome to explore changes in this patch

karmic mulch
# winged isle You are welcome to explore changes in this patch

Doing this now.
I believe it might be related to this fix:
https://github.com/mantinedev/mantine/pull/5873
If I understand correctly, this makes the update always wait for animations? Which means that before, it didn't, and executed update immediately, which is why I was able to use get without waiting for elements.

If I'm right, then this does sound like the desired behavior, but it results in unexpected errors for those who used transitions like they worked before, such as myself.

GitHub

(Hopefully) fixes #3126 #5193 #5849.
As I found out earlier it's probably related to the automatic batching in React. Therefore this fix uses flushSync() to enforce the state update at the righ...

winged isle
karmic mulch