Skip to content

feat(websocket): show full message name in a tooltip on hover - #8299

Merged
sid-bruno merged 2 commits into
usebruno:mainfrom
pooja-bruno:feat/ws-message-name-tooltip
Jun 18, 2026
Merged

sid-bruno merged 2 commits into
usebruno:mainfrom
pooja-bruno:feat/ws-message-name-tooltip

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented Jun 18, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • WebSocket message names now show a hover tooltip with the full value when truncated.
    • Environment name tooltips are more reliably attached and positioned.
  • Bug Fixes

    • Tooltip rendering for externally anchored hints is now consistent, including for message-label hover states.
  • Tests

    • Added Playwright specs for WebSocket message name tooltip behavior and updated shared locators/utilities for interacting with message labels.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

ToolHint gains tooltipId and tooltipTestId props enabling external-anchor tooltip mode. SingleWSMessage uses these to show a tooltip on the message label with fixed positioning and test instrumentation. EnvironmentListContent migrates to the new tooltipId prop. Accordion CSS is refined to selectively dim content and constrain label layout. Two Playwright specs and supporting locator/action utilities validate the tooltip behavior for both collection formats.

Changes

WS Message Name Tooltip

Layer / File(s) Summary
ToolHint external-anchor contract
packages/bruno-app/src/components/ToolHint/index.js
Adds tooltipId and tooltipTestId props; refactors anchoring logic to suppress the internal span wrapper and content prop when an external anchor is detected; optionally wraps rendered content in a data-testid element.
SingleWSMessage tooltip wiring and styling
packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js, packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/StyledWrapper.js
Removes unused useRef import, introduces labelTooltipId computed from message UID, wraps label in ToolHint with fixed positioning and test id. CSS updates refine disabled-state dimming to exclude tooltip elements and add flex layout constraints for message label anchors.
EnvironmentSelector tooltipId migration
packages/bruno-app/src/components/Environments/EnvironmentSelector/EnvironmentListContent/index.js
Switches ToolHint from anchorSelect to the new tooltipId prop; adds matching data-tooltip-id attribute to each dropdown item.
Playwright locators and renameWsMessage action
tests/utils/page/locators.ts, tests/utils/page/actions.ts
Adds message.{label, nameInput, nameTooltip} locators to buildWebsocketCommonLocators; adds exported renameWsMessage action helper that double-clicks a message label, types a new name, and confirms with Enter.
Playwright tooltip specs (bru and yml)
tests/websockets/multi-message-bru/message-name-tooltip.spec.ts, tests/websockets/multi-message-yml/message-name-tooltip.spec.ts
Verifies short labels display without tooltip on hover and long truncated labels show visible tooltip with full name, across both bru and yml collection formats.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LabelElement as WS Label DOM
    participant SingleWSMessage
    participant ToolHint

    User->>LabelElement: mouseenter on label
    LabelElement->>SingleWSMessage: onMouseEnter handler fires
    SingleWSMessage->>ToolHint: render with labelTooltipId and data-tooltip-id
    User->>LabelElement: hover (Playwright test)
    LabelElement->>ToolHint: tooltip anchor matches via data-tooltip-id
    ToolHint-->>User: render tooltip with full message name (if truncated)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • usebruno/bruno#7719: Both PRs modify the WebSocket message UI—especially packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/* and its StyledWrapper—to support message name/rename interactions with tooltip/label behavior, so the tooltip wiring changes in the main PR build directly on the multi-message message rendering introduced in #7719.

Suggested reviewers

  • helloanoop
  • bijin-bruno
  • lohit-bruno
  • naman-bruno
  • sid-bruno

Poem

A label too long? It whispers its name,
truncated with ellipsis, yet never ashamed.
Hover to reveal what the width couldn't show,
ToolHint now anchors both high and below.
🏷️ Short names stay silent, long names speak true —
tooltip magic, crafted just for you!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature: adding a tooltip to display full WebSocket message names on hover, which aligns with all the changes across components, tests, and styling.
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.

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

✨ 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 and usage tips.

@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 (3)
tests/websockets/multi-message-bru/message-name-tooltip.spec.ts (1)

34-36: ⚡ Quick win

Assert hidden state instead of DOM count for tooltip absence.

On Line 35, toHaveCount(0) couples the test to tooltip mounting behavior. Prefer a visibility assertion to keep this behavioral.

Suggested patch
-      await expect(tooltip).toHaveCount(0);
+      await expect(tooltip).toBeHidden();

As per coding guidelines, E2E tests should verify user-visible behavior rather than implementation details.

🤖 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/websockets/multi-message-bru/message-name-tooltip.spec.ts` around lines
34 - 36, The test assertion on line 35 uses toHaveCount(0) to verify tooltip
absence, which tests DOM implementation details rather than user-visible
behavior. Replace the toHaveCount(0) assertion with a visibility-based assertion
such as toBeHidden() to verify that the tooltip element is not visible to the
user, ensuring the test validates actual user-perceivable behavior rather than
DOM mounting specifics.

Source: Coding guidelines

tests/websockets/multi-message-yml/message-name-tooltip.spec.ts (1)

34-36: ⚡ Quick win

Use a behavioral visibility check for the no-tooltip case.

On Line 35, asserting toHaveCount(0) is brittle if the tooltip stays mounted but hidden. A hidden-state assertion better matches UI behavior.

Suggested patch
-      await expect(tooltip).toHaveCount(0);
+      await expect(tooltip).toBeHidden();

As per coding guidelines, E2E tests should validate observable behavior and avoid implementation-coupled assertions.

🤖 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/websockets/multi-message-yml/message-name-tooltip.spec.ts` around lines
34 - 36, The assertion on the tooltip element using toHaveCount(0) is brittle
because it only verifies the element doesn't exist in the DOM rather than
checking if it's actually hidden from the user. Replace the toHaveCount(0)
assertion on the tooltip variable with a behavioral visibility check such as
toBeHidden() to properly validate that the tooltip is not visible to the user,
which aligns with E2E testing best practices of verifying observable behavior
rather than implementation details.

Source: Coding guidelines

tests/utils/page/actions.ts (1)

1952-1954: ⚡ Quick win

Use input-scoped fill to reduce focus-dependent flakiness.

On Line 1953, page.keyboard.type(name) relies on whichever element currently has focus. Using the locator directly is more deterministic for E2E runs.

Suggested patch
-    await nameInput.selectText();
-    await page.keyboard.type(name);
+    await nameInput.fill(name);

As per coding guidelines, tests should be deterministic and reproducible across runs.

🤖 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/utils/page/actions.ts` around lines 1952 - 1954, The
page.keyboard.type(name) call on line 1953 relies on the current focus state
which can cause flakiness in E2E tests. Replace this focus-dependent keyboard
input with a direct locator method by using nameInput.fill(name) instead, which
is more deterministic and ensures text is always input into the correct element
regardless of focus state. You can remove the selectText() call on line 1952
since fill() will handle clearing and setting the value directly.

Source: Coding guidelines

🤖 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/utils/page/actions.ts`:
- Around line 1952-1954: The page.keyboard.type(name) call on line 1953 relies
on the current focus state which can cause flakiness in E2E tests. Replace this
focus-dependent keyboard input with a direct locator method by using
nameInput.fill(name) instead, which is more deterministic and ensures text is
always input into the correct element regardless of focus state. You can remove
the selectText() call on line 1952 since fill() will handle clearing and setting
the value directly.

In `@tests/websockets/multi-message-bru/message-name-tooltip.spec.ts`:
- Around line 34-36: The test assertion on line 35 uses toHaveCount(0) to verify
tooltip absence, which tests DOM implementation details rather than user-visible
behavior. Replace the toHaveCount(0) assertion with a visibility-based assertion
such as toBeHidden() to verify that the tooltip element is not visible to the
user, ensuring the test validates actual user-perceivable behavior rather than
DOM mounting specifics.

In `@tests/websockets/multi-message-yml/message-name-tooltip.spec.ts`:
- Around line 34-36: The assertion on the tooltip element using toHaveCount(0)
is brittle because it only verifies the element doesn't exist in the DOM rather
than checking if it's actually hidden from the user. Replace the toHaveCount(0)
assertion on the tooltip variable with a behavioral visibility check such as
toBeHidden() to properly validate that the tooltip is not visible to the user,
which aligns with E2E testing best practices of verifying observable behavior
rather than implementation details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 56a23d67-7bfc-499b-bdd4-563b3a53ec72

📥 Commits

Reviewing files that changed from the base of the PR and between fab18d9 and 3203900.

📒 Files selected for processing (7)
  • packages/bruno-app/src/components/Environments/EnvironmentSelector/EnvironmentListContent/index.js
  • packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js
  • packages/bruno-app/src/components/ToolHint/index.js
  • tests/utils/page/actions.ts
  • tests/utils/page/locators.ts
  • tests/websockets/multi-message-bru/message-name-tooltip.spec.ts
  • tests/websockets/multi-message-yml/message-name-tooltip.spec.ts

@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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
tests/websockets/multi-message-bru/message-name-tooltip.spec.ts (1)

30-31: ⚡ Quick win

Reduce the tooltip visibility timeout.

The 15-second timeout for tooltip visibility is excessive. ToolHint has a default delayShow of 200ms, and tooltips typically appear within 1-2 seconds. If the tooltip truly requires 15 seconds to become visible, that suggests a flakiness issue or incorrect locator.

Recommend reducing to the default 5-second Playwright timeout or 2-3 seconds at most.

♻️ Proposed change
       await messageLabel.hover();
-      await expect(tooltip).toBeVisible({ timeout: 15000 });
+      await expect(tooltip).toBeVisible();
       await expect(tooltip).toContainText('hi');
       await messageLabel.hover();
-      await expect(tooltip).toBeVisible({ timeout: 15000 });
+      await expect(tooltip).toBeVisible();
       await expect(tooltip).toContainText(LONG_NAME);

Also applies to: 42-43

🤖 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/websockets/multi-message-bru/message-name-tooltip.spec.ts` around lines
30 - 31, The tooltip visibility timeout of 15000 milliseconds is excessive since
tooltips typically appear within 1-2 seconds with a default delayShow of 200ms.
In the test file, find the expect(tooltip).toBeVisible({ timeout: 15000 }) calls
(appearing at lines 30-31 and 42-43) and reduce the timeout value to either 5000
milliseconds (the default Playwright timeout) or 2000-3000 milliseconds to match
the expected tooltip appearance time. This applies to all instances of this
pattern in the file.
tests/websockets/multi-message-yml/message-name-tooltip.spec.ts (1)

30-31: ⚡ Quick win

Reduce the tooltip visibility timeout.

Same as the bru test: the 15-second timeout for tooltip visibility is excessive. ToolHint has a default delayShow of 200ms, and tooltips should appear within 1-2 seconds.

Recommend reducing to the default Playwright timeout or 2-3 seconds maximum.

♻️ Proposed change
       await messageLabel.hover();
-      await expect(tooltip).toBeVisible({ timeout: 15000 });
+      await expect(tooltip).toBeVisible();
       await expect(tooltip).toContainText('hi');
       await messageLabel.hover();
-      await expect(tooltip).toBeVisible({ timeout: 15000 });
+      await expect(tooltip).toBeVisible();
       await expect(tooltip).toContainText(LONG_NAME);

Also applies to: 42-43

🤖 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/websockets/multi-message-yml/message-name-tooltip.spec.ts` around lines
30 - 31, The tooltip visibility assertion in message-name-tooltip.spec.ts uses
an excessive 15000ms timeout. The expect(tooltip).toBeVisible() call at lines
30-31 and the similar assertion at lines 42-43 should have their timeout values
reduced to 2000-3000ms (2-3 seconds) since ToolHint has a default delayShow of
200ms and tooltips should appear within 1-2 seconds. Either reduce the timeout
parameter to 2000 or 3000 milliseconds, or remove the timeout parameter entirely
to use Playwright's default timeout.
🤖 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.

Inline comments:
In
`@packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js`:
- Around line 7-11: The CSS selectors use `:not(.toolhint)` to exclude elements
from opacity transitions, but the ToolHint wrapper span actually has the class
name "message-label-anchor" (line 211), not "toolhint". The ".toolhint" class
only exists on the ReactToolHint popup element which is not a child of
".accordion-left". To fix this, update the CSS selector from `:not(.toolhint)`
to `:not(.message-label-anchor)` in all affected locations (including those also
mentioned in lines 14-18 and other similar selectors) so that the message label
anchor element is properly excluded from the opacity transitions and dimming as
intended by the comment.

---

Nitpick comments:
In `@tests/websockets/multi-message-bru/message-name-tooltip.spec.ts`:
- Around line 30-31: The tooltip visibility timeout of 15000 milliseconds is
excessive since tooltips typically appear within 1-2 seconds with a default
delayShow of 200ms. In the test file, find the expect(tooltip).toBeVisible({
timeout: 15000 }) calls (appearing at lines 30-31 and 42-43) and reduce the
timeout value to either 5000 milliseconds (the default Playwright timeout) or
2000-3000 milliseconds to match the expected tooltip appearance time. This
applies to all instances of this pattern in the file.

In `@tests/websockets/multi-message-yml/message-name-tooltip.spec.ts`:
- Around line 30-31: The tooltip visibility assertion in
message-name-tooltip.spec.ts uses an excessive 15000ms timeout. The
expect(tooltip).toBeVisible() call at lines 30-31 and the similar assertion at
lines 42-43 should have their timeout values reduced to 2000-3000ms (2-3
seconds) since ToolHint has a default delayShow of 200ms and tooltips should
appear within 1-2 seconds. Either reduce the timeout parameter to 2000 or 3000
milliseconds, or remove the timeout parameter entirely to use Playwright's
default timeout.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a6da65b-441e-4569-ad21-dceb6c7d8c10

📥 Commits

Reviewing files that changed from the base of the PR and between 3203900 and b4d9f56.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.js
  • tests/websockets/multi-message-bru/message-name-tooltip.spec.ts
  • tests/websockets/multi-message-yml/message-name-tooltip.spec.ts

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants