Skip to content

feat(dcm): add Playwright E2E test suite for DCM RHDH plugin#3249

Merged
mareklibra merged 16 commits into
redhat-developer:mainfrom
hardengl:feature/dcm-e2e-tests
Jun 29, 2026
Merged

feat(dcm): add Playwright E2E test suite for DCM RHDH plugin#3249
mareklibra merged 16 commits into
redhat-developer:mainfrom
hardengl:feature/dcm-e2e-tests

Conversation

@hardengl

@hardengl hardengl commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a comprehensive Playwright E2E test suite for the DCM (Data Center Management) RHDH plugin, with a two-tier testing strategy:

Merge gate (CI): app.test.ts runs against the local dev server — validates the app boots and sidebar renders correctly.

Downstream E2E (Jenkins): 5 test files with 46 tests run against a live RHDH+DCM deployment, activated by setting PLAYWRIGHT_URL. Covers all major UI workflows:

  • Smoke tests (9): Plugin navigation, all 6 tabs load with data, API proxy validation
  • Providers CRUD (7): Register, edit name/URL, search, delete with confirmation guard
  • Policies CRUD (6): Create GLOBAL/USER policies, toggle enabled/disabled, edit, delete
  • Catalog Items (9): Pet Clinic seed verification, create/edit/delete items, YAML file import (valid + invalid)
  • Instances (2): Create dialog from catalog item, empty state display
  • Regressions (13): Deep-link routing, delete confirmation guard, search + pagination, toggle persistence, chip/switch sync, read-only name field, whitespace validation, success snackbar, empty table rows (FLPATH-4111), rows-per-page persistence (FLPATH-4112)

Architecture

The playwright.config.ts defines two projects:

  • chromium — merge-gate safe, runs app.test.ts only (local dev server)
  • live — conditionally activated when PLAYWRIGHT_URL is set, runs all dcm-*.test.ts files

Run downstream tests with:

PLAYWRIGHT_URL=https://backstage-developer-hub-rhdh.apps.<cluster>.<domain> yarn e2e-test:live

Files Added

