Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop is not working #140

Open
Poojitha-Chandra opened this issue Aug 3, 2023 · 7 comments
Open

Drag and drop is not working #140

Poojitha-Chandra opened this issue Aug 3, 2023 · 7 comments

Comments

@Poojitha-Chandra
Copy link

I am using this plugin for a while and from mid July it stopped working, so I have got some cypress drag and drop example from web and tried to check whether it is an issue with my client network.

The example used for which assertion error occurs as drag-drop plugin not working:

it('Using the cypress-drag-drop plugin on a HTML site', function () {

        cy.visit('https://the-internet.herokuapp.com/drag_and_drop')

        //Before Drag and Drop column-a has 'A' and 'column-b' has 'B'
        cy.get('#column-a')
            .should('have.text', 'A')
        cy.get('#column-b')
            .should('have.text', 'B')

        //Drag and drop using cypress-drag-drop plugin
        cy.get('#column-a').drag('#column-b')

        //After Drag and Drop column-a has 'B' and 'column-b' has 'A'
        cy.get('#column-a')
            .should('have.text', 'B')
        cy.get('#column-b')
            .should('have.text', 'A')
 })

The alternative code without using drag and drop plugin is working fine. The code for the same:

it('Not using the cypress-drag-drop plugin on a HTML site', function () {

        cy.visit('https://the-internet.herokuapp.com/drag_and_drop')

        const dataTransfer = new DataTransfer();

        //Before Drag and Drop column-a has 'A' and 'column-b' has 'B'
        cy.get('#column-a')
            .should('have.text', 'A')
        cy.get('#column-b')
            .should('have.text', 'B')

        //Not using cypress-drag-drop plugin
        cy.get('#column-a').trigger('dragstart', { dataTransfer });
        cy.get('#column-b').trigger('drop', { dataTransfer });

        //After Drag and Drop column-a has 'B' and 'column-b' has 'A'
        cy.get('#column-a')
            .should('have.text', 'B')
        cy.get('#column-b')
            .should('have.text', 'A')
 })

Cypress version used in my machine is 12.15.0

@bierik Any help is highly appreciated as the alternative way without using plugin is not working for my test URLs

@davidlinhares
Copy link

Seeing the same behavior since mid July as well.

Cypress version 12.17.1.

@gripzyyy
Copy link

Problems still!

@jeme95
Copy link

jeme95 commented Oct 28, 2023

@Poojitha-Chandra
I had the same problem and your code worked for me, thank you very much

@jmescode-te
Copy link

@Poojitha-Chandra thanks so much! all I did was change some styles in my drag/drop interface but I couldn't get the drag tests that usually worked, to work. Your comment however, got all my tests working again :)

@mohamadnoor991
Copy link

@Poojitha-Chandra, I have the same problem, and I opened an issue for that; actually, it will work with you, but you should hover the mouse on the place where you want to drop the element.

the code that you added, worked with me when I tried to drop an image from my PC to the application, but when I tried it with an element from the application to drop from list to place inside the app, it did not work. do you have any idea what can be the problem??

@pv-das
Copy link

pv-das commented Jul 2, 2024

@Poojitha-Chandra, I am still facing the issue

@chandhiny
Copy link

i tried different ways to simulate the drag and drop, it is not working and the UI is built with react dnd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants