enzyme -> RTL: convert the NotificationTemplate screen suites - #434
Merged
cigamit merged 2 commits intoJun 18, 2026
Merged
Conversation
Convert the four enzyme test suites in screens/NotificationTemplate to React Testing Library via renderWithContexts (continuing step 3 after ctrliq#398/ctrliq#433): - NotificationTemplateListItem, NotificationTemplateList, NotificationTemplateDetail, and the shared NotificationTemplateForm. - Bulk-delete uses the PF4-modal-in-jsdom pattern (confirm by label + fireEvent). The test-notification toast asserts on its title text since the PF AlertGroup toast has no role=alert. - The poll-and-toast flow uses jest.runAllTimersAsync to drain the test() -> setTimeout -> readDetail -> onAddToast chain under fake timers. - The form's react-ace editors are stubbed to render their value (jsdom cannot query ace content), and OrganizationLookup's async fetch is settled in act; secret-revert is covered for all six notification types. 31 tests pass; screens/NotificationTemplate no longer references enzyme.
Contributor
There was a problem hiding this comment.
Pull request overview
Continues the Enzyme → React Testing Library migration by converting the screens/NotificationTemplate test suites to RTL patterns (renderWithContexts, screen, userEvent, timer flushing), with no production UI code changes.
Changes:
- Converted
NotificationTemplateForm, list, list-item, and detail suites from Enzyme helpers to RTL helpers/queries. - Updated interaction patterns for PF modal confirmation and async toast polling (fake timers +
runAllTimersAsync). - Added test stubs for CodeEditor rendering to make editor values assertable in jsdom.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| awx/ui/src/screens/NotificationTemplate/shared/NotificationTemplateForm.test.js | Migrates the shared form tests to RTL, including CodeEditor stubbing and secret-revert coverage. |
| awx/ui/src/screens/NotificationTemplate/NotificationTemplateList/NotificationTemplateListItem.test.js | Migrates list item row/action tests (copy/test notification) to RTL. |
| awx/ui/src/screens/NotificationTemplate/NotificationTemplateList/NotificationTemplateList.test.js | Migrates list screen tests (load/select/delete/add/toast) to RTL; includes modal confirm + timer-driven toast chain. |
| awx/ui/src/screens/NotificationTemplate/NotificationTemplateDetail/NotificationTemplateDetail.test.js | Migrates detail view assertions to RTL and uses shared assertDetail helper. |
Contributor
Author
|
Thanks for the review. The current revision of this branch already uses NotificationTemplatesAPI for the list load, delete, and capabilities paths (there is no OrganizationsAPI left in the suite), the test-notification test awaits the rows before clicking, and assertCommonDetails reads the name and description off the mock object. These points are covered. |
cigamit
approved these changes
Jun 18, 2026
cigamit
pushed a commit
that referenced
this pull request
Jun 18, 2026
* enzyme -> RTL: convert the ExecutionEnvironment screen suites Convert the eight enzyme test suites in screens/ExecutionEnvironment to React Testing Library via renderWithContexts (continuing step 3 after #433/#434): - ListItem, List, Details, Add, Edit, the EE-template sub-list (List + ListItem), and the shared ExecutionEnvironmentForm. - Add/Edit stub the shared form and drive its onSubmit/onCancel/submitError props (Add also exposes the query-param image prefill). - Details/List delete flows use the PF4-modal-in-jsdom confirm-by-label + fireEvent pattern; for Details the DeleteButton related-count fetch is short-circuited with an empty request list so the confirm modal opens. - Form disabled-state assertions target the field inputs and each Lookup's search button by ouiaId; drop two prop-inspection-only delete-detail-count assertions with no DOM-observable behavior. 43 tests pass; screens/ExecutionEnvironment no longer references enzyme. * Address Copilot review comments
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
Continue the enzyme → React Testing Library migration (step 3 of the React modernization) by converting the
screens/NotificationTemplatesuites. Follows the infrastructure in #385, thescreens/Userbatch (#398), andscreens/CredentialType(#433).renderWithContexts:NotificationTemplateListItem,NotificationTemplateList,NotificationTemplateDetail, and the sharedNotificationTemplateForm.fireEvent).AlertGrouptoast does not exposerole="alert"; the poll-and-toast chain (test()→setTimeout→readDetail→onAddToast) is drained withjest.runAllTimersAsyncunder fake timers.OrganizationLookup's async fetch is settled inact, and secret-revert is covered for all six notification types.No application code changes — test-only.
screens/NotificationTemplateno longer references enzyme.ISSUE TYPE
COMPONENT NAME
ASCENDER VERSION
ADDITIONAL INFORMATION
screens/NotificationTemplatepass (npm test).