enzyme -> RTL: convert the Workflow visualizer component suites - #454
Merged
Conversation
Migrate components/Workflow (the shared workflow-visualizer primitives: nodes, links, legend, key, tooltips, start node, help panels) off enzyme/mountWithContexts onto renderWithContexts (React Testing Library). SVG content is asserted via element ids / foreignObject selectors and text; behaviour and assertions are preserved.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the enzyme → React Testing Library migration by converting the Workflow visualizer shared component test suites under awx/ui/src/components/Workflow/ to use RTL render utilities (renderWithContexts) and DOM-based assertions.
Changes:
- Replaced enzyme
mount/mountWithContextsusage with RTLrender/renderWithContexts. - Updated interaction tests to use RTL patterns (
userEvent,fireEvent,waitFor) and DOM selectors (including OUIAdata-ouia-component-id). - Converted a few previously ineffective enzyme assertions into real DOM assertions (though one pause-icon assertion still needs tightening—see stored comments).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| awx/ui/src/components/Workflow/WorkflowTools.test.js | Migrates tool button presence/click tests to RTL, using OUIA selectors and userEvent. |
| awx/ui/src/components/Workflow/WorkflowStartNode.test.js | Migrates hover/tooltip behavior tests to RTL using fireEvent + waitFor. |
| awx/ui/src/components/Workflow/WorkflowNodeTypeLetter.test.js | Migrates node-type letter/icon rendering assertions to RTL (pause-icon assertion currently too weak). |
| awx/ui/src/components/Workflow/WorkflowNodeHelp.test.js | Migrates help-content assertions to DOM-based querySelector + toHaveTextContent. |
| awx/ui/src/components/Workflow/WorkflowLinkHelp.test.js | Migrates link-type rendering assertions to RTL with stable element id selectors. |
| awx/ui/src/components/Workflow/WorkflowLegend.test.js | Migrates legend content checks to RTL screen.getByText. |
| awx/ui/src/components/Workflow/WorkflowHelp.test.js | Migrates mount test to RTL render + screen assertion. |
| awx/ui/src/components/Workflow/WorkflowActionTooltipItem.test.js | Migrates mount test to RTL and asserts the element renders by id. |
| awx/ui/src/components/Workflow/WorkflowActionTooltip.test.js | Migrates tooltip mount test to RTL and asserts foreignObject presence. |
| ); | ||
| expect(wrapper).toHaveLength(1); | ||
| expect(wrapper.containsMatchingElement(<PauseIcon />)); | ||
| expect(container.querySelector('svg')).toBeInTheDocument(); |
| ); | ||
| expect(wrapper).toHaveLength(1); | ||
| expect(wrapper.containsMatchingElement(<PauseIcon />)); | ||
| expect(container.querySelector('svg')).toBeInTheDocument(); |
Scope the pause-icon assertions to the foreignObject's <svg> so they verify the icon rendered rather than matching the outer wrapper svg.
Contributor
Author
|
Thanks for the review. Pushed a commit: the pause-icon assertions now target the svg inside the component foreignObject, so they verify the icon rendered rather than matching the wrapper svg. |
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 shared Workflow visualizer component test suite (
components/Workflow) from enzyme to React Testing Library, as part of the incremental enzyme → RTL migration (now moving from screens into shared components, one directory per PR).Files migrated off
mountWithContexts/enzyme ontorenderWithContexts:WorkflowActionTooltip(+Item),WorkflowHelp,WorkflowNodeHelp,WorkflowLinkHelp,WorkflowNodeTypeLetter,WorkflowLegend,WorkflowStartNode,WorkflowTools.SVG primitives have no ARIA roles, so content is asserted via stable element ids /
foreignObjectselectors andgetByText; the visualizer toolbar buttons are selected by theirdata-ouia-component-id. A couple of dead enzyme assertions (acontainsMatchingElementcall missing itsexpect, atoHaveLength(1)no-op) were upgraded to real DOM assertions. Behaviour and assertions are preserved.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
npm testforcomponents/Workflow: 11 suites, 60 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.