Skip to content

test: add Layer 3 component tests mirroring UI E2E specs, plus Playwright tag system (RHIDP-13235)#4864

Open
gustavolira wants to merge 10 commits into
redhat-developer:mainfrom
gustavolira:RHIDP-13235-layer3-component-tests
Open

test: add Layer 3 component tests mirroring UI E2E specs, plus Playwright tag system (RHIDP-13235)#4864
gustavolira wants to merge 10 commits into
redhat-developer:mainfrom
gustavolira:RHIDP-13235-layer3-component-tests

Conversation

@gustavolira
Copy link
Copy Markdown
Member

Description

Implements RHIDP-13235 — additive Layer 3 component tests that mirror the behavior of existing UI-only E2E specs, plus a Playwright tag system. Part of the RHIDP-11861 test-layer work.

This is not a migration: every existing .spec.ts keeps all its tests. The goal is to cover the same UI behaviors at a faster, cluster-free layer (React Testing Library + @backstage/test-utils) and to make those layers identifiable via tags.

Component tests added (behavior → component)

Mirrors E2E spec Component test
learning-path-page LearningPathsPage.test.tsx
user-settings-info-card InfoCard.test.tsx (extended)
settings GeneralPage.test.tsx
sidebar CustomSidebarItem.test.tsx
custom-theme useThemedConfig.test.tsx
header-mount-points getMountPointData.test.ts

Each test carries an inline header noting the E2E spec it mirrors.

Playwright tag system

  • Tagged the four E2E specs that now have a sibling Layer 3 test with @layer3-equivalent, and smoke-test with @smoke (tags live in the describe title so --grep selects them).
  • .ci/pipelines/lib/testing.sh honors an optional PLAYWRIGHT_GREP env var, passing --grep through to the run (no-op when unset).
  • e2e-tests/README.md documents the tag glossary (@layer3-equivalent, @smoke, @ga-plugin, @non-ga-plugin) and how to filter locally and in CI.

Scope boundaries

  • extensions and dynamic-home-page-customization render from plugin-side code (rhdh-plugins), not from a component in this repo — out of scope here, proposed as a follow-up in that repo.
  • home-page-customization is rendered dynamically via Scalprum; the reachable piece (mount-point resolution) is covered by getMountPointData.test.ts.
  • Tooling: uses @backstage/test-utils (renderInTestApp / TestApiProvider), matching the existing pattern in packages/app.

Testing

  • 6 component test suites pass (20 tests)
  • yarn tsc, lint and prettier pass (app + e2e-tests + .ci)
  • New tests contribute to the Codecov rhdh flag

gustavolira and others added 7 commits May 20, 2026 19:00
Net-new component test (RTL + @backstage/test-utils) mirroring the
behavior of e2e-tests/.../learning-path-page.spec.ts — covers the
loading indicator, the rendered learning-path cards with external links
and duration summary, and the error report when no data is returned.
The E2E spec is intentionally left untouched (paradigm shift, not a
migration — RHIDP-13235).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Net-new test mirroring part of the header-mount-points UI E2E spec —
covers how getMountPointData resolves entries from the Scalprum dynamic
root config (configured mount point, missing mount point, absent config).
E2E spec left untouched (RHIDP-13235).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Net-new test mirroring the custom-theme UI E2E spec — covers
useAppBarBackgroundScheme (theme palette scheme + dark default) and
useAppBarThemedConfig (string asset passthrough, scheme-based variant
selection). E2E spec left untouched (RHIDP-13235).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a case mirroring user-settings-info-card.spec.ts: asserts the card
title and the "key: value" lines render, that the collapsed view shows
only the first two entries, and that expanding reveals the rest. The
existing tests only checked keys, not the title or values. E2E spec
left untouched (RHIDP-13235).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Net-additive test mirroring part of the sidebar UI E2E spec — asserts a
custom sidebar item renders its label and links to the configured
target. E2E spec left untouched (RHIDP-13235).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Net-additive test mirroring the RHDH-owned part of the settings UI E2E
spec — the settings page is largely upstream user-settings UI, but
GeneralPage composes the build-info card, so this asserts that card
renders on the general settings page. E2E spec left untouched
(RHIDP-13235).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Tag the four E2E specs that now have a sibling Layer 3 component test
  with @layer3-equivalent (learning-path-page, user-settings-info-card,
  settings, sidebar), and tag smoke-test with @smoke. Tags live in the
  describe title so Playwright --grep can select them.
