fix: enzyme testing replaced by react tester#36026
fix: enzyme testing replaced by react tester#36026jciasenza wants to merge 0 commit intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @jciasenza! This repository is currently maintained by @openedx/wg-maintenance-edx-platform. Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.
|
There was a problem hiding this comment.
Thanks for this! It's awesome to see enzyme tests replaced!
Would it be possible to use userEvent instead of fireEvent for these? It is recommended by testing-library, and the differences are described here: https://testing-library.com/docs/user-event/intro/#differences-from-fireevent
fireEventdispatches DOM events, whereasuser-eventsimulates full interactions, which may fire multiple events and do additional checks along the way.
A lot of the time moving to userEvent from fireEvent is very straightforward. It looks like that is likely the case here.
|
Hi @brian-smith-tcril, I'll try it and let you know!! |
kdmccormick
left a comment
There was a problem hiding this comment.
@jciasenza , it looks like the edited test case is failing. If you click into "Javascript tests / JS" check below, you should be able to see how it is failing. If you have a development environment set up, you could also run the tests locally with jest.
|
It looks like the error is so I think adding the testing library packages as dev dependencies should resolve this. |
|
Yes @brian-smith-tcril , that is the error but apparently the version of React is 16 and I am looking for the compatible version for @testing-library/react and @testing-library/user-event |
From https://www.npmjs.com/package/@testing-library/react/v/14.3.1
|
ccc8635 to
0dd9f8f
Compare
|
I am closing this pr due to too many commies with many conflicts, I will try to make a new one, cleaner |
|
@brian-smith-tcril, @kdmccormick I have made a new PR that now passes the tests #36159 , when you can look at it |
Replaced enzyme display dropdown on toggling dropdown test in Main file for react-renderer tests.
I made PR of this issue #35245
And Testing OK
If something needs to be modified, let me know, thank you!!!
Atte
Juan Carlos (Aulasneo)
Developer Checklist
Test suites passing
Documentation and test plan updated, if applicable
Received code-owner approving review