test: add Layer 3 component tests mirroring UI E2E specs, plus Playwright tag system (RHIDP-13235)#4864
Conversation
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>
|
Skipping CI for Draft Pull Request. |
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>
|
The container image build workflow finished with status: |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewPrevious review resultsReview updated until commit e84d5e6 Results up to commit c7b330a
Great, no issues found!Qodo reviewed your code and found no material issues that require review |
Review Summary by Qodo(Agentic_describe updated until commit e84d5e6)Add Layer 3 component tests mirroring UI E2E specs with Playwright tag system
WalkthroughsDescription• 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 Diagramflowchart 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"]
File Changes1. e2e-tests/playwright/e2e/learning-path-page.spec.ts
|
- 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>
|
Persistent review updated to latest commit e84d5e6 |
|
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. |
…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>
|



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.tskeeps 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)
LearningPathsPage.test.tsxInfoCard.test.tsx(extended)GeneralPage.test.tsxCustomSidebarItem.test.tsxuseThemedConfig.test.tsxgetMountPointData.test.tsEach test carries an inline header noting the E2E spec it mirrors.
Playwright tag system
@layer3-equivalent, andsmoke-testwith@smoke(tags live in thedescribetitle so--grepselects them)..ci/pipelines/lib/testing.shhonors an optionalPLAYWRIGHT_GREPenv var, passing--grepthrough to the run (no-op when unset).e2e-tests/README.mddocuments the tag glossary (@layer3-equivalent,@smoke,@ga-plugin,@non-ga-plugin) and how to filter locally and in CI.Scope boundaries
extensionsanddynamic-home-page-customizationrender 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-customizationis rendered dynamically via Scalprum; the reachable piece (mount-point resolution) is covered bygetMountPointData.test.ts.@backstage/test-utils(renderInTestApp/TestApiProvider), matching the existing pattern inpackages/app.Testing
yarn tsc, lint and prettier pass (app + e2e-tests + .ci)rhdhflag