Skip to content

fix: tag persistence tests#6384

Merged
bijin-bruno merged 1 commit intousebruno:mainfrom
sanish-bruno:fix/tests
Dec 11, 2025
Merged

fix: tag persistence tests#6384
bijin-bruno merged 1 commit intousebruno:mainfrom
sanish-bruno:fix/tests

Conversation

@sanish-bruno
Copy link
Collaborator

@sanish-bruno sanish-bruno commented Dec 11, 2025

Description

Fix failing tests for tag persistence
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

Release Notes

  • Bug Fixes

    • Fixed tab persistence when adding or removing request tags—tabs now remain open as expected.
  • User Interface

    • Improved visual feedback with cursor pointer on interactive action elements.
  • Tests & Infrastructure

    • Enhanced test reliability with refactored element locator utilities.
    • Optimized test timeout detection for faster feedback cycles.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Walkthrough

The PR adds tag persistence by dispatching makeTabPermanent after tag modifications in requests, refactors test utilities to use a centralized locators abstraction for element access, reduces toast detection timeout, and improves UI cursor behavior on tab actions.

Changes

Cohort / File(s) Summary
App: Tag Persistence & UI
packages/bruno-app/src/components/RequestPane/Settings/Tags/index.js, packages/bruno-app/src/components/RequestTabs/index.js
Import makeTabPermanent and dispatch after tag additions/removals to mark tabs as permanent; add cursor-pointer class to action container for improved interaction feedback.
Test Utilities: Locators & Timeout
tests/utils/page/locators.ts, tests/utils/page/actions.ts
Extend buildCommonLocators with new tags property (input and item accessors); reduce toast timeout from 10s to 2s in createUntitledRequest.
Test Refactoring: Locators Abstraction
tests/collection/moving-requests/tag-persistence.spec.ts
Migrate from direct Playwright selectors to buildCommonLocators API throughout test suite; update interactions for modal, sidebar, tabs, and tags to use centralized locators.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • The test file refactoring is extensive but follows consistent replacement patterns; verify locator paths match expected DOM structure
  • Confirm the reduced 2000ms timeout for toast detection doesn't introduce flakiness under slower conditions
  • Validate makeTabPermanent dispatch is correctly integrated without disrupting existing tag workflows

Suggested reviewers

  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

🏷️ Tags now stick tabs where they belong,
Selectors dance with locators strong,
Timeouts trim—test suite runs fast,
These little tweaks make great things last! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: tag persistence tests' accurately describes the main objective of the changeset, which addresses failing tests related to tag persistence across multiple test and source files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
packages/bruno-app/src/components/RequestTabs/index.js (1)

172-189: Cursor affordance change looks good

Adding cursor-pointer to the plus-tab container improves the click affordance and doesn’t affect existing behavior or tests relying on .short-tab.

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

78-81: Centralized tag locators are consistent and useful

The new tags group (input() and item(tagName)) is consistent with other locator groups and will simplify tag‑related tests. This aligns well with the move toward shared locator utilities.

tests/collection/moving-requests/tag-persistence.spec.ts (2)

11-71: First tag persistence test correctly leverages shared locators

  • Using buildCommonLocators(page) plus locators.plusMenu, locators.modal, locators.sidebar, locators.tabs, and locators.tags makes the flow much easier to follow and less brittle than raw selectors.
  • The final check await expect(locators.tags.item('smoke')).toBeVisible() after selecting the Settings tab is a clear assertion that tags persist after intra‑collection reordering.

You might later consider replacing page.waitForTimeout(...) calls here with explicit waits on the relevant elements (e.g., active tab or tag input) to reduce timing sensitivity, but the current behavior is acceptable for now.


73-162: Folder move tag persistence test matches new locator patterns

  • The test now consistently uses buildCommonLocators(page) for collections, folders, requests, and modals, which aligns well with the shared locator utilities and reduces selector duplication.
  • Tag interactions via locators.tags.input() and locators.tags.item('smoke') clearly validate that the tag is created, saved, and still present after dragging request-2 from folder-1 to folder-2.
  • Waiting for locators.tabs.requestTab('request-2') before asserting on the tag is a good guard against race conditions when switching the active request.

