Skip to content

fix: multipart form upload icon visibility - #7571

Merged
bijin-bruno merged 1 commit into
usebruno:mainfrom
pooja-bruno:fix/multipart-form-upload-icon-visibility
Mar 27, 2026
Merged

bijin-bruno merged 1 commit into
usebruno:mainfrom
pooja-bruno:fix/multipart-form-upload-icon-visibility

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented Mar 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA

The file upload icon in the multipart form body editor was hidden by default and only appeared after specific conditions were met (key entered, no text value). This made the file upload feature hard to discover.

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

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the "Select file" button visibility in multipart form fields—it now displays consistently whenever no file is selected, regardless of text input status.
  • Tests

    • Added test coverage for upload button visibility in multipart form fields across different interaction scenarios.

@coderabbitai

coderabbitai Bot commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Simplified multipart form upload button visibility by removing conditional rendering logic based on row type and text content. The button now consistently appears for rows without assigned files. Added Playwright tests validating upload icon display across multiple row states.

Changes

Cohort / File(s) Summary
Multipart Form UI Components
packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js, packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
Removed isLastEmptyRow parameter and hasTextValue conditional logic. Upload button now always renders for rows lacking file assignments, regardless of text content or row position.
Test Coverage
tests/request/multipart-form/multipart-form-upload-icon.spec.ts
New Playwright test suite with three cases validating upload button visibility: on initial empty row, after key input with Tab commit, and after value entry in CodeMirror editor.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/S

Suggested reviewers

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

Poem

✨ Upload buttons shine without delay,
Always ready, come what may,
Form rows sparkle, clear and bright—
Files flow freely, day and night! 📁

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 change: making the multipart form upload icon visible by default instead of hidden under specific conditions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 (1)
tests/request/multipart-form/multipart-form-upload-icon.spec.ts (1)

33-72: Tests cover the key visibility scenarios effectively.

A couple of optional refinements:

  1. Locator extraction: Consider extracting repeated locators (e.g., page.locator('table tbody tr')) into a variable at the top of each test or as a helper for slightly better maintainability.

  2. Line 64 - Fixed position click: The { position: { x: 10, y: 10 } } approach works but can be brittle if the CodeMirror element's layout changes. An alternative is to use .focus() followed by keyboard input, though this current approach should work fine for this use case.

♻️ Optional: Extract common locators
  test('upload icon should be visible on the empty last row', async ({ page }) => {
    await test.step('Verify upload icon is visible on the empty row', async () => {
-     const rows = page.locator('table tbody tr');
+     const tableRows = page.locator('table tbody tr');
-     await expect(rows).toHaveCount(1);
+     await expect(tableRows).toHaveCount(1);
-     const uploadBtn = rows.first().locator('.upload-btn');
+     const uploadBtn = tableRows.first().locator('.upload-btn');
      await expect(uploadBtn).toBeVisible();
    });
  });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/request/multipart-form/multipart-form-upload-icon.spec.ts` around lines
33 - 72, Extract the repeated locator page.locator('table tbody tr') into a
variable (e.g., const rows = page.locator('table tbody tr')) at the start of
each test (or a small helper) and reuse it in places referencing rows.first() or
counting rows to reduce duplication; also replace the brittle fixed-position
click on the CodeMirror element (editor.click({ position: { x: 10, y: 10 } }))
by focusing the editor (e.g., await editor.focus()) before typing so the value
entry step in the test 'upload icon should remain visible after entering a
value' is more resilient to layout changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/request/multipart-form/multipart-form-upload-icon.spec.ts`:
- Around line 33-72: Extract the repeated locator page.locator('table tbody tr')
into a variable (e.g., const rows = page.locator('table tbody tr')) at the start
of each test (or a small helper) and reuse it in places referencing rows.first()
or counting rows to reduce duplication; also replace the brittle fixed-position
click on the CodeMirror element (editor.click({ position: { x: 10, y: 10 } }))
by focusing the editor (e.g., await editor.focus()) before typing so the value
entry step in the test 'upload icon should remain visible after entering a
value' is more resilient to layout changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2768f3a-0eca-40c8-81df-2dde921882c2

📥 Commits

Reviewing files that changed from the base of the PR and between 590a5a9 and 0aa7e44.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
  • tests/request/multipart-form/multipart-form-upload-icon.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