- testing.sh: honor an optional PLAYWRIGHT_GREP env var to pass --grep
  through to the run (no-op when unset).
- e2e-tests/README.md: document the tag glossary (@layer3-equivalent,
  @smoke, @ga-plugin, @non-ga-plugin) and how to filter locally and in CI.

Existing E2E specs keep all their tests; only describe titles gained a tag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 20, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Replace the bare `as any` on the mock theme options with
`as unknown as ThemeOptions` so the rhdh palette stub is typed without
suppressing all type checking.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.40%. Comparing base (b08abdf) to head (89628e5).
⚠️ Report is 12 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4864       +/-   ##
===========================================
+ Coverage   41.03%   75.40%   +34.36%     
===========================================
  Files         121      123        +2     
  Lines        2220     5050     +2830     
  Branches      562      538       -24     
===========================================
+ Hits          911     3808     +2897     
+ Misses       1304     1237       -67     
  Partials        5        5               
Flag Coverage Δ *Carryforward flag
install-dynamic-plugins 92.44% <ø> (?) Carriedforward from e84d5e6
rhdh 55.82% <100.00%> (+14.79%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b08abdf...89628e5. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

@gustavolira gustavolira marked this pull request as ready for review May 20, 2026 23:30
@openshift-ci openshift-ci Bot requested review from PatAKnight and psrna May 20, 2026 23:30
@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge Bot commented May 20, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Previous review results

Review updated until commit e84d5e6

Results up to commit c7b330a


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Qodo Logo

@gustavolira gustavolira marked this pull request as draft May 20, 2026 23:31
@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge Bot commented May 20, 2026

Review Summary by Qodo

(Agentic_describe updated until commit e84d5e6)

Add Layer 3 component tests mirroring UI E2E specs with Playwright tag system

🧪 Tests ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add 6 Layer 3 component tests mirroring UI E2E specs
  - LearningPathsPage, InfoCard, GeneralPage, CustomSidebarItem, useThemedConfig, getMountPointData
• Implement Playwright tag system for test filtering
  - Tag E2E specs with @layer3-equivalent and @smoke markers
  - Support PLAYWRIGHT_GREP environment variable in CI pipeline
• Document test tag glossary and filtering usage in README
Diagram
flowchart LR
  A["E2E Specs"] -->|"@layer3-equivalent tag"| B["Tagged E2E Tests"]
  C["Component Tests"] -->|"RTL + @backstage/test-utils"| D["Layer 3 Coverage"]
  B -->|"PLAYWRIGHT_GREP filter"| E["CI Pipeline"]
  D -->|"mirrors behavior"| A
  E -->|"--grep support"| F["Selective Test Runs"]

Loading

File Changes

1. e2e-tests/playwright/e2e/learning-path-page.spec.ts ✨ Enhancement +1/-1

Add @layer3-equivalent tag to learning paths spec

e2e-tests/playwright/e2e/learning-path-page.spec.ts


2. e2e-tests/playwright/e2e/plugins/sidebar.spec.ts ✨ Enhancement +0/-0

Add @layer3-equivalent tag to sidebar spec

e2e-tests/playwright/e2e/plugins/sidebar.spec.ts


3. e2e-tests/playwright/e2e/plugins/user-settings-info-card.spec.ts ✨ Enhancement +1/-1

Add @layer3-equivalent tag to info card spec

e2e-tests/playwright/e2e/plugins/user-settings-info-card.spec.ts


View more (11)
4. e2e-tests/playwright/e2e/settings.spec.ts ✨ Enhancement +1/-1

Add @layer3-equivalent tag to settings spec

e2e-tests/playwright/e2e/settings.spec.ts


5. e2e-tests/playwright/e2e/smoke-test.spec.ts ✨ Enhancement +1/-1

Add @smoke tag to smoke test spec

e2e-tests/playwright/e2e/smoke-test.spec.ts


6. packages/app/src/utils/dynamicUI/getMountPointData.test.ts 🧪 Tests +48/-0

Add Layer 3 test for mount-point data resolution

packages/app/src/utils/dynamicUI/getMountPointData.test.ts


7. packages/app/src/components/Root/CustomSidebarItem.test.tsx 🧪 Tests +53/-0

Add Layer 3 test for custom sidebar item rendering

packages/app/src/components/Root/CustomSidebarItem.test.tsx


8. packages/app/src/components/UserSettings/GeneralPage.test.tsx 🧪 Tests +40/-0

Add Layer 3 test for general settings page composition

packages/app/src/components/UserSettings/GeneralPage.test.tsx


9. packages/app/src/components/UserSettings/InfoCard.test.tsx 🧪 Tests +37/-0

Extend InfoCard test with build info card assertions

packages/app/src/components/UserSettings/InfoCard.test.tsx


10. packages/app/src/components/learningPaths/LearningPathsPage.test.tsx 🧪 Tests +99/-0

Add Layer 3 test for learning paths page behavior

packages/app/src/components/learningPaths/LearningPathsPage.test.tsx


11. packages/app/src/hooks/useThemedConfig.test.tsx 🧪 Tests +182/-0

Add Layer 3 test for themed branding config hooks

packages/app/src/hooks/useThemedConfig.test.tsx


12. .ci/pipelines/lib/testing.sh ✨ Enhancement +9/-1

Add PLAYWRIGHT_GREP environment variable support

.ci/pipelines/lib/testing.sh


13. e2e-tests/README.md 📝 Documentation +31/-0

Document test tag glossary and filtering usage

e2e-tests/README.md


14. e2e-tests/playwright/e2e/plugins/frontend/sidebar.spec.ts Additional files +1/-1

...

e2e-tests/playwright/e2e/plugins/frontend/sidebar.spec.ts


Grey Divider

Qodo Logo

- useThemedConfig: cover the two previously-untested hooks —
  useSidebarSelectedBackgroundColor (theme value + '' default) and
  useSystemThemedConfig (system light/dark scheme via mocked matchMedia,
  string passthrough). All four hooks are now exercised.
- CustomSidebarItem: assert the GlobalSidebarStyles effect injects the
  built-in-item styling, so the component's distinguishing behavior (not
  just label/link) is verified.
