DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
Cypress

How to Fix Cypress Drag-and-Drop Tests That Pass Without Dragging

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a Cypress drag-and-drop test passes even though nothing moved, the usual cause is a false positive: .trigger() dispatched an event and ran a listener, but the browser did not perform its native drag behavior. Fix the test by identifying whether the component uses mouse, pointer, or HTML5 drag events, reproducing that interaction appropriately, and asserting the resulting position or persisted state—not merely that a callback ran.

Why a passing test may not drag anything

Cypress documents that .trigger() fires the corresponding event and invokes listeners, but does not make the browser perform the event’s default action. In practical terms, a drop handler can execute while the browser never carries an item through a real drag pipeline. A test that checks only for the handler, a dispatched event, or the continued visibility of the item can therefore pass without proving that a user could move it.

The first debugging step is to read the assertion literally. Ask what durable fact would be different after a successful drag:

  • Is the card now rendered inside the destination?
  • Did the item move to the expected index?
  • Did the application save the new order?
  • Did a status, URL, or API-backed state change?

Assert one of those outcomes. Event spies and callback assertions can remain useful diagnostics, but they are not a substitute for an outcome assertion.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)

Identify the drag model before changing Cypress code

Drag interfaces are not interchangeable. Inspect the component documentation and event handlers, then classify the interaction.

Mouse-driven sortable behavior

Libraries such as jQuery UI Sortable commonly react to mousedown, mousemove, and mouseup. They may require a primary-button value and page coordinates. A sequence that omits those properties can call a listener without crossing the library’s movement threshold.

Pointer-driven behavior

Components built around Pointer Events may listen for pointerdown, pointermove, and pointerup, often tracking a pointer identifier and coordinates. Sending only mouse events may never enter the component’s drag state. Use the event family the component actually registers.

HTML5 drag-and-drop

Native-style implementations use dragstart, dragover, and drop, with data carried through DataTransfer. Manually firing those events does not automatically create the browser’s native drag operation. If the application depends on browser-managed behavior, synthetic dispatch can be the wrong level of test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Repair a mouse-based sortable test

Cypress’s documented jQuery UI Sortable example supplies the primary-button field and page coordinates:

Rank #2
Sale
Logitech G305 Lightspeed Wireless Gaming Mouse - Black
  • The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
  • Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
  • G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
  • Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
  • The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere
cy.get('[data-cy=draggable]').trigger('mousedown', {
  which: 1,
  pageX: 600,
  pageY: 100,
})

cy.get('[data-cy=draggable]').trigger('mousemove', {
  which: 1,
  pageX: 600,
  pageY: 600,
})

cy.get('[data-cy=draggable]').trigger('mouseup')

Those coordinates are example values, not universal settings. Use a start point inside the draggable and a destination point inside the target in your fixture. If the library calculates movement from client coordinates instead of page coordinates, provide the properties its handlers read. Likewise, use the selector for the actual draggable element, not a decorative child.

Follow the interaction with a state assertion:

cy.get('[data-cy=drop-zone] [data-cy=item-card]')
  .should('contain.text', 'Item A')

cy.get('[data-cy=list] [data-cy=item-card]')
  .eq(2)
  .should('contain.text', 'Item A')

Choose the assertion that represents your application’s contract. If the order is persisted asynchronously, wait for the visible order or the saved status rather than asserting immediately after mouseup.

When synthetic HTML5 events are appropriate

Use .trigger() for HTML5 drag events when the test intentionally exercises your handlers and you can provide the event data they require. Cypress’s drag recipe demonstrates triggering mouse and drag events, but the API still only dispatches events. Your test must supply implementation-specific details such as DataTransfer fields when the handlers inspect them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This approach is most maintainable when the component exposes a clear event contract and the goal is to test application logic around those handlers. It is fragile when the behavior depends on the browser’s native drag processing, because a hand-built sequence can look plausible while skipping the browser work that moves data between elements.

Use browser-driven HTML5 drag when native behavior matters

If synthetic events do not activate a native HTML5 drag implementation, a browser-protocol helper can be a better fit. The community project cypress-real-dnd describes a Chrome DevTools Protocol technique that drives the HTML5 dragstart → dragover → drop pipeline. Its maintainers target Chromium-family browsers and document Cypress 12 or newer, along with setup and re-warm considerations.

Rank #3
Sale
Logitech M185 Compact Ambidextrous Wireless Mouse with Rubber Grips - Blue
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)

That is community software, not a Cypress API guarantee. Check the project’s current release, your Cypress version, and the browser used in CI before adopting it. Its stated focus is HTML5 drag APIs; for mouse- or pointer-based sortable libraries, the project documentation recommends using the corresponding mouse or pointer interaction instead.

If the interaction is actually dropping a file, use Cypress’s .selectFile() support rather than treating it as a general sortable-card drag. File selection and file-drop testing have different mechanics from moving an existing item between lists.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make the assertion prove the user outcome

A reliable drag test normally verifies three layers:

  1. Selection: the intended draggable and destination are found.
  2. Interaction: the event or browser-driven sequence completes without an error.
  3. Outcome: the item is in the expected container, order, or saved state.

The third layer is the essential one. For a kanban board, assert the card under the destination column. For a sortable list, assert its index relative to neighboring items. For an application that saves through an API, assert the UI’s confirmed state or reload and verify the persisted order when that is the behavior under test.

Debug targeting and Cypress actionability

Cypress action commands check whether elements are visible, attached, uncovered, scrolled into view, and not unexpectedly animating. Use .debug() immediately before the drag sequence, pause with a debugger when necessary, and inspect the yielded element. Confirm that the selector resolves to the intended draggable rather than a hidden duplicate or a child that does not own the handlers.

Rank #4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
  • Computer mouse for easily navigating a computer interface; click, scroll, and more
  • USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
  • High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
  • 3 buttons offer effortless fingertip control
  • Plug-and-go ready for instant use

Remember that .trigger() requires a yielded element, window, or document. A chain that accidentally yields no element, or yields a stale element after a rerender, can make the test appear to exercise the wrong node.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not add { force: true } simply to make a failing command pass. Cypress describes force as an escape hatch that bypasses actionability checks. It can conceal a covered, detached, or otherwise unclickable target. Use it only when bypassing those checks is deliberate and you still assert the resulting application state.

Choose the least fragile technique

Technique Use it when Limitation
Cypress .trigger() with mouse events The component listens to mouse events, such as a sortable library. You must provide the event properties and coordinates that implementation expects.
.trigger() with HTML5 drag events You are intentionally dispatching handlers and control the required data. Dispatch alone does not perform the browser’s native default action; DataTransfer details can make the sequence brittle.
CDP-driven HTML5 helper The application requires Chromium’s native HTML5 drag pipeline. Community-maintained, Chromium-family scope, with setup and compatibility checks.
.selectFile() The scenario is selecting or dropping files. It is not a general solution for moving cards or sortable items.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

The drop callback runs, but the item stays put

You probably dispatched a listener without native drag behavior, or the assertion checks only the callback. Identify the event model, use a browser-driven helper when required, and assert destination or order.

The sortable library ignores the movement

Provide the primary-button field and realistic coordinates. Verify that the initial point is inside the draggable and that the movement crosses the library’s threshold. Use the library’s expected coordinate properties rather than copying values from an unrelated fixture.

The test targets the wrong element

Inspect the yielded subject with .debug(). Check for duplicate responsive markup, hidden templates, rerendered nodes, and selectors attached to a child instead of the draggable root.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Acer Wireless Mouse for Laptop, 2.4GHz Computer Mouse 3 Adjustable 1600 DPI
  • 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
  • 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
  • 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
  • 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
  • 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.

The element is covered, detached, or still animating

Fix the fixture or wait for the application to reach an actionable state. Reserve force for an intentional exception, not as a general repair.

HTML5 drag works locally but fails in CI

Compare the browser family and Cypress version, especially if using a community CDP helper. Confirm its setup and re-warm requirements, and avoid assuming that a Chromium-specific technique will behave the same in another browser.

The test passes even after removing the drag

Strengthen the assertion. Remove the interaction temporarily and confirm that the destination/order assertion fails; otherwise the test is not proving the drag.

Or skip the browser setup

When you need screenshots of a page or test fixture rather than an interactive drag, ScreenshotNeo provides a single HTTP request. Before capture it accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. It also offers an MCP server for AI agents such as Claude and Cursor, with take_screenshot, get_page_info, and capture_pdf.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the ScreenshotNeo documentation for all options, including full-page and element captures, device and viewport settings, retina scale, dark mode, custom CSS or JavaScript, waits, request blocking, headers, cookies, user agents, timezone and geolocation, PDF output, caching, signed links, asynchronous jobs, bulk capture, and usage reporting.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is included on every plan. Create a free ScreenshotNeo account to try it.

A practical repair checklist

  • Rewrite the assertion so it proves destination, order, or saved state.
  • Determine whether the component uses mouse, pointer, or HTML5 drag events.
  • Match the event family and required properties, including coordinates or data.
  • Use native browser driving for implementations that depend on the HTML5 pipeline.
  • Inspect the yielded elements and Cypress actionability before reaching for force.
  • Run the test with the drag removed once to verify that the outcome assertion fails.

Frequently Asked Questions

Does adding more .trigger() calls make a native drag real?

No. Additional dispatches can satisfy handlers but still do not cause the browser to perform its default drag action. Use a browser-driven technique when native behavior is part of the requirement.

Should every drag test use a CDP plugin?

No. Use ordinary Cypress events for mouse- or pointer-based components when they accurately model the library. Reserve a CDP helper for native HTML5 behavior that synthetic events cannot exercise.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the safest assertion for a sortable list?

Assert the item’s final index or its position relative to neighboring items, and include the persisted or confirmed state when saving order is part of the feature.

Quick Recap

SaleBestseller No. 1
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Product carbon footprint: 3.97 kg CO2e; Contoured shape: Gives you more comfort and control
$14.90
SaleBestseller No. 3
Bestseller No. 4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Computer mouse for easily navigating a computer interface; click, scroll, and more; 3 buttons offer effortless fingertip control
$9.70

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.