Skip to content

Add Model-registry cypress and unit tests to the CI#7338

Open
ppadti wants to merge 3 commits intoopendatahub-io:mainfrom
ppadti:followup-37600
Open

Add Model-registry cypress and unit tests to the CI#7338
ppadti wants to merge 3 commits intoopendatahub-io:mainfrom
ppadti:followup-37600

Conversation

@ppadti
Copy link
Copy Markdown
Contributor

@ppadti ppadti commented Apr 21, 2026

Closes: https://redhat.atlassian.net/browse/RHOAIENG-37600

Description

This is PR which add cypress and unit of upstream to the CI

How Has This Been Tested?

Make sure the CI is running upstream model-registry tests on CI and CI passes without any errors.

Test Impact

NA

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)
  • The code follows our Best Practices (React coding standards, PatternFly usage, performance considerations)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for model registry editing workflows (description, labels, properties) in overview and version views.
    • Added tests asserting deploy-button visibility/hidden states for various server responses.
    • Added validation scenarios for label constraints (length and duplicates) and alert behavior during edit/save flows.
    • Added reusable test helpers for interacting with model details and model-version detail UI elements.

Signed-off-by: ppadti <ppadti@redhat.com>
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 21, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign manaswinidas for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 192ee388-b8da-4d17-bf65-206547d8c60f

📥 Commits

Reviewing files that changed from the base of the PR and between cd06056 and 754cd3e.

📒 Files selected for processing (2)
  • packages/cypress/cypress/pages/modelRegistry/modelDetailsCard.ts
  • packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/cypress/cypress/pages/modelRegistry/modelDetailsCard.ts
  • packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts

📝 Walkthrough

Walkthrough

Adds Cypress page-object modules for Model Details (card and expanded view) and Model Version Details, exposing element finders and helpers for description, labels, properties, and kebab actions. Adds new Cypress tests: MCP catalog deploy-button visibility cases (404 and empty-artifacts scenarios) and a comprehensive model-registry details-editing suite with mocked intercepts, PATCH assertions, label/description/property edit flows, and client-side validation tests for label length and duplicates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Security Findings

No actionable security issues identified. Changes are test/page-object code using Cypress stubs and selectors; no new production logic or sensitive-data handling introduced. No relevant CWE/CVE entries applicable.

🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning Description is largely incomplete despite template requirements. Missing detailed 'Description' section explaining what and why; 'How Has This Been Tested' lacks specifics; 'Test Impact' marked NA contradicts actual test additions; only 2 of 4 self-checklist items checked; post-PR cluster testing unchecked. Expand Description with detailed changes and rationale; detail test coverage and validation approach; mark Test Impact completed with specific test counts; check all applicable self-checklist items and provide cluster testing status before merge.
Title check ❓ Inconclusive Title is partially related to the changeset—it mentions adding tests to CI, but the PR primarily adds new Cypress page-object modules and test files; CI integration details are not evident in the actual code changes. Clarify whether the title should reflect the immediate changes (new test modules and page objects) or the downstream CI integration; consider 'Add model-registry Cypress page objects and test cases' for specificity.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts (1)

176-192: Monolithic test conflates six independent scenarios.

