Skip to content

CONSOLE-5226: Update RTL Claude Skill#16446

Open
cajieh wants to merge 1 commit into
openshift:mainfrom
cajieh:update-rtl-claude-skill
Open

CONSOLE-5226: Update RTL Claude Skill#16446
cajieh wants to merge 1 commit into
openshift:mainfrom
cajieh:update-rtl-claude-skill

Conversation

@cajieh
Copy link
Copy Markdown
Contributor

@cajieh cajieh commented May 14, 2026

CONSOLE-5226: Update RTL Claude Skill

Analysis / Root cause:

Solution description:

Screenshots / screen recording:

Test setup:

Test cases:

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:

Summary by CodeRabbit

  • Documentation
    • Updated testing guidance to strengthen alignment with testing standards for async handling, provider selection, and user interaction simulation.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 14, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 14, 2026

@cajieh: This pull request references CONSOLE-5226 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

CONSOLE-5226: Update RTL Claude Skill

Analysis / Root cause:

Solution description:

Screenshots / screen recording:

Test setup:

Test cases:

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested review from jhadvig and rhamilto May 14, 2026 16:16
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cajieh
Once this PR has been reviewed and has the lgtm label, please assign therealjon for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

📝 Walkthrough

Walkthrough

Updates to the RTL test skill documentation that refine test generation guidance for OCP Console. Changes include: adding an initial inspection step for component dependencies, clarifying the decision logic for render vs renderWithProviders based on Redux and React Router requirements, and systematically replacing fireEvent with userEvent throughout all code examples. Additionally updates async/act handling guidance and import patterns in the code generation section to reflect the new userEvent-based approach.

Suggested reviewers

  • jhadvig
  • rhamilto
🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a mostly-empty template with the JIRA reference filled in but all substantive sections (analysis, solution, test cases, browser conformance) left as placeholder comments. Complete the description by filling in: analysis/root cause, solution details explaining the RTL skill updates, test setup/cases, and browser conformance results. The raw summary indicates RTL guidance strengthening—provide concrete details on what changed and why.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: updating the RTL Claude skill documentation, and references the Jira issue CONSOLE-5226 as required.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Custom check not applicable. PR modifies React Testing Library documentation (SKILL.md), not Go/Ginkgo test code. Ginkgo test name validation is irrelevant to this file type.
Test Structure And Quality ✅ Passed Check is not applicable. PR modifies only a Claude skill markdown file for RTL/Jest testing guidance. Contains zero Ginkgo test code that the check targets.
Microshift Test Compatibility ✅ Passed Custom check does not apply. PR updates React Testing Library (RTL) guidance documentation only. No Ginkgo e2e tests are added; MicroShift compatibility check targets e2e tests only.
Single Node Openshift (Sno) Test Compatibility ✅ Passed SNO check not applicable. PR modifies only a React Testing Library skill markdown file with no Ginkgo e2e tests. This check targets Go e2e tests with cluster topology concerns.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only a documentation file (SKILL.md). No deployment manifests, operator code, or controllers present. Check is not applicable.
Ote Binary Stdout Contract ✅ Passed Check not applicable. PR changes only a markdown documentation file for React Testing. OTE Binary Stdout Contract targets Go binaries stdout violations. No Go code modified.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Check not applicable. PR updates React Testing Library docs, not Ginkgo e2e tests. No Go code, IPv4 assumptions, or external connectivity issues found.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/gen-rtl-test/SKILL.md:
- Around line 1104-1121: Strategy 3's guidance is incorrect — remove the "Wrap
test in act() when needed" section and its examples; instead update the examples
and text to emphasize awaiting userEvent calls (e.g., userEvent.setup() and
await user.click(...)) and using findBy*/waitFor for async dropdown interactions
(e.g., screen.findByText('Option 1') or waitFor(...)) and explicitly call out
that `@testing-library/user-event` v14+ handles act() internally and explicit
act() wrapping around userEvent is discouraged; ensure any references to act(),
the BAD/GOOD snippets, and the import line (import { ..., act } ...) are removed
or replaced with the corrected patterns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e12549f6-291e-4390-98c0-6977aa74cf84

📥 Commits

Reviewing files that changed from the base of the PR and between c9d3418 and 6d8ebc1.

📒 Files selected for processing (1)
  • .claude/skills/gen-rtl-test/SKILL.md
📜 Review details
🔇 Additional comments (1)
.claude/skills/gen-rtl-test/SKILL.md (1)

28-29: LGTM!

Also applies to: 50-84, 86-108, 591-606, 665-692, 769-778, 839-865, 1593-1594