File Purpose
playwright.config.ts Two-project config (chromium + live)
e2e-tests/app.test.ts CI smoke test (merge gate)
e2e-tests/pages/DcmPage.ts Page object with helpers for all DCM tabs
e2e-tests/fixtures/auth.ts performGuestLogin auth setup (live tests)
e2e-tests/fixtures/dcm/*.yaml Test data fixtures for catalog item import
e2e-tests/dcm-smoke.test.ts Navigation and data-loading smoke tests
e2e-tests/dcm-providers.test.ts Provider CRUD lifecycle
e2e-tests/dcm-policies.test.ts Policy CRUD lifecycle
e2e-tests/dcm-catalog-items.test.ts Catalog item CRUD + YAML import
e2e-tests/dcm-regressions.test.ts Regression tests for fixed bugs
.prettierignore Excludes intentionally-invalid test fixture
.gitignore Excludes Playwright test artifacts

JIRA Coverage

All tests are tagged with JIRA IDs. Covers verification of 21 ON_QA stories under FLPATH-3241, including regression tests for FLPATH-4111 and FLPATH-4112.

Test plan

  • CI merge gate passes (Node 22 + Node 24)
  • SonarCloud analysis clean
  • app.test.ts validates app renders with sidebar navigation
  • yarn e2e-test:live passes against a live RHDH+DCM deployment
  • Tests are isolated — each creates/cleans up its own data
  • No changes to production plugin code (test-only PR)

@rhdh-gh-app

rhdh-gh-app Bot commented May 28, 2026

Copy link
Copy Markdown

Changed Packages

Package Name Package Path Changeset Bump Current Version
app workspaces/dcm/packages/app none v0.0.1

@hardengl hardengl force-pushed the feature/dcm-e2e-tests branch from 154c858 to 9d4352c Compare June 8, 2026 10:40
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.34%. Comparing base (54dcf0a) to head (3749bfe).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3249      +/-   ##
==========================================
+ Coverage   54.01%   54.34%   +0.33%     
==========================================
  Files        2325     2312      -13     
  Lines       89151    88313     -838     
  Branches    24911    24579     -332     
==========================================
- Hits        48156    47997     -159     
+ Misses      40760    38824    -1936     
- Partials      235     1492    +1257     
Flag Coverage Δ *Carryforward flag
adoption-insights 83.70% <ø> (ø) Carriedforward from fbe6415
ai-integrations 67.95% <ø> (ø) Carriedforward from fbe6415
app-defaults 69.79% <ø> (ø) Carriedforward from fbe6415
augment 46.39% <ø> (ø) Carriedforward from fbe6415
boost 74.35% <ø> (ø) Carriedforward from fbe6415
bulk-import 72.46% <ø> (ø) Carriedforward from fbe6415
cost-management 14.10% <ø> (ø) Carriedforward from fbe6415
dcm 61.81% <ø> (ø)
extensions 61.53% <ø> (ø) Carriedforward from fbe6415
global-floating-action-button 71.18% <ø> (ø) Carriedforward from fbe6415
global-header 59.71% <ø> (ø) Carriedforward from fbe6415
homepage 49.84% <ø> (ø) Carriedforward from fbe6415
install-dynamic-plugins 56.77% <ø> (ø) Carriedforward from fbe6415
konflux 91.49% <ø> (ø) Carriedforward from fbe6415
lightspeed 68.54% <ø> (ø) Carriedforward from fbe6415
mcp-integrations 85.46% <ø> (ø) Carriedforward from fbe6415
orchestrator 39.63% <ø> (+2.52%) ⬆️ Carriedforward from fbe6415
quickstart 63.76% <ø> (ø) Carriedforward from fbe6415
sandbox 79.56% <ø> (ø) Carriedforward from fbe6415
scorecard 82.67% <ø> (ø) Carriedforward from fbe6415
theme 61.26% <ø> (ø) Carriedforward from fbe6415
translations 7.25% <ø> (ø) Carriedforward from fbe6415
x2a 78.68% <ø> (ø) Carriedforward from fbe6415

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


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54dcf0a...3749bfe. 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.

@hardengl hardengl force-pushed the feature/dcm-e2e-tests branch from 2699029 to 908548c Compare June 10, 2026 14:42
@hardengl

Copy link
Copy Markdown
Contributor Author

@chadcrum @testetson22 @y-first @asmasarw @mareklibra @jkilzi please review thanks

@testetson22 testetson22 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. One question: Did we see any rendering delays or weirdness?

I ask because waitForTableRefresh() just does a waitForLoadState('networkidle');, which is a global wait that might arbitrarily complete when not intently waiting on a network call, followed by a sleep (which obviously does force the test to really wait).

Not a blocker, just curious. It's usually followed by solid checks on relevant elements, so it just seems redundant in many instances. I'd usually throw something like that in when hit with rendering issues during test dev and later fix the issue then forget I threw that in.

@hardengl

Copy link
Copy Markdown
Contributor Author

@mareklibra @jkilzi please give a review for me please

@chadcrum

Copy link
Copy Markdown

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Jun 25, 2026
@chadcrum chadcrum removed their assignment Jun 26, 2026
@openshift-ci openshift-ci Bot removed the lgtm label Jun 26, 2026
@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@mareklibra mareklibra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic recommendations (valid across multiple/all tests):

  • let the afterEach() handle the clean-up logic. If something fails, in the middle, everything following is affected. Moreover, you can reuse it...
  • wherever you have a timeout, think twice whether you can introduce a conditional waiting. It will significantly improve stability of the tests. If not, at least externalize the timeout constants.

Comment thread workspaces/dcm/playwright.config.ts Outdated
Comment thread workspaces/dcm/packages/app/e2e-tests/dcm-catalog-items.test.ts
Comment thread workspaces/dcm/packages/app/e2e-tests/dcm-smoke.test.ts Outdated
Comment thread workspaces/dcm/packages/app/e2e-tests/pages/DcmPage.ts
Comment thread workspaces/dcm/packages/app/e2e-tests/pages/DcmPage.ts Outdated
Comment thread workspaces/dcm/packages/app/e2e-tests/dcm-policies.test.ts Outdated
Comment thread workspaces/dcm/packages/app/e2e-tests/dcm-catalog-items.test.ts
Comment thread workspaces/dcm/packages/app/e2e-tests/dcm-regressions.test.ts Outdated
hardengl and others added 8 commits June 26, 2026 10:01
46 browser-based E2E tests covering the full DCM Data Center UI:
- Smoke tests: navigation, 6 tabs, seed data verification, API proxy
- Providers CRUD: register, edit, search, delete
- Policies CRUD: create GLOBAL/USER, toggle, edit, delete
- Catalog items: Pet Clinic, create/edit/delete, YAML import
- Instances: create dialog, empty state
- Regressions: deep link, delete guard, search+pagination, toggle
  persistence, chip/switch sync, read-only name, whitespace validation,
  success snackbar, empty table rows, rows-per-page persistence

Includes Playwright config, page object (DcmPage), auth fixture, and
YAML test data fixtures. Follows rhdh-plugins workspace conventions.

Ref: FLPATH-3241, FLPATH-4200
Co-authored-by: Cursor <cursoragent@cursor.com>
Addresses SonarQube security hotspots (typescript:S2245) flagging
Math.random() as weak PRNG. Uses globalThis.crypto to satisfy both
SonarQube and ESLint no-restricted-globals rule.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add missing lockfile entries for @playwright/test, playwright, and
playwright-core to fix immutable install failure in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
- 'chromium' project: runs app.test.ts only (merge gate safe)
- 'live' project: runs dcm-*.test.ts (requires PLAYWRIGHT_URL)
- Fix baseURL to use localhost:3000 (matching other workspaces)
- Add e2e-test:live script for running against live environments

Co-authored-by: Cursor <cursoragent@cursor.com>
The invalid-catalog-item.yaml is intentionally malformed for testing
file import error handling. Prettier cannot parse it and fails CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Use getByRole('navigation') with auto-waiting assertions (matches
  app-defaults, translations, konflux patterns)
- Add @playwright/test to app-level package.json devDependencies
  (required by @backstage/no-undeclared-imports ESLint rule)
- Update workspace yarn.lock

Co-authored-by: Cursor <cursoragent@cursor.com>
Having @playwright/test in both the workspace root and packages/app
causes Playwright's singleton check to fail with "Requiring
@playwright/test second time". Keep it only in packages/app/package.json
(matching app-defaults and konflux patterns).

Co-authored-by: Cursor <cursoragent@cursor.com>
CI runs `yarn playwright install` and `yarn playwright test` at the
workspace root level, so the dependency must be declared there.
Remove the duplicate from packages/app/package.json to avoid
Playwright's singleton "Requiring second time" error.

Co-authored-by: Cursor <cursoragent@cursor.com>
hardengl and others added 7 commits June 26, 2026 10:01
The DCM sidebar labels its catalog link "Home" (not "Catalog" like
the app-defaults workspace). Update the nav assertion accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
"Home" matches two elements (logo link + sidebar item) causing strict
mode violation. Use "APIs" and "Docs" which are unique sidebar items.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add test-results/ and playwright-results.xml to .gitignore so the
CI "ensure clean working directory" step doesn't fail after
playwright tests produce output files.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add comments to playwright.config.ts explaining which project runs
where: chromium (merge gate, local dev server) vs live (downstream
Jenkins, requires PLAYWRIGHT_URL pointing at deployed cluster).

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Upgrade from 1.58.2 to 1.60.0 to match lightspeed and homepage
workspaces. 1.58.2's playwright install --with-deps hangs
consistently on Node 24 GitHub Actions runners.

Co-authored-by: Cursor <cursoragent@cursor.com>
…stants

- Extract suffix/uniquePriority/kebabToDisplayName to shared utils/helpers.ts
- Extract timeout constants to utils/constants.ts (TIMEOUTS object)
- Move cleanup logic from inline to afterEach() with tracking arrays
- Set actionTimeout to 10s instead of 0 (infinite)
- Prefer ARIA-based locators over CSS selectors in DcmPage.ts
- Mark blocked FLPATH-4274 invalid YAML test with test.skip()

Co-authored-by: Cursor <cursoragent@cursor.com>
@hardengl hardengl force-pushed the feature/dcm-e2e-tests branch from 3ea614e to fbe6415 Compare June 26, 2026 14:01

@mareklibra mareklibra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with fragile CSS selectors remain (like [class*="MuiDrawer"] or label:has-text("Path *") + div input, but there are more of them). The data-testid would be much better option.

I will not block merging the PR on this, leaving up to you to decide whether and when to address that.

@mareklibra mareklibra merged commit 9881bf8 into redhat-developer:main Jun 29, 2026
17 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

5 participants