Repository navigation
fix: multipart form upload icon visibility - #7571
bijin-bruno merged 1 commit into
Conversation
WalkthroughSimplified 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 (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:
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.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
📒 Files selected for processing (3)
packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.jspackages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.jstests/request/multipart-form/multipart-form-upload-icon.spec.ts
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:
Summary by CodeRabbit
Bug Fixes
Tests