enzyme -> RTL: convert the Template screen suites - #483
Merged
Merged
Conversation
Convert all 47 enzyme test suites under screens/Template to React Testing Library (the last remaining screens/ directory), matching the renderWithContexts + screen/fireEvent/waitFor pattern of the prior conversions (ctrliq#398, ctrliq#433-ctrliq#453). Covers: Templates / Template / WorkflowJobTemplate + TemplateSurvey, the JobTemplate and WorkflowJobTemplate Add/Edit/Detail screens, the shared JobTemplateForm / WorkflowJobTemplateForm / WebhookSubForm, the Survey editor (list/item/question add-edit-form/reorder/toolbar/multiple-choice), and the entire WorkflowJobTemplateVisualizer tree (graph/node/link/start/toolbar, the link and node modals, and the node-type resource lists). d3/SVG and PatternFly portals are asserted via element ids, data-cy / data-ouia-component-id, foreignObject content and accessible names rather than geometry or component-name lookups. Two interactions that are infeasible in jsdom (native drag reorder; one visualizer save-error scenario that passes in the browser) are kept as documented skips. 48 suites / 257 tests pass (2 documented skips); no production code changed.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the enzyme → React Testing Library migration for the awx/ui/src/screens/Template/ test suites, converting the last remaining screens/ directory while keeping production code unchanged.
Changes:
- Converted Workflow Job Template Visualizer suites (graph/link/node/toolbar/modals) from enzyme to RTL using
renderWithContexts,screen, andfireEvent. - Converted Template / WorkflowJobTemplate Add/Edit/Detail/container suites to RTL patterns, including form stubbing where appropriate.
- Converted Survey editor suites (list/item/add/edit/toolbar/reorder/multiple-choice) to RTL interactions and assertions.
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerToolbar.test.js | RTL conversion of visualizer toolbar assertions and dispatch tests |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerStartScreen.test.js | RTL conversion for start-screen dispatch and read-only behavior |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerLink.test.js | RTL conversion for SVG link hover/tooltip actions and dispatches |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerGraph.test.js | RTL conversion for graph render, node/link presence, hover help text |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/UnsavedChangesModal.test.js | RTL conversion for unsaved-changes modal button wiring |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/RunStep.test.js | RTL conversion for selecting run-step cards and verifying selection changes |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.js | RTL conversion for portal modal loading + API call assertions |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/WorkflowJobTemplatesList.test.js | RTL conversion for workflow job template selection list behaviors |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/SystemJobTemplatesList.test.js | RTL conversion for system job template selection list behaviors |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/ProjectsList.test.js | RTL conversion for project selection list behaviors |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/NodeTypeStep.test.js | RTL conversion for node-type switching and list rendering |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/JobTemplatesList.test.js | RTL conversion for job template selection list and error state |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeTypeStep/InventorySourcesList.test.js | RTL conversion for inventory source selection list behaviors |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeNextButton.test.js | RTL conversion for wizard next-button behavior and rerender triggering |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeEditModal.test.js | RTL conversion using NodeModal stub to invoke onSave directly |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeDeleteModal.test.js | RTL conversion for delete-node modal dispatch assertions |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeAddModal.test.js | RTL conversion using NodeModal stub to invoke onSave directly |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/DaysToKeepStep.test.js | RTL conversion for required field and initial value assertions |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/LinkModals/LinkModal.test.js | RTL conversion for add/edit link modal dropdown + confirm/cancel |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/LinkModals/LinkEditModal.test.js | RTL conversion for link edit confirm dispatch |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/LinkModals/LinkDeleteModal.test.js | RTL conversion for link delete modal dispatch and portal close |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/LinkModals/LinkAddModal.test.js | RTL conversion for link add confirm dispatch |
| awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/DeleteAllNodesModal.test.js | RTL conversion for delete-all-nodes modal dispatch assertions |
| awx/ui/src/screens/Template/WorkflowJobTemplateEdit/WorkflowJobTemplateEdit.test.js | RTL conversion of WFJT edit container using form stub + API assertions |
| awx/ui/src/screens/Template/WorkflowJobTemplateDetail/WorkflowJobTemplateDetail.test.js | RTL conversion using assertDetail + link/activity/delete-details checks |
| awx/ui/src/screens/Template/WorkflowJobTemplateAdd/WorkflowJobTemplateAdd.test.js | RTL conversion of WFJT add container using form stub + API assertions |
| awx/ui/src/screens/Template/WorkflowJobTemplate.test.js | RTL conversion for top-level WFJT screen tab/route behaviors |
| awx/ui/src/screens/Template/TemplateSurvey.test.js | RTL conversion for TemplateSurvey routing, toggle, update, delete flows |
| awx/ui/src/screens/Template/Templates.test.js | RTL conversion for Templates screen smoke render assertion |
| awx/ui/src/screens/Template/Template.test.js | RTL conversion for Job Template screen tab/route behaviors |
| awx/ui/src/screens/Template/Survey/SurveyToolbar.test.js | RTL conversion for survey toolbar enable/disable and handler wiring |
| awx/ui/src/screens/Template/Survey/SurveyReorderModal.test.js | RTL conversion for reorder modal rendering + save/cancel; keep DnD skipped |
| awx/ui/src/screens/Template/Survey/SurveyQuestionEdit.test.js | RTL conversion for question edit submit, duplicate validation, redirect |
| awx/ui/src/screens/Template/Survey/SurveyQuestionAdd.test.js | RTL conversion for question add submit and duplicate validation |
| awx/ui/src/screens/Template/Survey/SurveyListItem.test.js | RTL conversion for survey row rendering, chips, edit visibility |
| awx/ui/src/screens/Template/Survey/SurveyList.test.js | RTL conversion for list interactions (toggle/select/delete/modal) |
| awx/ui/src/screens/Template/Survey/MultipleChoiceField.test.js | RTL conversion for multiple-choice default toggle behavior |
| awx/ui/src/screens/Template/shared/WorkflowJobTemplateForm.test.js | RTL conversion for WFJT form field rendering and key webhook interactions |
| awx/ui/src/screens/Template/shared/WebhookSubForm.test.js | RTL conversion for webhook subform initial values, service switching, warnings |
| awx/ui/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.js | RTL conversion of JT edit container using form stub + update/cancel flows |
| awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.test.js | RTL conversion using assertDetail + delete/details/error behaviors |
| awx/ui/src/screens/Template/JobTemplateAdd/JobTemplateAdd.test.js | RTL conversion of JT add container using form stub + create/cancel/navigation |
Comment on lines
104
to
108
| test('Delete All button dispatches as expected (duplicate)', () => { | ||
| renderToolbar(); | ||
| fireEvent.click(screen.getByRole('button', { name: 'Delete all nodes' })); | ||
| expect(dispatch).toHaveBeenCalledWith({ | ||
| type: 'SET_SHOW_DELETE_ALL_NODES_MODAL', |
| expect(onClick).toHaveBeenCalledWith(activeStep); | ||
| }); | ||
|
|
||
| test('onNext triggered when triggerNext counter incrimented', () => { |
| ); | ||
| }); | ||
|
|
||
| test('should toggle jt survery on', async () => { |
# Conflicts: # awx/ui/src/screens/Template/WorkflowJobTemplate.test.js
Remove the duplicated Delete All dispatch test; fix the 'incrimented' and 'survery' test-name typos.
awx/ui/node_modules was committed as a self-referential symlink; .gitignore only excludes the directory contents, not the symlink itself. Untrack it so checkout doesn't clobber a real node_modules.
Contributor
Author
|
Thanks for the review. Pushed a commit: removed the duplicated Delete All dispatch test and fixed the incrimented and survery test-name typos. I also removed an accidentally committed node_modules symlink on this branch. |
blaipr
added a commit
to blaipr/ascender
that referenced
this pull request
Jun 17, 2026
These three files were the only overlap between this PR and the screens/Template RTL conversion (ctrliq#483). Make this PR own them outright: convert them from enzyme to React Testing Library, mounted under the real v6 parent route so useParams resolves :id. ctrliq#483 drops these three so the two PRs become independently mergeable in either order, with all three landing as RTL.
Templates.test.js, Template.test.js and WorkflowJobTemplate.test.js are the only files this PR shared with ctrliq#484 (Templates route tree -> v6). ctrliq#484 now owns and RTL-converts those three (mounted for v6). Revert them here so the two PRs touch disjoint files and are independently mergeable in either order; this PR still converts the rest of screens/Template to RTL.
cigamit
pushed a commit
that referenced
this pull request
Jun 18, 2026
…#484) * Convert the Templates route tree to react-router v6 (last <Switch>) App.js is now v6 (#425) and mounts Templates as a descendant at /templates/*, so Templates.js becomes v6 <Routes> with relative children (job_template/add, workflow_job_template/add, job_template/:id/*, workflow_job_template/:id/*, index list). Template.js and WorkflowJobTemplate.js move their internal <Routes> to relative paths and read useParams from react-router-dom-v5-compat (v5 useParams returns {} as a v6 descendant). Tests remount these under the real v6 parent route. This removes the last <Switch> from main, unblocking the eventual react-router-dom-v5-compat bridge removal. * Convert the 3 Template entry/detail test suites to RTL (v6-mounted) These three files were the only overlap between this PR and the screens/Template RTL conversion (#483). Make this PR own them outright: convert them from enzyme to React Testing Library, mounted under the real v6 parent route so useParams resolves :id. #483 drops these three so the two PRs become independently mergeable in either order, with all three landing as RTL.
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
screens/Templatetest suites from enzyme to React Testing Library — the last remainingscreens/directory in the enzyme→RTL migration (follows #398 and #433–#453). 47 enzyme suites converted; no production code changed.Covers:
Templates/Template/WorkflowJobTemplate+TemplateSurveyJobTemplateandWorkflowJobTemplateAdd / Edit / Detail screensJobTemplateForm/WorkflowJobTemplateForm/WebhookSubFormWorkflowJobTemplateVisualizertree — graph / node / link / start-screen / toolbar, the link and node modals, and the node-type resource listsSame pattern as the merged conversions:
renderWithContexts+screen/fireEvent/waitFor, APIs mocked, fixtures and assertion intent preserved. d3/SVG and PatternFly portals are asserted via element ids,data-cy/data-ouia-component-id,foreignObjectcontent and accessible names rather than geometry or component-name lookups.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
npx jest src/screens/Template).test.skipwith a note: native drag-and-drop reorder inSurveyReorderModal, and the pre-existingVisualizersave-error scenario that already carried a// TODO: ... the scenario passes in the uimarker (preserved, not a new regression).