Skip to content

enzyme -> RTL: convert the ActivityStream screen suites - #442

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

enzyme -> RTL: convert the ActivityStream screen suites#442
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/rtl-batch-activity-stream

Conversation

@blaipr

@blaipr blaipr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Converts the ActivityStream 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:

  • ActivityStream — page heading renders after load
  • ActivityStreamListItem — row rendering
  • ActivityStreamDescription — plain text, linked-resource (href), and fallback (no link) cases
  • ActivityStreamDetailButton — detail modal open/close and detail fields (assertDetail)

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 ActivityStream directory: 4 suites, 7 tests, all passing. ESLint clean. No production code changed — test-only.

One detail-modal assertion was adapted: the original read the CodeEditor's value prop for the JSON changes payload. RTL can't read props and Ace renders no DOM text under jsdom, so the test instead asserts the changes-preview element is present and that VariablesDetail engaged JSON mode (only selected when the changes value parses as JSON) — preserving the original intent.

Migrate the ActivityStream screen's test suite off enzyme/mountWithContexts
onto renderWithContexts (React Testing Library): ActivityStream page,
ActivityStreamListItem, ActivityStreamDescription and the detail modal
button. Behaviour and assertions are preserved; interactions go through
accessible roles and real user events.
@blaipr blaipr changed the title Convert ActivityStream screen tests from enzyme to React Testing Library enzyme -> RTL: convert the ActivityStream screen suites Jun 16, 2026
@cigamit
cigamit requested a review from Copilot June 17, 2026 07:34

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 Enzyme → React Testing Library migration by converting the ActivityStream screen’s test suites to use renderWithContexts, RTL screen queries, and userEvent-driven interactions while preserving existing behavioral assertions.

Changes:

  • Migrates ActivityStream-related tests from mountWithContexts (Enzyme) to renderWithContexts (RTL).
  • Updates assertions to use accessible queries (getByRole, findByRole) and real user interactions (user.click).
  • Adjusts the detail modal “changes” assertion to validate the CodeEditor presence and JSON/YAML mode selection under jsdom constraints.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
awx/ui/src/screens/ActivityStream/ActivityStream.test.js Converts screen load assertion to RTL and waits for the heading to appear.
awx/ui/src/screens/ActivityStream/ActivityStreamDescription.test.js Converts link/plain-text behavior tests to RTL role/text-based assertions.
awx/ui/src/screens/ActivityStream/ActivityStreamDetailButton.test.js Converts modal open/detail assertions to RTL + userEvent, updates CodeEditor-related assertions for jsdom.
awx/ui/src/screens/ActivityStream/ActivityStreamListItem.test.js Converts basic render test to RTL and asserts row presence.

renderWithContexts(
<table>
<tbody>
<ActivityStreamListItem
@blaipr
blaipr force-pushed the feature/rtl-batch-activity-stream branch from 36542fb to 5e5cd4d Compare June 17, 2026 07:58
@blaipr

blaipr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The dead onSelect prop has been removed from the ActivityStreamListItem test.

@cigamit
cigamit merged commit 641cc25 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