Skip to content

Add test case for production endpoint removal on MCP Runtime page#1396

Open
agusandeepa wants to merge 1 commit into
wso2:mainfrom
agusandeepa:main
Open

Add test case for production endpoint removal on MCP Runtime page#1396
agusandeepa wants to merge 1 commit into
wso2:mainfrom
agusandeepa:main

Conversation

@agusandeepa

Copy link
Copy Markdown

Existing tests (00-runtime-config-endpoint-display.cy.js and
01-runtime-config-from-existing-api.cy.js) only cover the sandbox
endpoint deletion scenario for the Runtime Configuration crash fix.

Purpose

This adds the mirror test case - deleting the production endpoint
instead of sandbox - to cover the other half of the optional-chaining
fix mentioned in the original bug (production_endpoints.url OR
sandbox_endpoints.url could be null).

Goals

Ensure the Runtime Configuration page doesn't crash when the
production endpoint is removed via UI, matching test coverage
already in place for the sandbox endpoint case.

Approach

Mirrors the existing test structure - creates an MCP server, adds
both production and sandbox endpoints, deletes production via UI,
then verifies the Runtime page renders "-" for production instead
of crashing.

Documentation

Not applicable - this is a test-only change.

Existing tests (00 and 01) only cover the sandbox endpoint deletion 
  scenario. This adds the mirror case - deleting the production 
  endpoint - to cover the other half of the optional-chaining fix 
  mentioned in the original bug fix comments.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Cypress regression test that configures an MCP server with only a sandbox endpoint, removes the production endpoint through the Publisher UI, and verifies runtime configuration rendering.

Changes

MCP runtime endpoint regression

Layer / File(s) Summary
Scenario setup and cleanup
tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js
Defines the Cypress suite, authenticates with Publisher credentials, documents the regression scenario, and deletes the created MCP server after the test.
Endpoint removal and runtime validation
tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js
Creates an MCP server, updates backend configuration with a sandbox URL, removes the production endpoint through the UI, and verifies Sandbox details and Production rendering on the runtime-configuration page.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • wso2/apim-apps#1371: Addresses the MCP Runtime UI crash scenario involving absent production or sandbox endpoint URLs.
  • wso2/apim-apps#1379: Adds related Cypress coverage for MCP runtime endpoint display and crash cases.

Suggested reviewers: lasanthas, krishanx92, tharikagithub, ashera96, heshansudarshana

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a test for production endpoint removal on the MCP Runtime page.
Description check ✅ Passed The description matches the changeset and explains the added regression test for production endpoint deletion.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js (1)

104-110: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Tighten the Production - assertion to avoid false positives.

cy.contains('-') at Line 109 only asserts some element with a hyphen exists within #endpoints; it doesn't verify the dash is actually rendered against the "Production" row/value specifically. Since this exact rendering (no-crash-shows-dash) is the regression this spec is meant to catch, a loosely-scoped match weakens the guarantee — the assertion could pass even if the dash is rendered elsewhere and the Production value is broken/missing.

♻️ Proposed tightening
                         cy.get('`#endpoints`').within(() => {
                             cy.contains('Sandbox').should('be.visible');
                             cy.contains('https://sandbox.petstore.swagger.io/v2').should('be.visible');

-                            cy.contains('Production').should('be.visible');
-                            cy.contains('-').should('be.visible');
+                            cy.contains('Production')
+                                .closest('[class*="endpoint"], tr, div')
+                                .should('contain', '-');
                         });

Adjust the selector to the actual DOM structure of the Production row so the dash is checked in relation to the label.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js`
around lines 104 - 110, Update the Production assertion within the `#endpoints`
block to target the actual DOM structure of the Production row, verifying that
the value rendered alongside the “Production” label is exactly “-” rather than
matching any hyphen-containing element. Keep the existing Sandbox assertions
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js`:
- Around line 104-110: Update the Production assertion within the `#endpoints`
block to target the actual DOM structure of the Production row, verifying that
the value rendered alongside the “Production” label is exactly “-” rather than
matching any hyphen-containing element. Keep the existing Sandbox assertions
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6ecf1399-d1ca-494c-9ab6-be035553b3e0

📥 Commits

Reviewing files that changed from the base of the PR and between b96353b and 9f6ebfa.

📒 Files selected for processing (1)
  • tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant