Skip to content

CONSOLE-5211: Add Cypress-to-Playwright migration skills and context#16315

Open
stefanonardo wants to merge 1 commit intoopenshift:mainfrom
stefanonardo:CONSOLE-5211
Open

CONSOLE-5211: Add Cypress-to-Playwright migration skills and context#16315
stefanonardo wants to merge 1 commit intoopenshift:mainfrom
stefanonardo:CONSOLE-5211

Conversation

@stefanonardo
Copy link
Copy Markdown
Contributor

@stefanonardo stefanonardo commented Apr 22, 2026

Summary

  • Add /migrate-cypress and /debug-test Claude Code skills for Cypress-to-Playwright test migration
  • Add .claude/migration-context.md shared reference (adapted from cypress-migrator.mdc)
  • Add minimal Playwright migration section to AGENTS.md

Summary by CodeRabbit

  • Documentation

    • Added comprehensive migration guide for converting Cypress e2e tests to Playwright, including principles, selector mappings, and transformation rules
    • Added debugging workflow to diagnose and fix failing Playwright tests
    • Added migration tool workflow for automated Cypress-to-Playwright conversion
  • Chores

    • Updated AGENTS.md with Playwright migration references and formatting improvements

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

openshift-ci-robot commented Apr 22, 2026

@stefanonardo: This pull request references CONSOLE-5211 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:

Summary

  • Add /migrate-cypress and /debug-test Claude Code skills for Cypress-to-Playwright test migration
  • Add .claude/migration-context.md shared reference (adapted from cypress-migrator.mdc)
  • Add minimal Playwright migration section to AGENTS.md

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

This pull request adds documentation and Claude skill definitions to support migration of Console's e2e test suite from Cypress to Playwright. New files include a migration-context document that defines guiding principles, selector translations, and structural transformation rules; two skill definitions (debug-test and migrate-cypress) that codify workflows for diagnosing failing tests and converting test suites; and updates to AGENTS.md to reference these new resources and clarify quoting conventions in code examples.

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. It lacks required sections from the template: Analysis/Root cause, detailed Solution description, Test setup, Test cases, and Browser conformance. Add missing template sections: explain the migration strategy rationale, detail the skill implementations, specify how to test the skills, and document any browser/environment requirements.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding Cypress-to-Playwright migration skills and context, directly matching the PR's core objective.
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 PR contains only documentation and skill definition files in Markdown format; no Ginkgo test code changes present, so check is not applicable.
Test Structure And Quality ✅ Passed This check is not applicable to the provided pull request. The custom check specifically requests a review of Ginkgo test code for quality requirements including setup/cleanup patterns, timeouts, assertion messages, and consistency with existing test patterns. However, this PR contains only documentation and Claude skill definition files (Markdown-based) with no test code whatsoever—neither Ginkgo (Go) nor any other testing framework. The PR addresses Cypress-to-Playwright migration guidance and tooling, which are operational in JavaScript/TypeScript, not Go. Since there are no test blocks, assertions, cluster operations, or test fixtures to evaluate, the check criteria cannot be applied.
Microshift Test Compatibility ✅ Passed This PR is documentation-only and adds no Ginkgo e2e tests, so the MicroShift test compatibility check is not applicable and passes by default.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR contains only documentation and Claude skill files; no Go test files present, so SNO compatibility check for Ginkgo e2e tests is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR contains only documentation changes (Markdown and Claude skill configs) with no Kubernetes deployment manifests, operator code, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed PR modifies only markdown documentation files; no Go code, test infrastructure, or process-level initializers affected. OTE Binary Stdout Contract check is not applicable.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR contains only documentation and skill definition files; no Ginkgo e2e tests with IPv4 assumptions or external connectivity requirements are present.

✏️ 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.

🧹 Nitpick comments (3)
.claude/skills/debug-test/SKILL.md (2)

25-25: Optional: Add language specifiers to fenced code blocks.

Static analysis flagged that the code blocks at lines 25 and 74 are missing language specifiers, which can affect syntax highlighting and rendering.

🔧 Add language hints for better rendering
-```
+```text
 /debug-test e2e/tests/cluster-settings/upstream-modal.spec.ts
 /debug-test e2e/tests/cluster-settings/ --workers=2
 /debug-test `@admin`

And for line 74:

```diff
-```
+```text
 Debug Summary: <target>
   Total tests: N

This improves markdown rendering but doesn't affect functionality.

Also applies to: 74-74

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/debug-test/SKILL.md at line 25, Add language specifiers to
the two fenced code blocks in SKILL.md (the block showing the debug-test command
lines and the block showing the "Debug Summary" snippet) so they render
correctly; update the opening ``` fences to include an appropriate language hint
like "text" (e.g., change ``` to ```text) for the code block containing
"/debug-test e2e/tests/..." and the block containing "Debug Summary: <target>  
Total tests: N" (look for the fenced code blocks near the examples referenced in
the review).

88-101: Practical troubleshooting for realistic failure modes.

The troubleshooting section correctly distinguishes between test bugs, infrastructure issues, and flakiness. The guidance on flaky tests — use MCP to identify the timing-sensitive interaction and fix with proper waits/clicks rather than masking with retries — is essential.

✍️ Optional: Address static analysis adverb placement suggestion

The static analysis tool suggests moving the adverbs before the verbs for better style:

-### Flaky test (passes sometimes, fails sometimes)
+### Flaky test (sometimes passes, sometimes fails)

This is a minor style improvement and entirely optional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/debug-test/SKILL.md around lines 88 - 101, Move optional
adverbs so they appear before the verbs to satisfy the static analysis style
suggestion in the Troubleshooting section of SKILL.md; e.g., change phrasing
like "diagnose from error messages alone" to "diagnose alone from error
messages" or "focus on fixes that don't require live inspection" to "focus on
fixes that don't require live inspection" as appropriate—apply this consistently
to sentences in the "Playwright MCP not connected" and "Flaky test (passes
sometimes, fails sometimes)" paragraphs, preserving meaning and approved
content.
AGENTS.md (1)

125-128: Clear integration point for Playwright migration workflow.

The new section effectively directs users to the right skills and shared context. The placement and cross-references are correct.

📝 Optional: Consider adding brief context about the migration scope

If you'd like to provide additional context for future contributors, you could mention the scope or timeline of the Cypress→Playwright migration:

 ## Playwright migration
 
-We are migrating Cypress e2e tests to Playwright. Use `/migrate-cypress` to convert test files and `/debug-test` to fix failing tests. Shared migration context (translation tables, structural rules, checklist) is in `.claude/migration-context.md`.
+Console is migrating its e2e test suite from Cypress to Playwright. Use `/migrate-cypress` to convert test files and `/debug-test` to fix failing tests. Shared migration context (translation tables, structural rules, checklist) is in `.claude/migration-context.md`.

This is purely optional — the current version is perfectly functional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 125 - 128, Add a short sentence under the "##
Playwright migration" heading that clarifies the migration scope and
expectations (for example, which test suites are in-scope and a rough timeline
or milestone), referencing the existing commands /migrate-cypress and
/debug-test and the shared context file .claude/migration-context.md so
contributors know where to find translation tables and rules; keep the addition
one concise line to avoid changing placement or cross-references.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.claude/skills/debug-test/SKILL.md:
- Line 25: Add language specifiers to the two fenced code blocks in SKILL.md
(the block showing the debug-test command lines and the block showing the "Debug
Summary" snippet) so they render correctly; update the opening ``` fences to
include an appropriate language hint like "text" (e.g., change ``` to ```text)
for the code block containing "/debug-test e2e/tests/..." and the block
containing "Debug Summary: <target>   Total tests: N" (look for the fenced code
blocks near the examples referenced in the review).
- Around line 88-101: Move optional adverbs so they appear before the verbs to
satisfy the static analysis style suggestion in the Troubleshooting section of
SKILL.md; e.g., change phrasing like "diagnose from error messages alone" to
"diagnose alone from error messages" or "focus on fixes that don't require live
inspection" to "focus on fixes that don't require live inspection" as
appropriate—apply this consistently to sentences in the "Playwright MCP not
connected" and "Flaky test (passes sometimes, fails sometimes)" paragraphs,
preserving meaning and approved content.

In `@AGENTS.md`:
- Around line 125-128: Add a short sentence under the "## Playwright migration"
heading that clarifies the migration scope and expectations (for example, which
test suites are in-scope and a rough timeline or milestone), referencing the
existing commands /migrate-cypress and /debug-test and the shared context file
.claude/migration-context.md so contributors know where to find translation
tables and rules; keep the addition one concise line to avoid changing placement
or cross-references.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: e1425cb7-534e-4d4e-b410-deba32856448

📥 Commits

Reviewing files that changed from the base of the PR and between 233c92c and 582ce1e.

📒 Files selected for processing (4)
  • .claude/migration-context.md
  • .claude/skills/debug-test/SKILL.md
  • .claude/skills/migrate-cypress/SKILL.md
  • AGENTS.md
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Run `yarn i18n` after adding translatable strings and commit updated i18n keys alongside code changes that affect i18n
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Backend dependency updates should be in separate commits from core logic changes to isolate vendor folder changes
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Bug fix commits should be prefixed with bug number or Jira key (e.g., OCPBUGS-1234: Fix ...)
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Commit subject lines should answer 'what changed' and body should answer 'why'
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Feature branch names should follow the format CONSOLE-#### (Jira story number)
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Bug fix branch names should follow the format OCPBUGS-#### (Jira bug number)
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Before making changes to the dynamic plugin SDK, ensure changes do not impact the public API by consulting the plugin-api-review skill and checking for breaking changes
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Always consult TESTING.md before writing or modifying tests to ensure compliance with Jest, Cypress, and Go testing patterns and best practices
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Always consult STYLEGUIDE.md when writing new code or reviewing style questions for TypeScript, Go, and SCSS conventions
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Always consult INTERNATIONALIZATION.md when adding or modifying user-facing strings for i18n patterns and useTranslation usage
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Maintain backward compatibility in the dynamic plugin SDK as it is a public API consumed by external plugins
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-04-22T12:54:27.313Z
Learning: Provide comprehensive documentation for all public APIs in the dynamic plugin SDK
🪛 LanguageTool
.claude/skills/debug-test/SKILL.md

[style] ~99-~99: The adverb ‘sometimes’ is usually put before the verb ‘passes’.
Context: ...structure setup first. ### Flaky test (passes sometimes, fails sometimes) If a test passes on r...

(ADVERB_WORD_ORDER)


[style] ~99-~99: The adverb ‘sometimes’ is usually put before the verb ‘fails’.
Context: ...rst. ### Flaky test (passes sometimes, fails sometimes) If a test passes on re-run without any...

(ADVERB_WORD_ORDER)

🪛 markdownlint-cli2 (0.22.0)
.claude/skills/debug-test/SKILL.md

[warning] 25-25: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 74-74: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (13)
AGENTS.md (1)

24-40: Nice cleanup — formatting now matches repo conventions.

The addition of the blank line, trailing comma in the JSON example, and consistent use of double quotes in the TypeScript snippet align well with the repository's style guidelines.

.claude/skills/migrate-cypress/SKILL.md (3)

32-54: Well-structured phased approach with pragmatic MCP fallback.

The analysis phase correctly emphasizes understanding intent before translating code, and the MCP-based selector discovery with graceful degradation when unavailable is a solid design choice.


56-95: Implementation and validation phases follow best practices.

The page object example demonstrates the correct pattern extending BasePage, and the validation workflow appropriately includes type checking and linting before test execution. The migration summary format provides clear accountability.


96-124: Solid translation principles and practical troubleshooting guidance.

The emphasis on understanding intent over transliteration, eliminating fixed waits, and using framework components first are all critical for producing maintainable Playwright tests. The troubleshooting section addresses realistic failure modes.

.claude/migration-context.md (6)

1-29: Strong foundational principles and accurate selector mappings.

The five principles correctly prioritize understanding intent, test isolation, idiomatic API usage, framework reuse, and live verification. The selector command table comprehensively covers Console's custom commands with accurate Playwright equivalents.


30-119: Comprehensive and accurate API translation reference.

The translation tables correctly map Cypress patterns to idiomatic Playwright equivalents. Particularly notable are the strong guidance against waitForTimeout(), the emphasis on robustClick() for PatternFly interactions, and the replacement of shell commands with KubernetesClient API calls.


120-210: Excellent structural transformation guidance with clear examples.

Rules 1-4 effectively demonstrate the paradigm shift from Cypress's shared state model to Playwright's isolated tests. The code examples correctly use test.step, cleanup fixtures, page object methods, and condition-based waits.


212-318: Complete structural rules and well-reasoned isolation strategies.

Rules 5-8 correctly address shell command replacement, scoping patterns, conditional logic, and retry configuration. The three isolation strategies provide clear decision criteria: prefer self-contained (A), use shared setup (B) only for expensive read-only resources, and leverage API creation (C) for UI-focused tests.


319-394: Clear page object pattern and comprehensive file mapping.

The page object example correctly demonstrates BasePage extension, locator definition patterns, and the documented locator priority. The Gherkin collapse guidance correctly maps the 4-file indirection to Playwright's more direct structure, and the file mapping table provides clear migration paths.


395-421: Essential checklist and critical "never do" constraints.

The migration checklist covers the complete workflow systematically. The "never do" list correctly identifies anti-patterns that would produce fragile or non-idiomatic tests — particularly the requirement to import from e2e/fixtures rather than @playwright/test (ensures custom fixtures are available) and the prohibition on waitForTimeout() (ensures reliability).

.claude/skills/debug-test/SKILL.md (3)

32-53: Methodical diagnosis workflow with appropriate stability verification.

The run phase correctly uses --retries=0 to expose flakiness, and the stability check for single files (3 consecutive runs) is a pragmatic safeguard. The MCP-based diagnosis systematically gathers viewport, accessibility tree, interaction, and error data before classifying failures.


55-87: Sensible fix prioritization and thorough validation.

The priority ordering correctly addresses cascading failures first (imports/types), then uses MCP data for stale selectors, followed by timing and missing awaits. The requirement to verify each fix individually before proceeding prevents accumulating multiple changes that obscure root causes.


102-108: Clear rules for the debug workflow.

The rules correctly enforce MCP-first diagnosis, architectural boundaries, strict retry configuration during debugging, and linting after fixes.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: stefanonardo
Once this PR has been reviewed and has the lgtm label, please ask for approval from rhamilto. 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

@stefanonardo
Copy link
Copy Markdown
Contributor Author

/hold
until we set up Playwright in the project

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 24, 2026

@stefanonardo: 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

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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.

3 participants