enzyme -> RTL: convert the NotificationList component suites - #470
Merged
cigamit merged 2 commits intoJun 18, 2026
Conversation
Migrate components/NotificationList (NotificationList and NotificationListItem) off enzyme/mountWithContexts onto renderWithContexts (React Testing Library). The per-row start/success/error/approval toggles are driven through the real Switch controls (by id/accessible name) and asserted via the associate/disassociate API calls; behaviour and assertions are preserved.
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the NotificationList component test suites from Enzyme (mountWithContexts) to React Testing Library (renderWithContexts) as part of the ongoing UI testing modernization, keeping assertions focused on user-observable behavior (PF Switch toggles + resulting API calls / error modal).
Changes:
- Converted
NotificationListItemtests to RTL queries (screen.getByRole) anduserEventinteractions for PFSwitchcontrols. - Converted
NotificationListtests to RTL rendering and assertions, driving toggles via real checkbox inputs (by stableid) and validating associate/disassociate API calls plus the error modal path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| awx/ui/src/components/NotificationList/NotificationListItem.test.js | Replaces Enzyme mounting and .simulate() with RTL renderWithContexts, screen queries, and userEvent clicks for row toggles. |
| awx/ui/src/components/NotificationList/NotificationList.test.js | Replaces Enzyme act()/wrapper assertions with RTL waitFor, checkbox id-based toggle interactions, and modal-based error assertions. |
Comment on lines
+190
to
+192
| // the original suite asserted an ErrorDetail rendered; the toggle failure | ||
| // surfaces it inside the "Error!" AlertModal dialog. | ||
| expect(await screen.findByText('Error!')).toBeInTheDocument(); |
Assert the failure surfaces the Error! AlertModal dialog containing the ErrorDetail (Details) toggle, instead of only checking for the Error! text.
Contributor
Author
|
Thanks for the review. Pushed a commit: the failure path now asserts the Error AlertModal dialog is present and contains the ErrorDetail Details toggle, rather than only checking for the Error text. |
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 NotificationList component test suite (
components/NotificationList) from enzyme to React Testing Library, continuing the enzyme → RTL migration (components, one directory per PR).Files migrated off
mountWithContexts/enzyme ontorenderWithContexts:NotificationList,NotificationListItem.The per-row start/success/error/approval toggles are driven through the real PF
Switchcontrols (disambiguated by their stable input ids / accessible names) and asserted viatoBeChecked()+ the associate/disassociate API calls; the failure path asserts theError!AlertModal. Behaviour and assertions are preserved.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
npm testforcomponents/NotificationList: 2 suites, 19 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.