Skip to content

enzyme -> RTL: convert the InstanceGroup screen suites - #449

Merged
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:feature/rtl-batch-instance-group
Jun 18, 2026
Merged

enzyme -> RTL: convert the InstanceGroup screen suites#449
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:feature/rtl-batch-instance-group

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
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 onto renderWithContexts:

  • InstanceGroup + ContainerGroup Add / Edit (shared forms mocked) and their Forms (pod-spec editor label asserted, not YAML text)
  • InstanceGroup + ContainerGroup Details — fields, delete (related-count reads mocked) + error
  • InstanceGroupList / InstanceGroupListItem — load, selection, bulk delete enable/disable
  • Instances sublist (InstanceList / InstanceListItem, InstanceDetails) — capacity/forks sliders (keyboard), enable toggle, API updates

Interactions now go through accessible roles and real user events. Behaviour and assertions are preserved.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ADDITIONAL INFORMATION

npm test for 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).

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/act patterns with RTL renderWithContexts, 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
cigamit merged commit eb62185 into ctrliq:main Jun 18, 2026
@cigamit cigamit self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants