Skip to content

CONSOLE-5409: Add Playwright e2e test for operator lifecycle metadata UI#16701

Open
perdasilva wants to merge 1 commit into
openshift:mainfrom
perdasilva:operator-lifecycle-metadata-e2e
Open

CONSOLE-5409: Add Playwright e2e test for operator lifecycle metadata UI#16701
perdasilva wants to merge 1 commit into
openshift:mainfrom
perdasilva:operator-lifecycle-metadata-e2e

Conversation

@perdasilva

@perdasilva perdasilva commented Jul 2, 2026

Copy link
Copy Markdown

Analysis / Root cause:
The operator lifecycle metadata UI (Cluster Compatibility and Support Phase columns on the Installed Operators page) had no e2e test coverage. Since no catalog with real lifecycle metadata exists yet, the test uses mocked API responses to verify the UI renders correctly across all three states.

Solution description:
Adds a Playwright e2e test (frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts) and mock data helpers (frontend/e2e/mocks/operator-lifecycle.ts) that:

  1. Install the web-terminal operator from the redhat-operators catalog via k8sClient
  2. Mock the /api/olm/lifecycle/** endpoint using page.route() with a mutable reference pattern (consistent with update-modal.spec.ts)
  3. Read the cluster's actual releaseVersion from SERVER_FLAGS to build accurate mock data
  4. Skip automatically on clusters without the OLMLifecycleAndCompatibility feature gate enabled
  5. Verify three lifecycle states across test.step blocks:
    • Active support + compatible cluster — "Maintenance support" phase badge and "Compatible" indicator
    • Self-support — all phases expired, shows "Self-support" badge
    • Incompatible — cluster version not in compatibility list, shows "Incompatible" indicator
  6. Clean up the Subscription and CSVs in afterAll

Mock dates are computed dynamically relative to the current date to avoid time-bomb failures.

Screenshots / screen recording:

Test setup:

  • Requires a cluster with the OLMLifecycleAndCompatibility feature gate enabled (for the OPERATOR_LIFECYCLE_METADATA feature flag)
  • The redhat-operators CatalogSource must be available in openshift-marketplace
  • On clusters without the feature gate, the test is automatically skipped

Test cases:

  • Lifecycle columns show "Compatible" and active support phase name when mock data includes the cluster version and current-date phases
  • Lifecycle columns show "Self-support" badge when all mock phases have expired
  • Lifecycle columns show "Incompatible" when mock platform compatibility excludes the cluster version
  • Test is skipped on clusters without the OLMLifecycleAndCompatibility feature gate

Browser conformance:

  • Chrome

Additional info:
Verified against a live OCP 5.0 nightly cluster with the OLMLifecycleAndCompatibility feature gate enabled.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added end-to-end test coverage for operator lifecycle metadata in the installed Operators list.
    • Introduced reusable lifecycle mock payload helpers for active/compatible, self-support (expired phases), and incompatible scenarios.
    • Provisions an OLM Subscription, waits for the CSV to reach Succeeded, and validates lifecycle metadata UI columns using mocked lifecycle API responses.
    • Executes only when lifecycle metadata is enabled, deriving expected compatibility from the configured release version.
    • Cleans up the created Subscription and related CSVs after the test completes.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 2, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@perdasilva: This pull request explicitly references no jira issue.

Details

In response to this:

Analysis / Root cause:
The operator lifecycle metadata UI (Cluster Compatibility and Support Phase columns on the Installed Operators page) had no e2e test coverage. Since no catalog with real lifecycle metadata exists yet, the test uses mocked API responses to verify the UI renders correctly across all three states.

Solution description:
Adds a Playwright e2e test (frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts) and mock data helpers (frontend/e2e/mocks/operator-lifecycle.ts) that:

  1. Install the web-terminal operator from the redhat-operators catalog via k8sClient
  2. Mock the /api/olm/lifecycle/** endpoint using page.route() with a mutable reference pattern (consistent with update-modal.spec.ts)
  3. Read the cluster's actual releaseVersion from SERVER_FLAGS to build accurate mock data
  4. Verify three lifecycle states across test.step blocks:
  • Active support + compatible cluster — "Maintenance support" phase badge and "Compatible" indicator
  • Self-support — all phases expired, shows "Self-support" badge
  • Incompatible — cluster version not in compatibility list, shows "Incompatible" indicator
  1. Clean up the Subscription and CSVs in afterAll

Mock dates are computed dynamically relative to the current date to avoid time-bomb failures.

Screenshots / screen recording:

Test setup:

  • Requires a cluster with TechPreviewNoUpgrade feature gate enabled (for the OPERATOR_LIFECYCLE_METADATA feature flag)
  • The redhat-operators CatalogSource must be available in openshift-marketplace

Test cases:

  • Lifecycle columns show "Compatible" and active support phase name when mock data includes the cluster version and current-date phases
  • Lifecycle columns show "Self-support" badge when all mock phases have expired
  • Lifecycle columns show "Incompatible" when mock platform compatibility excludes the cluster version

Browser conformance:

  • Chrome

Additional info:
Verified against a live OCP 5.0 nightly cluster with tech preview enabled.

🤖 Generated with Claude Code

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 cajieh and fsgreco July 2, 2026 10:12
@openshift-ci

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: perdasilva
Once this PR has been reviewed and has the lgtm label, please assign cajieh 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

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds lifecycle mock factories and a Playwright e2e spec that provisions an OLM subscription, intercepts lifecycle API responses, and verifies lifecycle metadata labels for compatible, self-support, and incompatible states.

Changes

Operator Lifecycle E2E Test

Layer / File(s) Summary
Lifecycle payload helpers
frontend/e2e/mocks/operator-lifecycle.ts
Adds LifecycleData, date helpers, phase generators, and three lifecycle payload factories for active, expired, and incompatible cases.
Subscription readiness setup
frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts
Defines test constants and CSV inspection types, creates the OLM Subscription, waits for a succeeded CSV, and cleans up created resources.
Lifecycle UI assertions
frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts
Mocks lifecycle API responses, opens the operators page, derives cluster version context, and verifies the UI labels for three lifecycle scenarios.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Microshift Test Compatibility ⚠️ Warning The new test creates OLM Subscription/CSV resources and uses openshift-marketplace, but has no MicroShift skip, apigroup tag, or exutil.IsMicroShiftCluster guard. Add a MicroShift skip/apigroup guard, or avoid OLM/TechPreview-dependent setup so the test won’t run on MicroShift.
✅ Passed checks (14 passed)
Check name Status Explanation
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 All new test, describe, and step titles are static strings; no interpolated names, timestamps, or generated identifiers appear in the added spec.
Test Structure And Quality ✅ Passed PASS: The new Playwright spec uses bounded install/poll timeouts, cleans up Subscription/CSVs in afterAll, and follows existing mutable-route/test.step patterns.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new Playwright test only installs an operator, mocks an API, and checks UI text; it makes no multi-node/HA assumptions and needs no SNO skip.
Topology-Aware Scheduling Compatibility ✅ Passed Only e2e test/mocks changed; no deployment manifests, controller code, affinity, node selectors, replicas, or PDBs were introduced.
Ote Binary Stdout Contract ✅ Passed The new mock and Playwright spec add no stdout writes in main/suite setup; no console.log/info, process.stdout, klog, or RunSpecs-style code appears in the changed files.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No hardcoded IPv4/localhost, IP parsing, or public internet calls were added; the test uses in-cluster K8s/Playwright routes only.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons were present in the changed files.
Container-Privileges ✅ Passed No changed manifests or container specs; only Playwright test/mocks in frontend/e2e, and no privileged/root/host* security settings were added.
No-Sensitive-Data-In-Logs ✅ Passed No new console/logger output or similar logging appears in the changed files; the added test and mocks only manipulate lifecycle data and assertions.
Title check ✅ Passed The title is concise, Jira-prefixed, and accurately summarizes the main change: a Playwright e2e test for operator lifecycle metadata UI.
Description check ✅ Passed The description follows the template closely with root cause, solution, setup, tests, browser coverage, and additional info; only screenshots and reviewers are incomplete.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (3)
frontend/e2e/mocks/operator-lifecycle.ts (1)

1-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate duplicated shapes across type and factory functions.

The phase/platformCompatibility literal shape is declared three times (LifecycleData, activePhases, expiredPhases), and the schema string plus versions wrapper is repeated identically in all three factories. This makes it easy for the schema and mock shape to drift out of sync when one call site is updated but not the others.

♻️ Proposed consolidation
+type LifecyclePhase = { name: string; startDate: string; endDate: string };
+type PlatformCompatibility = { name: string; versions: string[] };
+
 export type LifecycleData = {
   package: string;
   schema: string;
   versions?: {
     name: string;
-    platformCompatibility?: { name: string; versions: string[] }[];
-    phases?: { name: string; startDate: string; endDate: string }[];
+    platformCompatibility?: PlatformCompatibility[];
+    phases?: LifecyclePhase[];
   }[];
 };

 const toDateStr = (d: Date): string => d.toISOString().slice(0, 10);

-const activePhases = (): { name: string; startDate: string; endDate: string }[] => {
+const activePhases = (): LifecyclePhase[] => {
   ...
 };

-const expiredPhases = (): { name: string; startDate: string; endDate: string }[] => {
+const expiredPhases = (): LifecyclePhase[] => {
   ...
 };
+
+const SCHEMA = 'io.openshift.operators.lifecycles.v1alpha1';
+
+const buildLifecycleData = (
+  packageName: string,
+  version: string,
+  clusterVersions: string[],
+  phases: LifecyclePhase[],
+): LifecycleData => ({
+  package: packageName,
+  schema: SCHEMA,
+  versions: [
+    {
+      name: version,
+      platformCompatibility: [{ name: 'openshift', versions: clusterVersions }],
+      phases,
+    },
+  ],
+});

 export const makeLifecycleActiveAndCompatible = (
   packageName: string,
   version: string,
   clusterVersion: string,
-): LifecycleData => ({
-  package: packageName,
-  schema: 'io.openshift.operators.lifecycles.v1alpha1',
-  versions: [
-    {
-      name: version,
-      platformCompatibility: [{ name: 'openshift', versions: [clusterVersion] }],
-      phases: activePhases(),
-    },
-  ],
-});
+): LifecycleData => buildLifecycleData(packageName, version, [clusterVersion], activePhases());
🤖 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 `@frontend/e2e/mocks/operator-lifecycle.ts` around lines 1 - 84, The lifecycle
mock shape is duplicated across LifecycleData, activePhases/expiredPhases, and
the three factory helpers, so centralize the shared
phase/platformCompatibility/version object types and the common schema/versions
wrapper. Reuse those shared symbols from operator-lifecycle.ts inside
makeLifecycleActiveAndCompatible, makeLifecycleSelfSupport, and
makeLifecycleIncompatible so the mock payload stays consistent when the schema
or version shape changes.
frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts (2)

154-159: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Silent fallback on version-parse failure hides the real cause of later assertion failures.

If SERVER_FLAGS.releaseVersion is missing or has an unexpected format, clusterMinorVersion silently defaults to '4.18'. If that doesn't match the actual cluster version the UI compares against, the "compatible" step assertion will fail with no indication that the real root cause was a version-extraction problem rather than a UI/lifecycle-data bug.

♻️ Proposed fix to surface parse failures
     const versionMatch = releaseVersion.match(/^(\d+\.\d+)/);
-    const clusterMinorVersion = versionMatch ? versionMatch[1] : '4.18';
+    if (!versionMatch) {
+      throw new Error(`Unable to parse cluster minor version from releaseVersion: "${releaseVersion}"`);
+    }
+    const clusterMinorVersion = versionMatch[1];
🤖 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 `@frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts` around lines 154
- 159, The version parsing in operator-lifecycle-metadata.spec.ts is silently
falling back to a hardcoded minor version, which hides the real failure source.
Update the logic around the SERVER_FLAGS.releaseVersion handling so the test
explicitly fails or reports a clear error when the releaseVersion is missing or
doesn’t match the expected format, instead of defaulting to 4.18. Use the
existing releaseVersion, versionMatch, and clusterMinorVersion flow in the
Installed Operators test to surface the parse problem before the later
compatibility assertion runs.

98-134: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Cleanup errors are fully swallowed, risking silent resource leaks across CI runs.

Both catch blocks discard every error without logging. If deletion genuinely fails (e.g., permissions, API changes), the Subscription/CSVs leak into subsequent runs with no diagnostic trail.

♻️ Proposed fix to log instead of silently swallowing
     } catch {
-      // Ignore cleanup errors
+      // eslint-disable-next-line no-console
+      console.warn('Failed to delete web-terminal subscription during cleanup');
     }
🤖 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 `@frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts` around lines 98 -
134, The cleanup in test.afterAll currently swallows all errors when deleting
the Subscription and CSVs, which can hide leaked resources; update both catch
blocks to log the failure with enough context before continuing. Use the
existing k8sClient.deleteCustomResource and k8sClient.listCustomResources flow
in operator-lifecycle-metadata.spec.ts, and include the resource type/name
details in the log so CI failures can be diagnosed if cleanup does not succeed.
🤖 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.

Nitpick comments:
In `@frontend/e2e/mocks/operator-lifecycle.ts`:
- Around line 1-84: The lifecycle mock shape is duplicated across LifecycleData,
activePhases/expiredPhases, and the three factory helpers, so centralize the
shared phase/platformCompatibility/version object types and the common
schema/versions wrapper. Reuse those shared symbols from operator-lifecycle.ts
inside makeLifecycleActiveAndCompatible, makeLifecycleSelfSupport, and
makeLifecycleIncompatible so the mock payload stays consistent when the schema
or version shape changes.

In `@frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts`:
- Around line 154-159: The version parsing in
operator-lifecycle-metadata.spec.ts is silently falling back to a hardcoded
minor version, which hides the real failure source. Update the logic around the
SERVER_FLAGS.releaseVersion handling so the test explicitly fails or reports a
clear error when the releaseVersion is missing or doesn’t match the expected
format, instead of defaulting to 4.18. Use the existing releaseVersion,
versionMatch, and clusterMinorVersion flow in the Installed Operators test to
surface the parse problem before the later compatibility assertion runs.
- Around line 98-134: The cleanup in test.afterAll currently swallows all errors
when deleting the Subscription and CSVs, which can hide leaked resources; update
both catch blocks to log the failure with enough context before continuing. Use
the existing k8sClient.deleteCustomResource and k8sClient.listCustomResources
flow in operator-lifecycle-metadata.spec.ts, and include the resource type/name
details in the log so CI failures can be diagnosed if cleanup does not succeed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 56b1ada9-9c89-47fd-ac4f-ddc8c32c8093

📥 Commits

Reviewing files that changed from the base of the PR and between 7707540 and 1d67461.

📒 Files selected for processing (2)
  • frontend/e2e/mocks/operator-lifecycle.ts
  • frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts

@perdasilva perdasilva force-pushed the operator-lifecycle-metadata-e2e branch from c2bc5f0 to d651a59 Compare July 2, 2026 10:23
@perdasilva

Copy link
Copy Markdown
Author

/retest

1 similar comment
@perdasilva

Copy link
Copy Markdown
Author

/retest

Adds an e2e test that verifies the lifecycle metadata columns
(Cluster Compatibility and Support Phase) on the Installed Operators
page using mocked lifecycle API responses. The test is automatically
skipped on clusters without the OLMLifecycleAndCompatibility feature
gate enabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@perdasilva perdasilva force-pushed the operator-lifecycle-metadata-e2e branch from d651a59 to 122fdf3 Compare July 7, 2026 13:57
@perdasilva perdasilva changed the title NO-ISSUE: Add Playwright e2e test for operator lifecycle metadata UI CONSOLE-5409: Add Playwright e2e test for operator lifecycle metadata UI Jul 7, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@perdasilva: This pull request references CONSOLE-5409 which is a valid jira issue.

Details

In response to this:

Analysis / Root cause:
The operator lifecycle metadata UI (Cluster Compatibility and Support Phase columns on the Installed Operators page) had no e2e test coverage. Since no catalog with real lifecycle metadata exists yet, the test uses mocked API responses to verify the UI renders correctly across all three states.

Solution description:
Adds a Playwright e2e test (frontend/e2e/tests/olm/operator-lifecycle-metadata.spec.ts) and mock data helpers (frontend/e2e/mocks/operator-lifecycle.ts) that:

  1. Install the web-terminal operator from the redhat-operators catalog via k8sClient
  2. Mock the /api/olm/lifecycle/** endpoint using page.route() with a mutable reference pattern (consistent with update-modal.spec.ts)
  3. Read the cluster's actual releaseVersion from SERVER_FLAGS to build accurate mock data
  4. Skip automatically on clusters without the OLMLifecycleAndCompatibility feature gate enabled
  5. Verify three lifecycle states across test.step blocks:
  • Active support + compatible cluster — "Maintenance support" phase badge and "Compatible" indicator
  • Self-support — all phases expired, shows "Self-support" badge
  • Incompatible — cluster version not in compatibility list, shows "Incompatible" indicator
  1. Clean up the Subscription and CSVs in afterAll

Mock dates are computed dynamically relative to the current date to avoid time-bomb failures.

Screenshots / screen recording:

Test setup:

  • Requires a cluster with the OLMLifecycleAndCompatibility feature gate enabled (for the OPERATOR_LIFECYCLE_METADATA feature flag)
  • The redhat-operators CatalogSource must be available in openshift-marketplace
  • On clusters without the feature gate, the test is automatically skipped

Test cases:

  • Lifecycle columns show "Compatible" and active support phase name when mock data includes the cluster version and current-date phases
  • Lifecycle columns show "Self-support" badge when all mock phases have expired
  • Lifecycle columns show "Incompatible" when mock platform compatibility excludes the cluster version
  • Test is skipped on clusters without the OLMLifecycleAndCompatibility feature gate

Browser conformance:

  • Chrome

Additional info:
Verified against a live OCP 5.0 nightly cluster with the OLMLifecycleAndCompatibility feature gate enabled.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
  • Added end-to-end test coverage for operator lifecycle metadata in the installed Operators list.
  • Introduced reusable lifecycle mock payload helpers for active/compatible, self-support (expired phases), and incompatible scenarios.
  • Provisions an OLM Subscription, waits for the CSV to reach Succeeded, and validates lifecycle metadata UI columns using mocked lifecycle API responses.
  • Executes only when lifecycle metadata is enabled, deriving expected compatibility from the configured release version.
  • Cleans up the created Subscription and related CSVs after the test completes.

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 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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