should show alerts for the expanded section drives label edit → save → description edit → save → property edit → save → add-property flows in one it. If any earlier assertion fails, the remaining alert behaviors are never exercised, and the failure message won't tell you which flow is actually broken. Split into per-flow it blocks (label / description / property-edit / add-property) so failures are localized and the suite stays diagnosable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`
around lines 176 - 192, The test "should show alerts for the expanded section"
is doing six independent checks in one it block; split it into separate it
blocks each asserting alert behavior for one flow (label edit/save, description
edit/save, property edit/save, add-property) so failures are isolated. Locate
the existing test using the it name and refactor into four tests that reuse
modelDetailsExpandedCard setup (click findExpandedButton and assert visibility),
then in each new it call only the relevant actions and assertion: use
findLabelEditButton/findLabelSaveButton for the label test,
findDescriptionEditButton/findDescriptionSaveButton for the description test,
getRow('property1').findKebabAction('Edit') and propertyRow.findSaveButton for
property-edit test, and findAddPropertyButton for add-property test, each
followed by modelDetailsExpandedCard.findAlert().should('exist').
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cypress/cypress/tests/mocked/mcpCatalog/mcpDeployments.cy.ts`:
- Line 434: Replace the brittle text-based assertion cy.contains('MCP server not
found').should('be.visible') with the new page-object finder that targets the
not-found element by its data-testid; update the test to import and use the
finder from packages/cypress/cypress/pages/mcpDeployments.ts (the finder name
e.g., mcpDeployments.getNotFound or similar) and assert visibility via that
finder instead of cy.contains so the test relies on the stable data-testid
selector.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`:
- Line 275: The regex passed to cy.contains (used in the assertions that check
"Testing label already exists" and "can't exceed 63 characters") incorrectly
includes the global /g flag which makes the RegExp stateful and causes flaky
retries; remove the /g flag (use a plain RegExp like /Testing label already
exists|can't exceed 63 characters/ or two separate assertions/strings) for both
occurrences so cy.contains receives a non-global regex and retries behave
deterministically.
- Line 181: The test is clicking modelDetailsExpandedCard.findLabelSaveButton()
immediately after findLabelEditButton() without making any change, which can be
a no-op; update the test so after invoking
modelDetailsExpandedCard.findLabelEditButton().click() you either type a change
into the label input (e.g., append or set some text) before calling
modelDetailsExpandedCard.findLabelSaveButton().click() or explicitly exit edit
mode via the component’s cancel/close affordance instead of saving; apply the
same fix for propertyRow.findSaveButton() — ensure you reference the label input
or cancel control used by findLabelEditButton/findLabelSaveButton and
propertyRow.findSaveButton so the subsequent findDescriptionEditButton().click()
is not brittle.

---

Nitpick comments:
In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`:
- Around line 176-192: The test "should show alerts for the expanded section" is
doing six independent checks in one it block; split it into separate it blocks
each asserting alert behavior for one flow (label edit/save, description
edit/save, property edit/save, add-property) so failures are isolated. Locate
the existing test using the it name and refactor into four tests that reuse
modelDetailsExpandedCard setup (click findExpandedButton and assert visibility),
then in each new it call only the relevant actions and assertion: use
findLabelEditButton/findLabelSaveButton for the label test,
findDescriptionEditButton/findDescriptionSaveButton for the description test,
getRow('property1').findKebabAction('Edit') and propertyRow.findSaveButton for
property-edit test, and findAddPropertyButton for add-property test, each
followed by modelDetailsExpandedCard.findAlert().should('exist').
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: d8c4f632-a30e-4f20-9057-20e9f50fc11c

📥 Commits

Reviewing files that changed from the base of the PR and between 46fc04a and 9ee9e10.

⛔ Files ignored due to path filters (33)
  • .github/workflows/model-registry-frontend-tests.yml is excluded by !.github/**
  • packages/model-registry/upstream/frontend/config/moduleFederation.js is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/config/webpack.prod.js is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/package-lock.json is excluded by !**/package-lock.json, !**/upstream/**
  • packages/model-registry/upstream/frontend/package.json is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/appChrome.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelCatalog.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelCatalogSettings.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistry.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/modelTransferJobs.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/modelVersionArchive.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/modelVersionDetails.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/registerAndStoreFields.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/registerModelPage.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/registerVersionPage.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/pages/modelRegistryView/registeredModelArchive.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/support/e2e.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/mcpCatalog/mcpServerDetails.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/modelCatalogTabs.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalog/tensorTypeComparisonCard.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelCatalogSettings/modelCatalogSettings.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelDetailsCard.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelRegistry.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelTransferJobs.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelVersionArchive.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelVersionDetails.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelVersions.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelVersionsCard.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registerAndStoreFields.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registeredModelArchive.cy.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/utils/modelCatalogTestRoutes.ts is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/bootstrap.tsx is excluded by !**/upstream/**
  • packages/model-registry/upstream/frontend/src/odh/components/MRDeploymentsContextProvider.tsx is excluded by !**/upstream/**
📒 Files selected for processing (4)
  • packages/cypress/cypress/pages/modelRegistry/modelDetailsCard.ts
  • packages/cypress/cypress/pages/modelRegistry/modelVersionDetails.ts
  • packages/cypress/cypress/tests/mocked/mcpCatalog/mcpDeployments.cy.ts
  • packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts


cy.visitWithLogin('/ai-hub/mcp-servers/catalog/invalid-server');

cy.contains('MCP server not found').should('be.visible');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use a data-testid-backed finder for the not-found state.

cy.contains() makes this test depend on copy text. Add a page-object finder for the not-found state and assert through that instead.

Proposed test-side change
-      cy.contains('MCP server not found').should('be.visible');
+      mcpServerDetailsPage.findNotFoundState().should('contain.text', 'MCP server not found');

Add the corresponding finder in packages/cypress/cypress/pages/mcpDeployments.ts after adding a stable data-testid to the not-found UI:

 class McpServerDetailsPage {
+  findNotFoundState(): Cypress.Chainable<JQuery<HTMLElement>> {
+    return cy.findByTestId('mcp-server-not-found');
+  }
+
   findDeployButton(): Cypress.Chainable<JQuery<HTMLElement>> {
     return cy.findByTestId('mcp-deploy-button');
   }

As per coding guidelines, packages/cypress/**/*.{ts,js} tests should “Use data-testid selectors, not CSS classes (resilient to style changes).”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cypress/cypress/tests/mocked/mcpCatalog/mcpDeployments.cy.ts` at
line 434, Replace the brittle text-based assertion cy.contains('MCP server not
found').should('be.visible') with the new page-object finder that targets the
not-found element by its data-testid; update the test to import and use the
finder from packages/cypress/cypress/pages/mcpDeployments.ts (the finder name
e.g., mcpDeployments.getNotFound or similar) and assert visibility via that
finder instead of cy.contains so the test relies on the stable data-testid
selector.

modelDetailsExpandedCard.find().should('be.visible');
modelDetailsExpandedCard.findLabelEditButton().click();
modelDetailsExpandedCard.findAlert().should('exist');
modelDetailsExpandedCard.findLabelSaveButton().click();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clicking findLabelSaveButton without any label change is likely a no-op or a silent failure.

Nothing was typed/added between findLabelEditButton().click() (line 179) and findLabelSaveButton().click() here. Depending on the component, the save button may be disabled (click silently ignored by Cypress only if {force:true}; otherwise it will fail the actionability check) or will dismiss the editor without persisting — making the subsequent findDescriptionEditButton().click() brittle. Either add a label edit before saving, or call a cancel/close affordance to exit edit mode explicitly. Same concern for propertyRow.findSaveButton().click() on line 189.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`
at line 181, The test is clicking modelDetailsExpandedCard.findLabelSaveButton()
immediately after findLabelEditButton() without making any change, which can be
a no-op; update the test so after invoking
modelDetailsExpandedCard.findLabelEditButton().click() you either type a change
into the label input (e.g., append or set some text) before calling
modelDetailsExpandedCard.findLabelSaveButton().click() or explicitly exit edit
mode via the component’s cancel/close affordance instead of saving; apply the
same fix for propertyRow.findSaveButton() — ensure you reference the label input
or cancel control used by findLabelEditButton/findLabelSaveButton and
propertyRow.findSaveButton so the subsequent findDescriptionEditButton().click()
is not brittle.

.eq(0)
.should('be.visible')
.within(() => {
cy.contains(/Testing label already exists|can't exceed 63 characters/g).should('exist');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Drop the /g flag on regexes passed to cy.contains.

Global RegExp instances are stateful (lastIndex persists between .test()/.exec() calls). When Cypress retries cy.contains against the same regex object, matches can flip between true/false across retries, producing flaky pass/fail behavior. The flag also adds nothing here since cy.contains only needs a single match.

Proposed fix
-        cy.contains(/Testing label already exists|can't exceed 63 characters/g).should('exist');
+        cy.contains(/Testing label already exists|can't exceed 63 characters/).should('exist');

(apply to both occurrences at lines 275 and 282)

Also applies to: 282-282

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`
at line 275, The regex passed to cy.contains (used in the assertions that check
"Testing label already exists" and "can't exceed 63 characters") incorrectly
includes the global /g flag which makes the RegExp stateful and causes flaky
retries; remove the /g flag (use a plain RegExp like /Testing label already
exists|can't exceed 63 characters/ or two separate assertions/strings) for both
occurrences so cy.contains receives a non-global regex and retries behave
deterministically.

Signed-off-by: ppadti <ppadti@redhat.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts (1)

154-154: Unused UpdatePropertyRow alias; also inconsistent casing.

Line 154 aliases the model-version PATCH as @UpdatePropertyRow but no cy.wait('@UpdatePropertyRow') exists in this spec. Either drop the alias or add an assertion on the PATCH body for the property-edit path (symmetric with @patchRegisteredModel on line 166). While at it, align casing with the other alias (updateModelVersion / patchModelVersion) since PascalCase is inconsistent with patchRegisteredModel.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`
at line 154, The alias `@UpdatePropertyRow` is unused and uses inconsistent
PascalCase; either remove that .as('UpdatePropertyRow') or rename it to
camelCase (e.g., .as('updateModelVersion' or 'patchModelVersion') to match
existing aliases) and add a cy.wait('@updateModelVersion') (or
cy.wait('@patchModelVersion')) after the property edit that asserts the
intercepted PATCH request body contains the expected property-edit path/payload
(symmetric with the existing `@patchRegisteredModel` check). Locate the
.as('UpdatePropertyRow') in the spec and implement one of these two options so
the alias is either removed or used with a body assertion and consistent naming.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`:
- Line 247: The test currently uses
modelVersionDetails.findSaveLabelsButton().should('exist').click(), which only
asserts DOM presence and can pass for hidden or covered elements; update the
assertion to ensure the button is actionable by replacing the existence check
with visibility (and disabled-state if relevant) — e.g., use
should('be.visible') and optionally should('not.be.disabled') before invoking
modelVersionDetails.findSaveLabelsButton().click() so the click only runs when
the Save Labels button is actually interactable.
- Around line 262-275: Add an explicit length guard before asserting specific
indexes of the label-error-alert collection: after the
cy.findAllByTestId('label-error-alert') call and before the .eq(0)/.eq(1)
checks, add a should('have.length', 2) assertion so the test explicitly expects
two alerts; update the sequence around the existing
cy.findAllByTestId('label-error-alert') usages in modelDetailsEditing.cy.ts (the
block that currently calls .eq(0) and .eq(1)) to include this length check to
avoid flakiness if the component stops rendering both alerts.

---

Nitpick comments:
In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`:
- Line 154: The alias `@UpdatePropertyRow` is unused and uses inconsistent
PascalCase; either remove that .as('UpdatePropertyRow') or rename it to
camelCase (e.g., .as('updateModelVersion' or 'patchModelVersion') to match
existing aliases) and add a cy.wait('@updateModelVersion') (or
cy.wait('@patchModelVersion')) after the property edit that asserts the
intercepted PATCH request body contains the expected property-edit path/payload
(symmetric with the existing `@patchRegisteredModel` check). Locate the
.as('UpdatePropertyRow') in the spec and implement one of these two options so
the alias is either removed or used with a body assertion and consistent naming.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: cf0a3201-b236-464a-9ad4-7911ce7515df

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee9e10 and cd06056.

📒 Files selected for processing (1)
  • packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts

cy.contains('Second Label').parent().find('[data-testid^="remove-label-"]').click();
});

modelVersionDetails.findSaveLabelsButton().should('exist').click();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

.should('exist').click() is too weak before a click.

exist passes for detached/covered elements; prefer be.visible (and, if relevant, not.be.disabled) so the click is gated on the save button actually being actionable. Otherwise a regression where the button is hidden could still pass the existence check.

Proposed change
-    modelVersionDetails.findSaveLabelsButton().should('exist').click();
+    modelVersionDetails.findSaveLabelsButton().should('be.visible').and('not.be.disabled').click();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
modelVersionDetails.findSaveLabelsButton().should('exist').click();
modelVersionDetails.findSaveLabelsButton().should('be.visible').and('not.be.disabled').click();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`
at line 247, The test currently uses
modelVersionDetails.findSaveLabelsButton().should('exist').click(), which only
asserts DOM presence and can pass for hidden or covered elements; update the
assertion to ensure the button is actionable by replacing the existence check
with visibility (and disabled-state if relevant) — e.g., use
should('be.visible') and optionally should('not.be.disabled') before invoking
modelVersionDetails.findSaveLabelsButton().click() so the click only runs when
the Save Labels button is actually interactable.

Comment on lines +262 to +275
cy.findAllByTestId('label-error-alert')
.eq(0)
.should('be.visible')
.within(() => {
cy.contains(`can't exceed 63 characters`).should('exist');
});

cy.findAllByTestId('label-error-alert')
.eq(1)
.should('be.visible')
.within(() => {
cy.contains(`can't exceed 63 characters`).should('exist');
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate the label-error-alert testid usages to confirm how many alerts render per invalid label.
rg -nP -C4 'label-error-alert' --type=ts --type=tsx

Repository: opendatahub-io/odh-dashboard

Length of output: 99


🏁 Script executed:

#!/bin/bash
# Search for label-error-alert usages without the tsx type restriction
rg -nP -C4 'label-error-alert' packages/

Repository: opendatahub-io/odh-dashboard

Length of output: 10319


🏁 Script executed:

#!/bin/bash
# Read the test file to see the setup (lines 254-275) and understand what's being tested
head -n 280 packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts | tail -n 40

Repository: opendatahub-io/odh-dashboard

Length of output: 1256


🏁 Script executed:

#!/bin/bash
# Find component files that might contain the label-error-alert rendering logic
fd -e ts -e js -e tsx -e jsx . packages/ | xargs grep -l 'label-error-alert' | head -20

Repository: opendatahub-io/odh-dashboard

Length of output: 393


🏁 Script executed:

#!/bin/bash
# Find component files that render label-error-alert (likely in the model registry frontend)
fd -e ts -e tsx -e js -e jsx . packages/model-registry packages/cypress | xargs grep -l 'label-error-alert' 2>/dev/null | grep -v test | grep -v cypress

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Search for where label-error-alert testid is set (likely in component code)
rg "label-error-alert" packages/model-registry packages/ --type ts --type js -C3 | grep -v "test\|cypress" | head -60

Repository: opendatahub-io/odh-dashboard

Length of output: 92


🏁 Script executed:

#!/bin/bash
# Broader search for label-error-alert without type restrictions
rg 'label-error-alert' . --no-type-list | grep -v '.cy.ts' | head -20

Repository: opendatahub-io/odh-dashboard

Length of output: 515


🏁 Script executed:

#!/bin/bash
# Find the component files in model-registry frontend
fd -type f -name "*.tsx" -o -name "*.ts" packages/model-registry/upstream/frontend/src | grep -i label | head -20

Repository: opendatahub-io/odh-dashboard

Length of output: 242


🏁 Script executed:

#!/bin/bash
# Search for EditableLabels or similar component that would render these alerts
rg -i 'editable.*label|label.*error' packages/model-registry/upstream/frontend/src --type ts --type tsx | grep -v test | head -30

Repository: opendatahub-io/odh-dashboard

Length of output: 99


🏁 Script executed:

#!/bin/bash
# Search for label-error-alert in all files
rg 'label-error-alert' packages/model-registry/upstream/frontend/src/ | grep -v test

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Find component files with "label" in the name
find packages/model-registry/upstream/frontend/src -type f \( -name "*label*" -o -name "*Label*" \) ! -path "*/node_modules/*" ! -path "*/__tests__/*"

Repository: opendatahub-io/odh-dashboard

Length of output: 1213


🏁 Script executed:

#!/bin/bash
# Look at the test to understand the component context better
grep -B20 "should validate label length" packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts | head -40

Repository: opendatahub-io/odh-dashboard

Length of output: 797


🏁 Script executed:

#!/bin/bash
# Search across the entire repo for label-error-alert
rg 'label-error-alert' . | grep -v cypress | grep -v test

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Check the ModelLabels component which likely renders the editable labels
cat packages/model-registry/upstream/frontend/src/app/pages/modelRegistry/screens/components/ModelLabels.tsx

Repository: opendatahub-io/odh-dashboard

Length of output: 3848


🏁 Script executed:

#!/bin/bash
# Search for editable-label-group component
rg 'editable-label-group' packages/model-registry/upstream/frontend/src/ --type ts

Repository: opendatahub-io/odh-dashboard

Length of output: 1298


🏁 Script executed:

#!/bin/bash
# Look for editable labels component more broadly
find packages/model-registry/upstream/frontend/src -name "*.ts" -o -name "*.tsx" | xargs grep -l 'editable.*label\|EditableLabel' | grep -v test

Repository: opendatahub-io/odh-dashboard

Length of output: 310


🏁 Script executed:

#!/bin/bash
# Search in the entire packages directory for where label-error-alert is rendered
find packages -name "*.ts" -o -name "*.tsx" | xargs grep -l 'label-error-alert' | grep -v test | grep -v cypress

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Check the ModelVersionDetailsView component
cat packages/model-registry/upstream/frontend/src/app/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsView.tsx | head -200

Repository: opendatahub-io/odh-dashboard

Length of output: 7800


🏁 Script executed:

#!/bin/bash
# Search for where editable-label-group is defined/rendered in component code
rg 'editable-label-group' packages/model-registry/upstream/frontend/src --type ts -B5 -A10 | grep -v test | head -80

Repository: opendatahub-io/odh-dashboard

Length of output: 74


🏁 Script executed:

#!/bin/bash
# Look for any component that renders the validation error alerts
rg 'error.*alert|alert.*error' packages/model-registry/upstream/frontend/src/app --type ts -l | head -10

Repository: opendatahub-io/odh-dashboard

Length of output: 1226


🏁 Script executed:

#!/bin/bash
# Find where mod-arch-shared is located or if it's a package
find . -name "mod-arch-shared" -o -name "*mod-arch*" -type d | head -5

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Check if mod-arch-shared is in node_modules or locally defined
rg "label-error-alert" . --type ts --type js 2>/dev/null | grep -v cypress | grep -v test | head -10

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Look at the cypress test file more carefully to see if there's a comment or pattern explaining why two alerts
cat packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts | sed -n '240,280p'

Repository: opendatahub-io/odh-dashboard

Length of output: 1311


🏁 Script executed:

#!/bin/bash
# Check if mod-arch-shared is a package in package.json
grep -r "mod-arch-shared" packages/*/package.json | head -5

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Check the version and see if there's documentation or source
rg "EditableLabelsDescriptionListGroup" packages/model-registry/upstream/frontend/src --type ts -B2 -A10 | head -40

Repository: opendatahub-io/odh-dashboard

Length of output: 6772


🏁 Script executed:

#!/bin/bash
# See if there are any other tests with similar patterns to understand the expected behavior
grep -A5 "findAllByTestId.*eq\(1\)" packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts | head -30

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Check if there's a build or dist directory where mod-arch-shared might be available
find . -name "mod-arch-shared" -type d 2>/dev/null | head -5

Repository: opendatahub-io/odh-dashboard

Length of output: 54


🏁 Script executed:

#!/bin/bash
# Try to find the package.json and lockfile to see mod-arch-shared version/location
find packages/model-registry packages/cypress -name "package.json" -exec grep -l "mod-arch-shared" {} \;

Repository: opendatahub-io/odh-dashboard

Length of output: 126


🏁 Script executed:

#!/bin/bash
# Look at git history to see if this test was recently added or modified
cd packages/cypress && git log --oneline -20 -- cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts 2>/dev/null | head -10

Repository: opendatahub-io/odh-dashboard

Length of output: 123


🏁 Script executed:

#!/bin/bash
# Check what the recent fix changed in the test file
cd packages/cypress && git show cd060563b -- cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts | head -100

Repository: opendatahub-io/odh-dashboard

Length of output: 4358


🏁 Script executed:

#!/bin/bash
# Look at the package.json to see the mod-arch-shared dependency
cat packages/model-registry/upstream/frontend/package.json | grep -A2 "mod-arch-shared"

Repository: opendatahub-io/odh-dashboard

Length of output: 149


🏁 Script executed:

#!/bin/bash
# Check if there's any documentation or comments in the component about the two alerts
grep -r "error-alert" packages/model-registry/upstream/frontend/src --type ts -B3 -A3 | head -50

Repository: opendatahub-io/odh-dashboard

Length of output: 189


🏁 Script executed:

#!/bin/bash
# Look at the complete test file to see if there are any comments explaining the two alerts
cat packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts | sed -n '248,315p'

Repository: opendatahub-io/odh-dashboard

Length of output: 1989


🏁 Script executed:

#!/bin/bash
# Check the corresponding upstream test to see if it has the same pattern
cat packages/model-registry/upstream/frontend/src/__tests__/cypress/cypress/tests/mocked/modelRegistry/modelVersionDetails.cy.ts | sed -n '490,520p'

Repository: opendatahub-io/odh-dashboard

Length of output: 1119


🏁 Script executed:

#!/bin/bash
# Search for any README or documentation about EditableLabelsDescriptionListGroup
find . -name "README*" -o -name "*.md" | xargs grep -l "EditableLabelsDescriptionListGroup" 2>/dev/null

Repository: opendatahub-io/odh-dashboard

Length of output: 56


Add explicit length guard to prevent flaky test if UI alert count changes.

The test asserts both .eq(0) and .eq(1) of label-error-alert after adding a single 64-char label. While this pattern appears intentional across test files (the component likely renders two alerts per invalid label—inline and summary), the test lacks a defensive assertion. If the component ever changes to render only one alert, .eq(1) will fail intermittently, masking the actual issue. Add cy.findAllByTestId('label-error-alert').should('have.length', 2) before the existing assertions to make the expected behavior explicit and catch such regressions early.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/cypress/cypress/tests/mocked/modelRegistry/modelDetailsEditing.cy.ts`
around lines 262 - 275, Add an explicit length guard before asserting specific
indexes of the label-error-alert collection: after the
cy.findAllByTestId('label-error-alert') call and before the .eq(0)/.eq(1)
checks, add a should('have.length', 2) assertion so the test explicitly expects
two alerts; update the sequence around the existing
cy.findAllByTestId('label-error-alert') usages in modelDetailsEditing.cy.ts (the
block that currently calls .eq(0) and .eq(1)) to include this length check to
avoid flakiness if the component stops rendering both alerts.

Signed-off-by: ppadti <ppadti@redhat.com>
@ppadti
Copy link
Copy Markdown
Contributor Author

ppadti commented Apr 24, 2026

/retest

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.73%. Comparing base (4dbfc83) to head (754cd3e).
⚠️ Report is 35 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7338      +/-   ##
==========================================
+ Coverage   64.98%   65.73%   +0.75%     
==========================================
  Files        2446     2471      +25     
  Lines       76161    76722     +561     
  Branches    19213    19387     +174     
==========================================
+ Hits        49490    50433     +943     
+ Misses      26671    26289     -382     
Files with missing lines Coverage Δ
...rc/odh/components/MRDeploymentsContextProvider.tsx 100.00% <100.00%> (+88.88%) ⬆️

... and 145 files with indirect coverage changes


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 4dbfc83...754cd3e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant