Add test case for production endpoint removal on MCP Runtime page#1396
Add test case for production endpoint removal on MCP Runtime page#1396agusandeepa wants to merge 1 commit into
Conversation
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.
📝 WalkthroughWalkthroughAdds 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. ChangesMCP runtime endpoint regression
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
🧹 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 winTighten 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
📒 Files selected for processing (1)
tests/cypress/e2e/publisher/024-mcp-server/02-runtime-config-production-endpoint-removed.cy.js



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.