Skip to content

enzyme -> RTL: convert the Workflow visualizer component suites - #454

Merged
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-workflow
Jun 18, 2026
Merged

enzyme -> RTL: convert the Workflow visualizer component suites#454
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-components-workflow

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
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 onto renderWithContexts: WorkflowActionTooltip(+Item), WorkflowHelp, WorkflowNodeHelp, WorkflowLinkHelp, WorkflowNodeTypeLetter, WorkflowLegend, WorkflowStartNode, WorkflowTools.

SVG primitives have no ARIA roles, so content is asserted via stable element ids / foreignObject selectors and getByText; the visualizer toolbar buttons are selected by their data-ouia-component-id. A couple of dead enzyme assertions (a containsMatchingElement call missing its expect, a toHaveLength(1) no-op) were upgraded to real DOM assertions. Behaviour and assertions are preserved.

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

npm test for components/Workflow: 11 suites, 60 tests, all passing. ESLint clean (--no-ignore). No production code changed — test-only.

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.

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 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 / mountWithContexts usage with RTL render / renderWithContexts.
  • Updated interaction tests to use RTL patterns (userEvent, fireEvent, waitFor) and DOM selectors (including OUIA data-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.
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
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
cigamit merged commit 71af0ec 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