All threads / How can I test sortableJs ? (RSpec)
Ask A Question


You’re not receiving notifications from this thread.

How can I test sortableJs ? (RSpec)

paul lahana asked in Testing

I made a drag and drop to-do-list with SortableJs and i'm trying to test the drag-n-drop with RSpec/Selenium/Capybara if the request is sent onEnd.
I'm able to do the drag n drop using selenium drag_and_drop. My card is dropped in the right column but when i check if the status is persisted it looks like my PlannedAction still has it's previous status..
I tried to page.execute_script('const action_card = document.querySelector(".c-action-card"); action_card.dispatchEvent(new Event("dragend"));') to force the event to be fired and get the stimulus controller to react but still nothing..

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 62,791+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.