As with the first test, some of the short waitForTimeout calls could eventually be replaced with explicit expectations on specific locators to make the test less timing-based, but that’s an incremental improvement rather than a blocker.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98513c6 and 74ed3dd.

📒 Files selected for processing (5)
  • packages/bruno-app/src/components/RequestPane/Settings/Tags/index.js (3 hunks)
  • packages/bruno-app/src/components/RequestTabs/index.js (1 hunks)
  • tests/collection/moving-requests/tag-persistence.spec.ts (3 hunks)
  • tests/utils/page/actions.ts (1 hunks)
  • tests/utils/page/locators.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/components/RequestTabs/index.js
  • tests/utils/page/actions.ts
  • tests/utils/page/locators.ts
  • tests/collection/moving-requests/tag-persistence.spec.ts
  • packages/bruno-app/src/components/RequestPane/Settings/Tags/index.js
tests/**/**.*

⚙️ CodeRabbit configuration file

tests/**/**.*: Review the following e2e test code written using the Playwright test library. Ensure that:

  • Follow best practices for Playwright code and e2e automation

  • Try to reduce usage of page.waitForTimeout(); in code unless absolutely necessary and the locator cannot be found using existing expect() playwright calls

  • Avoid using page.pause() in code

  • Use locator variables for locators

  • Avoid using test.only

  • Use multiple assertions

  • Promote the use of test.step as much as possible so the generated reports are easier to read

  • Ensure that the fixtures like the collections are nested inside the fixtures folder

    Fixture Example*: Here's an example of possible fixture and test pair

    .
    ├── fixtures
    │   └── collection
    │       ├── base.bru
    │       ├── bruno.json
    │       ├── collection.bru
    │       ├── ws-test-request-with-headers.bru
    │       ├── ws-test-request-with-subproto.bru
    │       └── ws-test-request.bru
    ├── connection.spec.ts # <- Depends on the collection in ./fixtures/collection
    ├── headers.spec.ts
    ├── persistence.spec.ts
    ├── variable-interpolation
    │   ├── fixtures
    │   │   └── collection
    │   │       ├── environments
    │   │       ├── bruno.json
    │   │       └── ws-interpolation-test.bru
    │   ├── init-user-data
    │   └── variable-interpolation.spec.ts # <- Depends on the collection in ./variable-interpolation/fixtures/collection
    └── subproto.spec.ts
    

Files:

  • tests/utils/page/actions.ts
  • tests/utils/page/locators.ts
  • tests/collection/moving-requests/tag-persistence.spec.ts
🧠 Learnings (2)
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Use consistent patterns and helper utilities where they improve clarity. Prefer shared test utilities over copy-pasted setup code, but only when it actually reduces complexity

Applied to files:

  • tests/collection/moving-requests/tag-persistence.spec.ts
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.test.{js,jsx,ts,tsx} : Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Applied to files:

  • tests/collection/moving-requests/tag-persistence.spec.ts
🧬 Code graph analysis (1)
tests/collection/moving-requests/tag-persistence.spec.ts (2)
tests/utils/page/locators.ts (1)
  • buildCommonLocators (3-106)
tests/utils/page/actions.ts (1)
  • selectRequestPaneTab (715-715)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
🔇 Additional comments (2)
tests/utils/page/actions.ts (1)

146-151: Shorter toast wait is reasonable

Reducing the toast visibility timeout to 2000 ms keeps this as a best‑effort synchronization point (thanks to the .catch) while trimming unnecessary idle time when the toast is missing or already gone.

packages/bruno-app/src/components/RequestPane/Settings/Tags/index.js (1)

20-43: Tag add/remove now correctly mark the tab as permanent

Dispatching makeTabPermanent({ uid: item.uid }) after both addRequestTag (only when a new tag is added) and deleteRequestTag ensures any tag edits mark the tab as permanent, which aligns with the tag persistence behavior. The useCallback dependency arrays remain valid with the new usage.

@bijin-bruno bijin-bruno merged commit 50a72a1 into usebruno:main Dec 11, 2025
8 checks passed
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