fix(gen-ai): Fix flaky mcpTab test by re-querying server rows after modal closes#7030
fix(gen-ai): Fix flaky mcpTab test by re-querying server rows after modal closes#7030toklumpp wants to merge 9 commits intoopendatahub-io:mainfrom
Conversation
|
Skipping CI for Draft Pull Request. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughCypress test modifications in the MCP tab tests address stale DOM element references. Instead of reusing previously captured Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ 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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7030 +/- ##
==========================================
- Coverage 64.98% 64.96% -0.03%
==========================================
Files 2446 2447 +1
Lines 76161 76159 -2
Branches 19213 19216 +3
==========================================
- Hits 49490 49473 -17
- Misses 26671 26686 +15 see 14 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
a19ed6f to
2598bc4
Compare
5c7f865 to
8dbcdca
Compare
|
@toklumpp: The following test has Failed: OCI Artifact Browser URLInspecting Test Artifacts ManuallyTo inspect your test artifacts manually, follow these steps:
mkdir -p oras-artifacts
cd oras-artifacts
oras pull quay.io/opendatahub/odh-ci-artifacts:odh-pr-test-trainer-m2m2v |
8dbcdca to
0f45758
Compare
0f45758 to
75f4c81
Compare
47f5d9b to
1933412
Compare
|
/retest |
1933412 to
e097a88
Compare
e097a88 to
0ae37c8
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/retest |
1 similar comment
|
/retest |
NickGagan
left a comment
There was a problem hiding this comment.
Reran the job a few times and it's failing: https://github.com/opendatahub-io/odh-dashboard/actions/runs/24505080643/job/71651562272
Can you try temporarily updating the github workflow to create artifacts from the saved videos so we can get more information on what's causing the failures?
4dddc19 to
93d6572
Compare
…ferences The comprehensive tool selection test was failing because after closing the success modal, the table component remounts and the old serverRow reference becomes stale. Re-querying the server row after the modal closes ensures we get a fresh reference to the DOM element, fixing the 'element not found' timeout error. This matches the pattern used in other tests that don't have issues with stale references because they re-query elements after significant UI changes.
…nces Fix flaky test by re-querying the server row after modal closes to avoid stale DOM element references. After the success modal closes, the table component may remount, making the old serverRow reference stale. Re-querying ensures we get a fresh reference to the DOM element before interacting with the tools button. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… to avoid stale references Apply the same stale element fix to the "comprehensive tool selection operations" test that was previously applied to the auto-unlock test. Prevents Cypress timeout errors when clicking tools button after modal closes and components remount. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Apply stale element fixes to two more locations: - First test: Re-query server row after success modal closes before clicking tools button - Auto-unlock test: Use freshServerRow instead of old serverRow when re-opening tools modal These follow the same pattern as previous fixes to prevent Cypress timeout errors from stale DOM references. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…n in comprehensive test
Add .should('exist').and('not.have.attr', 'aria-disabled') assertions before clicking the tools button in the comprehensive tool selection test. This ensures Cypress waits for the element to be ready before attempting to click, preventing timeout errors when the element is still mounting.
Follows the same defensive pattern used in the auto-unlock test.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…al closes
Replace direct findMCPServersTable().should('be.visible') calls with
verifyMCPTabVisible() method which includes a 30-second timeout to
handle component remount delays after success modal closes.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…dal in comprehensive test Add verifyMCPTabVisible() call before querying server row when re-opening the tools modal to verify selection persistence. This prevents timeout errors when the MCP table hasn't fully remounted after closing the previous modal. Completes the fix started in previous commits by applying the same defensive pattern to the final location that was missing the visibility check. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…es in MCP tool selection test Forces immediate row query after table visibility check using .then() callback, eliminating stale element references without explicit timeouts. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5043251 to
b9916a3
Compare
|
/retest |
…s in MCP tools button After modal closes and MCP table remounts, directly query for the tools button using its testID instead of going through the page object's lazy selector. This avoids stale element references and ensures the element is found after the DOM updates. The testID uses serverUrl which matches server.id (set in transformMCPServerData), so direct query should reliably find the element. Related: RHOAIENG-49598
Description
This PR fixes flaky Gen AI mock tests in the MCP Servers tab by addressing stale element references.
Root Cause
When modals close in the MCP Servers test, the underlying DOM can be re-rendered, causing previously queried Cypress elements to become stale. Attempting to interact with these stale references causes intermittent test failures.
Changes Made
Test Reliability Fix
How Has This Been Tested?
Local Testing
cd packages/gen-ai/frontend && npm run test:cypress-ciCI Testing
/retestTest Impact
Tests Modified:
packages/gen-ai/frontend/src/__tests__/cypress/cypress/tests/mocked/playground/mcpTab.cy.tsTest Coverage:
Request review criteria:
Self checklist (all need to be checked):
If you have UI changes:
After the PR is posted & before it merges:
main