enzyme -> RTL: convert the InstanceGroup screen suites - #449
Merged
Conversation
Migrate the InstanceGroup screen's test suite off enzyme/mountWithContexts onto renderWithContexts (React Testing Library): instance-group and container-group Add/Edit/Details/Form, the InstanceGroupList + item, and the Instances sublist (capacity sliders, enable toggles). Behaviour and assertions are preserved; interactions go through accessible roles and real user events.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the incremental UI test migration away from Enzyme by converting the InstanceGroup screen’s test suites to React Testing Library. It keeps coverage focused on user-visible behavior and accessibility-driven interactions while remaining test-only (no production code changes).
Changes:
- Replaced Enzyme
mountWithContexts/actpatterns with RTLrenderWithContexts,screen, and real user events. - Updated assertions to prefer accessible roles/names and behavior-based checks (e.g., modal open/close, button enable/disable, API calls).
- Improved isolation and async stability in several suites (fresh test objects,
waitFor/findBy*, tooltip settling where needed).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| awx/ui/src/screens/InstanceGroup/shared/InstanceGroupForm.test.js | Migrates the shared InstanceGroup form tests to RTL with user-event driven submit/cancel and field updates. |
| awx/ui/src/screens/InstanceGroup/shared/ContainerGroupForm.test.js | Converts ContainerGroup form tests to RTL, including async CredentialLookup behavior and pod-spec editor visibility. |
| awx/ui/src/screens/InstanceGroup/Instances/InstanceListItem.test.js | Migrates row rendering/expanded-row assertions and slider-driven capacity updates to RTL interactions. |
| awx/ui/src/screens/InstanceGroup/Instances/InstanceList.test.js | Converts Instances sublist suite to RTL, covering associate modal, selection-driven actions, and health check flows. |
| awx/ui/src/screens/InstanceGroup/InstanceGroupList/InstanceGroupListItem.test.js | Updates list item row assertions (type/capabilities/actions) to RTL queries via roles/cells. |
| awx/ui/src/screens/InstanceGroup/InstanceGroupList/InstanceGroupList.test.js | Migrates list suite to RTL, covering fetch/render, delete flows, protected rows disabling delete, and error states. |
| awx/ui/src/screens/InstanceGroup/InstanceGroupEdit/InstanceGroupEdit.test.js | Uses an RTL-friendly mocked shared form to directly drive edit submit/cancel handlers and verify navigation/API calls. |
| awx/ui/src/screens/InstanceGroup/InstanceGroupDetails/InstanceGroupDetails.test.js | Converts details suite to RTL, including DeleteButton confirmation flow with related-count reads mocked. |
| awx/ui/src/screens/InstanceGroup/InstanceGroupAdd/InstanceGroupAdd.test.js | Uses a mocked shared form under RTL to exercise create submit/cancel and submission error behavior. |
| awx/ui/src/screens/InstanceGroup/InstanceDetails/InstanceDetails.test.js | Migrates instance detail tests to RTL for health check/disassociate flows, capability gating, and error handling. |
| awx/ui/src/screens/InstanceGroup/ContainerGroupEdit/ContainerGroupEdit.test.js | Converts ContainerGroup edit suite to RTL with mocked shared form and options-fetch verification. |
| awx/ui/src/screens/InstanceGroup/ContainerGroupDetails/ContainerGroupDetails.test.js | Migrates ContainerGroup details tests to RTL, including credential link assertion and delete capability gating. |
| awx/ui/src/screens/InstanceGroup/ContainerGroupAdd/ContainerGroupAdd.test.js | Converts ContainerGroup add suite to RTL with mocked shared form and options-driven pod spec defaults. |
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 InstanceGroup screen's test suite from enzyme to React Testing Library, continuing the incremental enzyme → RTL migration (one screen directory per PR).
Files migrated off
mountWithContexts/enzyme ontorenderWithContexts:Add/Edit(shared forms mocked) and theirForms (pod-spec editor label asserted, not YAML text)Details— fields, delete (related-count reads mocked) + errorInstanceGroupList/InstanceGroupListItem— load, selection, bulk delete enable/disableInstancessublist (InstanceList/InstanceListItem,InstanceDetails) — capacity/forks sliders (keyboard), enable toggle, API updatesInteractions now go through accessible roles and real user events. Behaviour and assertions are preserved.
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
npm testfor the InstanceGroup directory: 17 suites, 81 tests, all passing. ESLint clean. No production code changed — test-only.A couple of enzyme-only no-op assertions (
wrapper.length === 1, duplicate hidden-button cases) were folded into stronger behavioural checks, and one mislabeled list test was renamed to reflect the real mechanism (select-all disables Delete when a row lacks delete capability).