Repository navigation
fix(variable-tooltip): mask secret variables of non-string dataType - #8606
bijin-bruno merged 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe PR adds stable test identifiers to request URL and variable tooltip elements, updates masking for non-string values, introduces typed-variable test utilities, and expands tooltip coverage for typed, object, and global secret variables. ChangesVariable tooltip coverage
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/utils/page/actions.ts (1)
818-829: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winHelper functions embed
expect(...); per the E2E guide, assertions belong in specs.
addRowToActiveTab(818-829) andopenUrlVarTooltip(2439-2452) each containexpect(...)calls used purely for synchronization ("settle signal"). Per the referenced guide, page-module helpers should synchronize withwaitFor/locator waits and leave pass/fail assertions to the calling specs.
openUrlVarTooltiphas a clean one-line fix;addRowToActiveTab's attribute check can uselocator.and()to narrow without asserting:♻️ Suggested sync-only rewrites
const tooltip = varInfoPopup.all().first(); - await expect(tooltip).toBeVisible(); + await tooltip.waitFor({ state: 'visible' }); return tooltip;- await expect(dataTypeSelector.typeLabel(row)).toHaveAttribute('data-selected-type', dataType); + await dataTypeSelector.typeLabel(row) + .and(page.locator(`[data-selected-type="${dataType}"]`)) + .waitFor();Note: many pre-existing helpers in this file (
createCollection,createRequest,closeAllCollections) already embedexpect(...)too, so this isn't a new pattern in the codebase — flagging for awareness rather than as a blocker.Based on path instructions for
tests/**/**.*, which state (per docs/playwright-testing-guide.md): "helper/action functions should synchronize (wait for UI readiness) but must not containexpect(...); specs should own pass/fail intent."Also applies to: 2439-2452
🤖 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 818 - 829, Remove the synchronization-only expect(...) calls from addRowToActiveTab and openUrlVarTooltip. Replace them with locator-based waits, narrowing the data-type locator with locator.and() where needed to wait for the selected attribute without asserting; preserve the existing UI readiness behavior and leave pass/fail assertions to calling specs.Source: Path instructions
🤖 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 `@tests/variable-tooltip/variable-tooltip.spec.ts`:
- Around line 79-81: Centralize the variable locators used by the spec instead
of filtering `.cm-variable-*` directly. Extend `request.bodyVariableToken` to
accept the same state parameter as `request.urlVariableToken`, add a
corresponding helper for the header/auth value editor, and update both affected
spots in the test to use these locator helpers.
---
Nitpick comments:
In `@tests/utils/page/actions.ts`:
- Around line 818-829: Remove the synchronization-only expect(...) calls from
addRowToActiveTab and openUrlVarTooltip. Replace them with locator-based waits,
narrowing the data-type locator with locator.and() where needed to wait for the
selected attribute without asserting; preserve the existing UI readiness
behavior and leave pass/fail assertions to calling specs.
🪄 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: 571af7f9-5b05-419a-a9f8-fdb584732e69
📒 Files selected for processing (7)
packages/bruno-app/src/components/RequestPane/QueryUrl/index.jspackages/bruno-app/src/utils/codemirror/brunoVarInfo.jstests/utils/constants/index.tstests/utils/constants/variables.tstests/utils/page/actions.tstests/utils/page/locators.tstests/variable-tooltip/variable-tooltip.spec.ts
sachin-thakur-bruno
left a comment
There was a problem hiding this comment.
tested locally. working as expected
Description
Fixes the variable-info tooltip rendering an empty value for secret variables whose dataType is not a string (number, boolean, object).
Root cause: getMaskedDisplay measured .length on the raw value to decide how many mask characters
(*)to render. A non-string value (e.g. the number 12345) has no.length, so it evaluated to undefined, producing zero mask characters a blank tooltip. Plain (non-secret) variables were unaffected because they skip masking and coerce to a string via textContent.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.
Screen.Recording.2026-07-14.at.6.56.02.PM.mov
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
null/undefineddisplay correctly, and masking length is computed more reliably across typed values (number, boolean, object).Tests