fix(e2e): detect cross-row drag via data-row-index#132
Conversation
The previous y-distance heuristic in dragFieldOntoCell compared the vertical gap between source and target against sourceBox.height. After 3c72b20 shrank RowDropZone from h-6 (24px) to h-3 (12px), adjacent rows sit close enough that the gap is smaller than a card's height, so cross-row drags were misclassified as same-row. The helper then skipped the intermediate waypoint, and the direct path from source to target crossed the row drop zone, causing the drop to commit there and fire insertNewRow instead of stacking into the target column. Replace the heuristic with a direct comparison of data-row-index attributes on the source and target FieldCards. Robust to any future drop-zone size changes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR refactors the cross-row drag detection in the ChangesE2E Test Helper Improvements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
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 |
Problem
UI Tests on
develop(run 25745138544) fails on one Playwright spec:frontend/e2e/specs/form-layout.spec.ts:144— cross-row drag collapses source columnFailure screenshot shows
Bended up in its own row betweenAandC/D(3 rows total), not stacked aboveC.Root cause
dragFieldOntoCelldecides whether to inject a routing waypoint based on a y-distance heuristic:After 3c72b20 shrank
RowDropZonefromh-6(24px) toh-3(12px), adjacent rows sit close enough that the vertical gap between B center and C's upper quarter (~60px) is smaller than a card's height (~80px). SoisCrossRowevaluatesfalsefor a clearly cross-row drag.With no waypoint, the helper takes the direct path from source to target. The path crosses the
RowDropZonebetween rows, and the drop commits there.onRowZoneDropcallsinsertNewRow, putting B into its own row.Playwright trace from the failing run confirms only two mouse moves (midpoint + target) post-nudge, meaning the cross-row branch was skipped.
Fix
Detect cross-row by comparing
data-row-indexattributes on the source and targetFieldCardlocators. Robust to any future drop-zone size changes.Test plan
CI will run the full Playwright suite. The previously failing spec
form-layout.spec.ts:144should now pass; other layout drag tests are unaffected (they either operate within a single row or usedragFieldToRowZone/dragFieldToColumnZonewhich do not rely on this heuristic).Summary by CodeRabbit