Comment thread .claude/skills/gen-rtl-test/SKILL.md Outdated
Comment on lines 1104 to 1121
**Strategy 3: Wrap test in act() when needed**
```typescript
// Import act from @testing-library/react
import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';
import { render, screen, waitFor, act } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

// ❌ BAD: Causes act() warning for dropdown/select interactions
const user = userEvent.setup();
const dropdown = screen.getByText('Select Option');
fireEvent.click(dropdown);
await user.click(dropdown);

// ✅ GOOD: Wrap in act() for complex interactions
await act(async () => {
fireEvent.click(dropdown);
await user.click(dropdown);
});
const option = await screen.findByText('Option 1');
fireEvent.click(option);
await user.click(option);
```
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does @testing-library/user-event v14+ require explicit act() wrapping for interactions?

💡 Result:

No. For @testing-library/user-event v14+, you generally should NOT explicitly wrap interactions in act. The docs and maintainers state that user-event utilities are already integrated with Testing Library’s act-handling; if you see act warnings, it typically means your environment/config isn’t using the same @testing-library/dom instance as the framework wrapper, or you have asynchronous work (often related to timers) that you need to wait for (not manually act-wrap the interaction). Evidence: - Maintainer guidance: “No, wrapping with act is neither required nor recommended.” and if await(user.anyAPI) yields act warnings but calling the interaction without waiting avoids them, that suggests you might not be using the same @testing-library/dom configuration instance as the framework wrapper [1]. - user-event docs emphasize using userEvent.setup and awaiting interactions (since they return Promises) rather than act-wrapping [2]. - Reports of “not wrapped in act” in v14 are usually resolved by awaiting user-event methods correctly; maintainers/users note v14 APIs are async and should be awaited (not act-wrapped) [3]. - There are edge cases where act appears to be needed due to fake timers or other asynchronous behavior, but these are exceptions tied to test setup/timers and can often be addressed by waiting (e.g., waitFor) or proper fake-timer handling, not by blanket act wrapping [4]. Practical takeaway: 1) Use userEvent.setup and always await userEvent methods (they return Promises in v14+) [2][5]. 2) If you still get act warnings, check that @testing-library/dom isn’t duplicated/resolved differently than your @testing-library/react wrapper expects [1] and handle fake timers via user-event’s advanceTimers option rather than act-wrapping [6][7]. If you tell me whether you’re using React Testing Library, Jest vs Vitest, and whether fake timers are enabled, I can suggest the exact setup pattern to eliminate act warnings.

Citations:


🏁 Script executed:

#!/bin/bash
# Check lines 621 and 1104-1121 in the SKILL.md file
echo "=== Line 621 context (620-630) ==="
sed -n '620,630p' .claude/skills/gen-rtl-test/SKILL.md

echo ""
echo "=== Lines 1104-1121 (Strategy 3) ==="
sed -n '1104,1121p' .claude/skills/gen-rtl-test/SKILL.md

echo ""
echo "=== Broader context: lines 1070-1130 ==="
sed -n '1070,1130p' .claude/skills/gen-rtl-test/SKILL.md | cat -n

Repository: openshift/console

Length of output: 3302


Strategy 3 presents outdated act() guidance that contradicts both line 621 and modern @testing-library/user-event best practices.

Line 621 correctly states act() is "rarely needed" because userEvent, findBy*, and waitFor already handle it internally. However, Strategy 3 presents wrapping userEvent in explicit act() as a solution for dropdown/select interactions.

This is incorrect. The web search confirms that @testing-library/user-event v14+ does not require and actively discourages explicit act() wrapping around user-event calls. When act() warnings appear with userEvent, the root cause is typically:

  • Missing await on userEvent methods (fixed by Strategies 1–2)
  • Unhandled async work or fake timers (addressed via waitFor or timer config, not act wrapping)
  • Environment/config issues

The BAD example in Strategy 3 (await user.click(dropdown)) doesn't fail because it's missing act(); it fails because it likely doesn't await properly or the async effect isn't resolved. The "GOOD" solution should be Strategy 1 (ensure you await) or Strategy 2 (use findBy*), not wrap in act().

Recommendation: Remove Strategy 3 entirely. If dropdowns are causing issues, the fix is one of the first two strategies, not explicit act wrapping.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/skills/gen-rtl-test/SKILL.md around lines 1104 - 1121, Strategy 3's
guidance is incorrect — remove the "Wrap test in act() when needed" section and
its examples; instead update the examples and text to emphasize awaiting
userEvent calls (e.g., userEvent.setup() and await user.click(...)) and using
findBy*/waitFor for async dropdown interactions (e.g., screen.findByText('Option
1') or waitFor(...)) and explicitly call out that `@testing-library/user-event`
v14+ handles act() internally and explicit act() wrapping around userEvent is
discouraged; ensure any references to act(), the BAD/GOOD snippets, and the
import line (import { ..., act } ...) are removed or replaced with the corrected
patterns.

@cajieh cajieh force-pushed the update-rtl-claude-skill branch from 6d8ebc1 to a039d18 Compare May 14, 2026 16:27
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

@cajieh: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants