Uploaded image for project: 'OpenShift Console'
  1. OpenShift Console
  2. CONSOLE-4875

Refactor OLM Component Tests from Implementation Testing to User-Behavior Testing

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • None
    • None
    • None

      This is a follow-on story from the Enzyme to RTL test effort.

      Refactor operator-lifecycle-manager component tests to follow React Testing Library best practices by testing user behavior instead of implementation details. Currently, multiple test files verify internal component structure (mock calls, prop structures, internal APIs) rather than what users actually see and interact with.

      Tests (# needing refactoring)

      1. frontend/packages/operator-lifecycle-manager/src/components/catalog-source.spec.tsx  (6 tests)
      2. frontend/packages/operator-lifecycle-manager/src/components/subscription.spec.tsx  (12 tests)
      3. frontend/packages/operator-lifecycle-manager/src/components/install-plan.spec.tsx  (20 tests)
      4. frontend/packages/operator-lifecycle-manager/src/components/package-manifest.spec.tsx (8 tests)
         

      Component files for reference

      catalog-source.tsx
      subscription.tsx
      install-plan.tsx
      package-manifest.tsx

       

      Acceptance Criteria

      Tests should:

      • Use `screen` queries (`getByRole`, `getByText`, `getByLabelText`)
      • Test what users see (`toBeVisible()`, not `toBeInTheDocument()`)
      • Test interactions (clicking tabs, buttons, entering text)
      • Verify user workflows (navigation, form submission, data display)
      • Not access `.mock.calls` or check internal props
      • Not use enzyme's `shallow` or `find` APIs
      • Use `renderWithProviders` with full component rendering

              Unassigned Unassigned
              sgoodwin_redhat Steve goodwin
              None
              None
              None
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: