Repository navigation
feat(websocket): show full message name in a tooltip on hover - #8299
Conversation
Walkthrough
ChangesWS Message Name Tooltip
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 (3)
tests/websockets/multi-message-bru/message-name-tooltip.spec.ts (1)
34-36: ⚡ Quick winAssert 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 winUse 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 winUse 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
📒 Files selected for processing (7)
packages/bruno-app/src/components/Environments/EnvironmentSelector/EnvironmentListContent/index.jspackages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.jspackages/bruno-app/src/components/ToolHint/index.jstests/utils/page/actions.tstests/utils/page/locators.tstests/websockets/multi-message-bru/message-name-tooltip.spec.tstests/websockets/multi-message-yml/message-name-tooltip.spec.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/websockets/multi-message-bru/message-name-tooltip.spec.ts (1)
30-31: ⚡ Quick winReduce the tooltip visibility timeout.
The 15-second timeout for tooltip visibility is excessive. ToolHint has a default
delayShowof 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 winReduce the tooltip visibility timeout.
Same as the bru test: the 15-second timeout for tooltip visibility is excessive. ToolHint has a default
delayShowof 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
📒 Files selected for processing (4)
packages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/StyledWrapper.jspackages/bruno-app/src/components/RequestPane/WsBody/SingleWSMessage/index.jstests/websockets/multi-message-bru/message-name-tooltip.spec.tstests/websockets/multi-message-yml/message-name-tooltip.spec.ts
Description
JIRA
Contribution Checklist:
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
Bug Fixes
Tests