Skip to content

enzyme -> RTL: convert the ExecutionEnvironment screen suites - #435

Merged
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-batch-execution-environment
Jun 18, 2026
Merged

enzyme -> RTL: convert the ExecutionEnvironment screen suites#435
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-batch-execution-environment

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Continue the enzyme → React Testing Library migration (step 3 of the React modernization) by converting the screens/ExecutionEnvironment suites. Follows #385/#398, screens/CredentialType (#433), and screens/NotificationTemplate (#434).

  • Converts the eight enzyme suites to renderWithContexts: ExecutionEnvironmentListItem, ExecutionEnvironmentList, ExecutionEnvironmentDetails, ExecutionEnvironmentAdd, ExecutionEnvironmentEdit, the EE-template sub-list (ExecutionEnvironmentTemplateList + ListItem), and the shared ExecutionEnvironmentForm.
  • Add/Edit stub the shared form and drive its onSubmit/onCancel/submitError props (Add also asserts the ?image= query-param prefill).
  • Details/List delete flows use the established PF4-modal-in-jsdom pattern (confirm by label + fireEvent); for Details, the DeleteButton related-count fetch is short-circuited with an empty request list so the confirm modal opens under auto-mock.
  • Form disabled-state assertions target the field inputs and each Lookup's search button by ouiaId (organization-open / credential-open); two prop-inspection-only delete-detail-count assertions with no DOM-observable behavior are dropped.

No application code changes — test-only. screens/ExecutionEnvironment no longer references enzyme.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ASCENDER VERSION
awx: 25.4.1.dev51+ga3f06620f9
ADDITIONAL INFORMATION
  • All 43 tests in screens/ExecutionEnvironment pass (npm test).
  • Test files are not linted (ignored by the eslint flat config) and there are no behavior changes, so no browser smoke-test is required for this test-only batch.
  • Part of the step-3 directory-by-directory conversion; both enzyme and RTL helpers coexist until the last enzyme import is removed.

Convert the eight enzyme test suites in screens/ExecutionEnvironment to React
Testing Library via renderWithContexts (continuing step 3 after ctrliq#433/ctrliq#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.

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

Migrates the screens/ExecutionEnvironment test suites from Enzyme to React Testing Library as part of the ongoing UI modernization, replacing component-prop inspection with user-visible behavior assertions and the established PF modal interaction patterns.

Changes:

  • Converted ExecutionEnvironment list/details/add/edit/form/template-list suites to use renderWithContexts + RTL queries/interactions.
  • Updated delete/copy flows to drive PatternFly modals/buttons via accessible labels (with fireEvent where required by PF modal aria-hiding in jsdom).
  • Stubbed the shared ExecutionEnvironmentForm in Add/Edit container tests to focus on container behavior (submit/cancel/error + query-param prefill).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
awx/ui/src/screens/ExecutionEnvironment/shared/ExecutionEnvironmentForm.test.js Converted form suite to RTL; updated field/disabled assertions.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentTemplate/ExecutionEnvironmentTemplateListItem.test.js Converted template sub-list row test to RTL rendering + text assertions.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentTemplate/ExecutionEnvironmentTemplateList.test.js Converted template sub-list test to RTL with async render assertions.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentListItem.test.js Converted list row suite to RTL; drives copy flow via user interaction.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.test.js Converted list suite to RTL; drives multi-select delete confirm flow.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentEdit/ExecutionEnvironmentEdit.test.js Converted edit container suite to RTL with a stubbed form.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentDetails/ExecutionEnvironmentDetails.test.js Converted details suite to RTL; short-circuits DeleteButton related-count fetch for modal open.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironmentAdd/ExecutionEnvironmentAdd.test.js Converted add container suite to RTL with a stubbed form + query-param prefill assertion.
awx/ui/src/screens/ExecutionEnvironment/ExecutionEnvironment.test.js Minor comment update.

Comment on lines +68 to +75
<ExecutionEnvironmentForm
onCancel={onCancel}
onSubmit={onSubmit}
executionEnvironment={executionEnvironment}
options={mockOptions}
me={mockMe}
{...props}
/>
organization: 9,
})
);
expect(history.location.pathname).toBe('/execution_environments/42/details');
Comment on lines 73 to 75
expect(history.location.pathname).toEqual(
'/execution_environments/42/details'
);
expect(
wrapper.find('DeleteButton').prop('deleteDetailsRequests')
).toHaveLength(4);
expect(history.location.pathname).toBe('/execution_environments');
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The current revision drops the options prop override on ExecutionEnvironmentForm and waits for the pathname change (not just the API call) in the Add, Edit, and Details flows, so the redirect assertions are no longer racy.

@cigamit
cigamit merged commit 2acf685 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