-
Feature
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
None
Since enzyme doesn't support react 17+, we will remove its usage.
Most of the usage is in snapshot tests, this epic will include a list of epics to remove the snapshot tests.
Each React component that was tested using snapshot, should still be tested using React testing library, or Capybara.
Per the handbook:
Write tests in React Testing Library for simple component tests, and write system tests using Capybara for more complex scenarios.
We should aim to keep the test coverage the same or better, so if the snapshot included visible text, the replacement test should also test for it. It is encouraged to also test the functionality.
If a test is testing PF3 code, it is better to rewrite the PF3 code as part of SAT-17164 and as part of the upgrade task, to also rewrite the test. PF3 can be recognized by imports from patternfly-react where PF5 imports from @patternfly/react-core. When a component is rewritten, the specific rewrite task should be added as a dependency to this feature (using the JIRA link action).
Forum discussion:
https://community.theforeman.org/t/how-do-we-do-ui-tests-and-should-we-continue-that-way/42983
UI Testing Guidelines: https://github.com/theforeman/foreman/blob/develop/developer_docs/ui-testing-guidelines.asciidoc
Reminder to run the tests from foreman core and not the plugin it self (https://github.com/theforeman/foreman/blob/develop/developer_docs/plugins.asciidoc#using-webpack-in-plugins).
The end goal in this feature is to not have enzyme imports at all (note that shallow, mount, render, configure imports from foreman core or foreman-js are also enzyme)