enzyme -> RTL: convert the TemplateList component suites - #467
Merged
Conversation
Migrate components/TemplateList (the shared templates list + list item) off enzyme/mountWithContexts onto renderWithContexts (React Testing Library). Selection, bulk delete, and copy/launch/edit actions are driven through the real controls; behaviour and assertions are preserved.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the UI test migration from enzyme to React Testing Library by converting the shared TemplateList component test suites to drive assertions via accessible queries and real user interactions, while keeping behavior and API-call expectations intact.
Changes:
- Migrated
TemplateListItemtests frommountWithContextstorenderWithContexts, adding a table wrapper helper and replacing enzyme DOM traversal with RTL queries (screen,within,waitFor). - Migrated
TemplateListtests to RTL user flows for selection, bulk delete (including deletion error modal handling), and copy actions; addedreadOptionsmocks required by the component’s request bundle. - Introduced
settleTooltips()usage to avoid PatternFly tooltip/focus-related async leakage between tests after closing modals.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
awx/ui/src/components/TemplateList/TemplateListItem.test.js |
Converts TemplateListItem suite to RTL with accessible queries and updated copy/error assertions. |
awx/ui/src/components/TemplateList/TemplateList.test.js |
Converts TemplateList suite to RTL, exercising selection, delete/confirm/error-close flows, and copy behavior with appropriate API mocks. |
cigamit
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Converts the shared TemplateList component test suite (
components/TemplateList) from enzyme to React Testing Library, continuing the enzyme → RTL migration (components, one directory per PR).Files migrated off
mountWithContexts/enzyme ontorenderWithContexts:TemplateList,TemplateListItem.Selection (checkbox state), bulk delete (toolbar → confirm → deletion-error modal), and the per-row copy/launch/edit/visualizer actions are driven through the real controls and asserted by accessible name + the resulting API calls. Behaviour and assertions are preserved.
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
npm testforcomponents/TemplateList: 2 suites, 26 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.