Skip to content

Add cookie management support#2

Open
chirag-bruno wants to merge 1 commit intousebruno:mainfrom
chirag-bruno:feature/cookies
Open

Add cookie management support#2
chirag-bruno wants to merge 1 commit intousebruno:mainfrom
chirag-bruno:feature/cookies

Conversation

@chirag-bruno
Copy link
Copy Markdown
Collaborator

Summary

Adds full cookie management support to the VS Code extension, bridging the existing Cookie UI to the @usebruno/requests cookie jar.

  • 6 IPC handlers for cookie CRUD operations (add, modify, delete, parse, clear domain)
  • Cookies from server responses are now captured and broadcast to the webview UI
  • StatusBar component mounted in the main layout with Cookies button
  • data-testid attributes on all cookie UI elements for testability
  • 9 unit tests + 2 e2e tests

Changes

Backend:

  • src/extension/ipc/cookie-handlers.ts — IPC handlers for all cookie operations
  • src/extension/ipc/network/index.ts — Broadcast main:cookies-update after response cookies are captured
  • src/extension/extension.ts — Register cookie handlers on activation

Frontend:

  • src/webview/pages/Bruno/index.tsx — Mount StatusBar component
  • src/webview/components/StatusBar/index.tsx — Remove VS Code-native items (DevTools, Search, Notifications)
  • src/webview/components/Cookies/index.tsx — Add data-testid attributes, resize modal
  • src/webview/components/Cookies/ModifyCookieModal/index.tsx — Add data-testid to form fields

Testing:

  • src/extension/ipc/cookie-handlers.spec.ts — 9 unit tests for cookie jar operations
  • tests/e2e/specs/cookies.spec.ts — 2 e2e tests (empty state, cookie capture)
  • tests/e2e/server/auth/cookie.ts — Cookie auth endpoints (login, logout, protected, set, echo)

Test plan

  • npm test — 9 unit tests pass
  • npm run test:e2e -- --grep Cookie — 2 e2e tests pass
  • npm run build — extension builds
  • Manual: open Cookies modal, add a cookie, edit it, delete it
  • Manual: send request to server that sets cookies, verify they appear in modal

Backend:
- Cookie IPC handlers: delete, add, modify, parse, create cookie string
- Broadcast cookies-update to webviews after request execution
- Register handlers in extension activation

Frontend:
- Mount StatusBar in Bruno page layout (was defined but never rendered)
- Remove DevTools, Search, Notifications from status bar (VS Code native)
- Resize cookies modal to md
- Add data-testid attributes to cookie UI components

Testing:
- Vitest + vscode mock setup
- 9 unit tests for cookie jar operations
- 2 Playwright e2e tests (empty state, cookie capture from response)
- Local test server with cookie auth endpoints
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.

2 participants