-
Notifications
You must be signed in to change notification settings - Fork 109
feat(dcm): add Playwright E2E test suite for DCM RHDH plugin #3249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mareklibra
merged 16 commits into
redhat-developer:main
from
hardengl:feature/dcm-e2e-tests
Jun 29, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e778b1e
feat(dcm): add Playwright E2E test suite for DCM RHDH plugin
hardengl 492b7b0
fix(dcm): replace Math.random with globalThis.crypto.getRandomValues
hardengl 941cadb
fix(dcm): update yarn.lock with @playwright/test 1.58.2
hardengl 1280738
feat(dcm): split Playwright into ci and live projects
hardengl 0560bbf
fix(dcm): exclude invalid YAML fixture from Prettier
hardengl 1986ea2
fix(dcm): align app.test.ts with standard workspace CI pattern
hardengl 2152f5a
fix(dcm): remove duplicate @playwright/test from workspace root
hardengl 046f725
fix(dcm): keep @playwright/test at workspace root only
hardengl e273364
fix(dcm): match app.test.ts assertions to DCM sidebar labels
hardengl 7d2ce55
fix(dcm): use unique sidebar links in app.test.ts assertions
hardengl bf8c3e7
fix(dcm): gitignore playwright test artifacts
hardengl 4eb9292
docs(dcm): clarify merge-gate vs downstream E2E project split
hardengl 5c5f9a6
ci: retrigger CI (Node 24 hung on GitHub runner)
hardengl 0822745
fix(dcm): bump @playwright/test to 1.60.0
hardengl fbe6415
Address review feedback: shared utils, afterEach cleanup, timeout con…
hardengl 3749bfe
Merge branch 'main' into feature/dcm-e2e-tests
hardengl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,3 +52,7 @@ site | |
|
|
||
| # E2E test reports | ||
| e2e-test-report/ | ||
|
|
||
| # Playwright test artifacts | ||
| **/test-results/ | ||
| playwright-results.xml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ dist-types | |
| coverage | ||
| .vscode | ||
| .eslintrc.js | ||
| packages/app/e2e-tests/fixtures/dcm/invalid-catalog-item.yaml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Copyright Red Hat, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| test('App should render the welcome page', async ({ page }) => { | ||
| await page.goto('/'); | ||
|
|
||
| const enterButton = page.getByRole('button', { name: 'Enter' }); | ||
| await expect(enterButton).toBeVisible(); | ||
| await enterButton.click(); | ||
|
|
||
| const nav = page.getByRole('navigation'); | ||
| await expect(nav.getByRole('link', { name: 'APIs' })).toBeVisible(); | ||
| await expect(nav.getByRole('link', { name: 'Docs' })).toBeVisible(); | ||
| }); |
259 changes: 259 additions & 0 deletions
259
workspaces/dcm/packages/app/e2e-tests/dcm-catalog-items.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,259 @@ | ||
| /* | ||
| * Copyright Red Hat, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { test, expect } from '@playwright/test'; | ||
| import { DcmPage } from './pages/DcmPage'; | ||
| import { suffix } from './utils/helpers'; | ||
| import { TIMEOUTS } from './utils/constants'; | ||
| import * as path from 'node:path'; | ||
|
|
||
| test.describe('DCM Catalog Items & Instances @dcm', () => { | ||
| let dcm: DcmPage; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| dcm = new DcmPage(page); | ||
| await dcm.loginAsGuest(); | ||
| await dcm.navigateToDataCenter(); | ||
| }); | ||
|
|
||
| // ── Catalog Items ───────────────────────────────────────────────────── | ||
|
|
||
| test('FLPATH-4200: Catalog items tab shows Pet Clinic with correct columns', async () => { | ||
| await dcm.clickTab('Catalog items'); | ||
| await dcm.verifyTableVisible(); | ||
|
|
||
| await dcm.verifyColumnHeader('Display name'); | ||
| await dcm.verifyColumnHeader('API version'); | ||
| await dcm.verifyColumnHeader('Service type'); | ||
| await dcm.verifyColumnHeader('Fields'); | ||
| await dcm.verifyColumnHeader('Created'); | ||
|
|
||
| await dcm.verifyCellContent('Pet Clinic'); | ||
| await dcm.verifyCellContent('three-tier-app-demo'); | ||
| }); | ||
|
|
||
| test('FLPATH-4200: Pet Clinic has Edit and Delete actions', async () => { | ||
| await dcm.clickTab('Catalog items'); | ||
| await dcm.verifyTableVisible(); | ||
|
|
||
| const row = dcm.page.locator('table tbody tr', { hasText: 'Pet Clinic' }); | ||
| await expect(row.getByRole('button', { name: 'Edit' })).toBeVisible(); | ||
| await expect(row.getByRole('button', { name: 'Delete' })).toBeVisible(); | ||
| }); | ||
|
|
||
| test('FLPATH-4200: Create and delete a catalog item via drawer', async ({ | ||
| page, | ||
| }) => { | ||
| const name = `E2E Item ${suffix()}`; | ||
| await dcm.clickTab('Catalog items'); | ||
| await dcm.clickCreateCatalogItem(); | ||
|
|
||
| await dcm.fillCatalogItemForm({ | ||
| displayName: name, | ||
| apiVersion: 'v1alpha1', | ||
| serviceType: 'container', | ||
| }); | ||
|
|
||
| const pathField = page.locator('label:has-text("Path *") + div input'); | ||
| if ((await pathField.count()) > 0) { | ||
| await pathField.first().click(); | ||
| await pathField.first().fill('config.replicas'); | ||
| } else { | ||
| const altPath = page.getByLabel('Path *'); | ||
| await altPath.click(); | ||
| await altPath.fill('config.replicas'); | ||
| } | ||
|
|
||
| await dcm.submitDialog('Create'); | ||
| await dcm.waitForTableRefresh(); | ||
|
|
||
| await dcm.verifyCellContent(name); | ||
|
|
||
| await dcm.clickDeleteOnRow(name); | ||
| await dcm.confirmDelete(); | ||
| await dcm.waitForDialogClosed(); | ||
| await dcm.waitForTableRefresh(); | ||
| await dcm.verifyNoCellContent(name); | ||
| }); | ||
|
|
||
| test('FLPATH-4200: Edit a catalog item', async () => { | ||
| await dcm.clickTab('Catalog items'); | ||
|
|
||
| await dcm.clickEditOnRow('Pet Clinic'); | ||
| await expect( | ||
| dcm.page.getByRole('heading', { name: 'Edit catalog item' }), | ||
| ).toBeVisible({ timeout: TIMEOUTS.short }); | ||
|
|
||
| await dcm.cancelDialog(); | ||
| }); | ||
|
|
||
| // ── Instances ───────────────────────────────────────────────────────── | ||
|
|
||
| test('FLPATH-4200: Instances tab shows correct columns or empty state', async ({ | ||
| page, | ||
| }) => { | ||
| await dcm.clickTab('Instances'); | ||
| const hasTable = await page | ||
| .locator('table') | ||
| .first() | ||
| .isVisible() | ||
| .catch(() => false); | ||
|
|
||
| if (hasTable) { | ||
| await dcm.verifyColumnHeader('Display name'); | ||
| await dcm.verifyColumnHeader('Catalog item'); | ||
| await dcm.verifyColumnHeader('Resource ID'); | ||
| await dcm.verifyColumnHeader('API version'); | ||
| await dcm.verifyColumnHeader('Created'); | ||
| } | ||
|
|
||
| await expect( | ||
| page.getByRole('button', { name: 'Create', exact: true }), | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| test('FLPATH-4200: Create instance dialog opens and form is fillable', async ({ | ||
| page, | ||
| }) => { | ||
| await dcm.clickTab('Instances'); | ||
| await dcm.clickCreateInstance(); | ||
|
|
||
| await dcm.fillInstanceForm({ | ||
| displayName: `E2E Instance ${suffix()}`, | ||
| catalogItem: 'Pet Clinic', | ||
| apiVersion: 'v1alpha1', | ||
| }); | ||
|
|
||
| await expect(page.getByText('Field values')).toBeVisible({ | ||
| timeout: TIMEOUTS.short, | ||
| }); | ||
|
|
||
| await dcm.submitDialog('Create'); | ||
| await page.waitForTimeout(TIMEOUTS.networkSettle); | ||
|
|
||
| const dialogVisible = await page | ||
| .locator('[role="dialog"]') | ||
| .isVisible() | ||
| .catch(() => false); | ||
|
|
||
| if (dialogVisible) { | ||
| await expect(page.locator('[role="alert"]').first()).toBeVisible({ | ||
| timeout: TIMEOUTS.short, | ||
| }); | ||
| await dcm.cancelDialog(); | ||
| } else { | ||
| await dcm.waitForTableRefresh(); | ||
| const hasInstance = await page | ||
| .getByRole('cell', { name: /E2E Instance/ }) | ||
| .first() | ||
| .isVisible() | ||
| .catch(() => false); | ||
| if (hasInstance) { | ||
| const row = page.locator('table tbody tr', { | ||
| hasText: /E2E Instance/, | ||
| }); | ||
| await row.getByRole('button', { name: 'Delete instance' }).click(); | ||
| await dcm.confirmDelete(); | ||
| await dcm.waitForDialogClosed(); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| // ── File Import ────────────────────────────────────────────────────── | ||
|
|
||
| test('FLPATH-4274: Valid YAML file import populates catalog item form', async ({ | ||
| page, | ||
| }) => { | ||
| const fixturePath = path.resolve( | ||
| __dirname, | ||
| 'fixtures/dcm/valid-catalog-item.yaml', | ||
| ); | ||
| await dcm.clickTab('Catalog items'); | ||
| await dcm.clickCreateCatalogItem(); | ||
|
|
||
| await dcm.importCatalogItemFile(fixturePath); | ||
|
|
||
| const displayName = page.locator( | ||
| 'label:has-text("Display name *") + div input', | ||
| ); | ||
| await expect(displayName.first()).toHaveValue('E2E Import Test Item'); | ||
|
|
||
| const apiVersion = page.locator( | ||
| 'label:has-text("API version *") + div input', | ||
| ); | ||
| await expect(apiVersion.first()).toHaveValue('v1alpha1'); | ||
|
|
||
| const pathFields = page.locator('label:has-text("Path *") + div input'); | ||
| await expect(pathFields).toHaveCount(2, { timeout: TIMEOUTS.short }); | ||
| await expect(pathFields.nth(0)).toHaveValue('config.replicas'); | ||
| await expect(pathFields.nth(1)).toHaveValue('config.region'); | ||
|
|
||
| await dcm.submitDialog('Create'); | ||
| await dcm.waitForTableRefresh(); | ||
| await dcm.verifyCellContent('E2E Import Test Item'); | ||
|
|
||
| await dcm.clickDeleteOnRow('E2E Import Test Item'); | ||
| await dcm.confirmDelete(); | ||
| await dcm.waitForDialogClosed(); | ||
| await dcm.waitForTableRefresh(); | ||
| }); | ||
|
|
||
| test.skip('FLPATH-4274: Invalid YAML file import should show error feedback — blocked on FLPATH-4274 fix', async ({ | ||
|
Check warning on line 214 in workspaces/dcm/packages/app/e2e-tests/dcm-catalog-items.test.ts
|
||
| page, | ||
| }) => { | ||
| const fixturePath = path.resolve( | ||
| __dirname, | ||
| 'fixtures/dcm/invalid-catalog-item.yaml', | ||
| ); | ||
| await dcm.clickTab('Catalog items'); | ||
| await dcm.clickCreateCatalogItem(); | ||
|
|
||
| const displayNameBefore = await page | ||
| .locator('label:has-text("Display name *") + div input') | ||
| .first() | ||
| .inputValue(); | ||
|
|
||
| await dcm.importCatalogItemFile(fixturePath); | ||
|
|
||
| const displayNameAfter = await page | ||
| .locator('label:has-text("Display name *") + div input') | ||
| .first() | ||
| .inputValue(); | ||
| expect(displayNameAfter).toBe(displayNameBefore); | ||
|
|
||
| // FLPATH-4274: Error feedback MUST be shown for invalid files. | ||
| // This will fail until the fix ships, then pass automatically. | ||
|
hardengl marked this conversation as resolved.
|
||
| const errorFeedback = page | ||
| .locator('[class*="MuiAlert"]') | ||
| .first() | ||
| .or(page.locator('[class*="MuiSnackbar"]').first()); | ||
| await expect(errorFeedback).toBeVisible({ timeout: TIMEOUTS.short }); | ||
|
|
||
| await dcm.cancelDialog(); | ||
| }); | ||
|
|
||
| // ── Resources ───────────────────────────────────────────────────────── | ||
|
|
||
| test('FLPATH-4200: Resources tab shows content or empty state', async ({ | ||
| page, | ||
| }) => { | ||
| await dcm.clickTab('Resources'); | ||
|
|
||
| await expect( | ||
| page.locator('table').first().or(page.getByText('No resources found')), | ||
| ).toBeVisible({ timeout: TIMEOUTS.table }); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.