- LearningPathsPage: use clearAllMocks instead of resetAllMocks so the
  module-scoped search API mock keeps its resolved implementation across
  tests.
- testing.sh: guard the optional grep args expansion
  (${grep_args[@]+"..."}) so it is safe under set -u / older bash.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

@gustavolira gustavolira marked this pull request as ready for review May 21, 2026 14:34
@openshift-ci openshift-ci Bot requested review from JessicaJHee and rostalan May 21, 2026 14:35
@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge Bot commented May 21, 2026

Persistent review updated to latest commit e84d5e6

@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days.

@github-actions github-actions Bot added the Stale label May 29, 2026
Comment thread e2e-tests/README.md
@gustavolira gustavolira requested a review from zdrapela May 29, 2026 18:00
…s, error-branch fix

- Use Playwright's native `{ tag }` option instead of embedding @tag in the
  test.describe title, so test names stay stable for historical reporting
  while --grep / PLAYWRIGHT_GREP filtering keeps working. Update README.
- Fix unreachable error branch in LearningPathsPage: check `error` before
  `!data` so the real error message surfaces; add a test covering it.
- Switch the Layer 3 component tests to @backstage/frontend-test-utils as a
  forward-compatible step toward the New Frontend System (components are not
  migrated yet; getMountPointData stays on @scalprum/core).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

@github-actions github-actions Bot removed the Stale label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants