fix(app): rewrite prompt-drop-file e2e to match attachment routing gate - #660
Conversation
The legacy spec asserted that dropping any image always renders an attachment chip. After the model-gated attachment routing landed, the shared e2e backend (which only ships text-only opencode models) makes that assertion impossible to satisfy: routeBrowserFile rightly returns reject-image and the chip never appears. The spec has been silently failing on dev pushes since then because it lacks @smoke and the e2e job downgrades failures to warnings. Replace the spec with two narrow tests that match what the test backend can actually exercise: - dropping an image with a text-only model surfaces the imageUnsupported toast and the "Choose model" CTA, with no chip - dropping a text file routes through addDirect and renders a removable attachment chip via PromptImageAttachments' non-image fallback The image happy path still needs a vision-capable seed model in the e2e backend; tracking that as a follow-up rather than bundling it here. Closes #652
📝 WalkthroughWalkthroughThe e2e test for file drop behavior is updated to reflect text-only backend constraints. Image drops now trigger an unsupported-images toast; text file drops create a removable attachment chip with interactive controls. ChangesDrop-file e2e test updates for text-only backend
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Suggested priority: P3 (only low-risk paths changed (packages/app/e2e/prompt/prompt-drop-file.spec.ts)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request updates the E2E tests for the file-drop pipeline to account for backend constraints where only text-only models are available. It replaces the previous image attachment test with a scenario that verifies an unsupported model toast and adds a new test case for dropping and removing text file attachments. A review comment suggested improving the fidelity of the text file removal test by replacing a forced click with an explicit hover action, ensuring the test correctly simulates the UI behavior where the remove button only appears on hover.
Per Gemini review: the remove button uses opacity-0 group-hover:opacity-100,
so { force: true } was bypassing actionability. Hover the chip first so the
button becomes interactive and let Playwright run the normal click path.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/app/e2e/prompt/prompt-drop-file.spec.ts (1)
53-53: ⚡ Quick winScope the remove button query to the chip locator.
Currently the remove button is queried from the page level with
.first(). Scoping it to thechiplocator is more robust and makes the test intent explicit.♻️ Scope the query to the chip
- const remove = page.getByRole("button", { name: "Remove attachment" }).first() + const remove = chip.getByRole("button", { name: "Remove attachment" })🤖 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 `@packages/app/e2e/prompt/prompt-drop-file.spec.ts` at line 53, The remove button is being selected from the whole page with page.getByRole(...).first(), which is brittle; instead scope the query to the existing chip locator (e.g., use chip.getByRole("button", { name: "Remove attachment" }) ) so the test explicitly targets the remove button inside that chip; update the variable declaration for remove to use the chip locator (reference the existing chip variable) and remove the .first() call.
🤖 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.
Nitpick comments:
In `@packages/app/e2e/prompt/prompt-drop-file.spec.ts`:
- Line 53: The remove button is being selected from the whole page with
page.getByRole(...).first(), which is brittle; instead scope the query to the
existing chip locator (e.g., use chip.getByRole("button", { name: "Remove
attachment" }) ) so the test explicitly targets the remove button inside that
chip; update the variable declaration for remove to use the chip locator
(reference the existing chip variable) and remove the .first() call.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d7e4e82a-9431-4ec6-a9b3-6400f6326458
📒 Files selected for processing (1)
packages/app/e2e/prompt/prompt-drop-file.spec.ts
|
@coderabbitai re. nitpick on prompt-drop-file.spec.ts L53: skipping. |
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
|
Summary
Replace the failing
packages/app/e2e/prompt/prompt-drop-file.spec.tswith two narrow tests that match the behavior the shared e2e backend can actually exercise.Why
The legacy spec asserted that dropping any image always renders an attachment chip. After PR #565749412 (
feat: route prompt composer attachments, 2026-04-22) introduced the model-gated routing inpackages/app/src/components/prompt-input/attachment-routing.ts, that assertion is impossible to satisfy in e2e: the shared backend only exposes text-only opencode models (big-pickle and four other free models, allmodalities.input: ["text"]), sorouteBrowserFilerightly returnsreject-imageand the chip never appears. The spec has been silently failing on dev pushes ever since because it is not tagged@smokeand the e2e job downgrades failures to warnings, not blocking checks.i652 was filed assuming a regression on dev. Investigation confirmed the drop wiring itself is healthy:
attachments.tsfiresevent.dataTransfer.filesis populatedrouteBrowserFilereturnsreject-imagewarnImageUnsupportedtoast renders correctly with the "Choose model" CTAThe product behavior is correct. The test was outdated.
Related Issue
Closes #652.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
This model cannot read imagesand theChoose modelbutton are taken verbatim fromprompt.toast.imageUnsupported.*inpackages/app/src/i18n/en.ts.drop.txt) acceptable as a stand-in for the image happy path? The image branch needs a vision-capable seed model in the e2e backend; tracked as a follow-up rather than bundled here.Risk Notes
None. Test-only change, no product code touched. The drop wiring and the routing gate are unchanged.
How To Verify
Screenshots or Recordings
Not applicable. Test-only change; no UI surface changed.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Release Notes
New Features
Bug Fixes