Skip to content

testing: align right-click menu with hover bar on compressed result rows#309139

Merged
connor4312 merged 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/test-results-context-menu-actions
Apr 13, 2026
Merged

testing: align right-click menu with hover bar on compressed result rows#309139
connor4312 merged 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/test-results-context-menu-actions

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

When a TestCaseElement is rendered together with its only TestMessageElement child (the result tree compresses single-message test rows), the inline action bar in TestRunElementRenderer.renderCompressedElements is built for the parent element. The right-click handler in OutputPeekTree.onContextMenu, however, was operating on the compressed-in TestMessageElement returned by the tree. This left the right-click menu missing useful actions like Run Test and Debug Test even though those very same icons were visible in the inline action bar on the same row.

This change introduces a small getRenderedElement helper that mirrors the renderer's compression logic and uses the resulting element when computing actions and the action context for the right-click menu, so the menu now matches the inline action bar shown on the visible row.

Fixes #296078

Test plan

  • Run a project with failing tests (e.g. C# Dev Kit / pytest with one error message per test).
  • In the Test Results view, hover a failed test row whose error message is compressed into the same row and confirm the inline action bar shows Run Test / Debug Test icons.
  • Right-click the same row and verify the context menu now includes the same Run Test / Debug Test entries (in addition to Go to Error / Reveal in Test Explorer / etc).
  • Right-click an expanded standalone TestMessageElement and confirm it still shows message-specific actions.
  • Right-click a TestCaseElement (not compressed) and confirm behavior is unchanged.

When a TestCaseElement is rendered together with its only TestMessageElement
child, the inline action bar uses the parent element while the right-click
context menu was operating on the (compressed) message element. This caused
useful actions like Run Test and Debug Test to disappear from the right-click
menu even though they were visible as hover icons on the same row.

Mirror the renderer's compression logic in onContextMenu so that the menu
offered on right-click matches the actions shown in the inline action bar.

Fixes microsoft#296078
@connor4312 connor4312 enabled auto-merge (squash) April 13, 2026 15:20
@connor4312 connor4312 merged commit 8fadd39 into microsoft:main Apr 13, 2026
25 of 26 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 13, 2026
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.

Test Results window: right click on a test should include all the commands from the hover menu

3 participants