My company project website has a drag and drop block based on ng2-dragula. This is fundamental function but i cannot use protractor to drag and drop successfully even i tried a lot of ways. Someone has the same issue with me. As i know there is no way to proceed E2E test with dragula
https://github.com/bevacqua/angularjs-dragula/issues/86.
WebDriver Drag and Drop in application using Dragula
Protractor/Jasmine drag and drop only grabbing text not the element
https://github.com/bevacqua/dragula/issues/452
========================================================================
But because ng2-dragula is quite popular now, i think that we will have a lot of website using this library and if protractor cannot do, it must be a big issue?
import {code as dragAndDrop} from 'html-dnd';
...........
p_Login.openUrl("http://valor-software.com/ng2-dragula/");
let ele1=element(by.xpath("//example-app//div[contains(text(),'Whenever an')]"));
let ele2=element(by.xpath("//example-app//div[contains(text(),'DOM as a result')]/.."));
browser.driver.executeScript(dragAndDrop, ele1.getWebElement(), ele2.getWebElement());
Can do it!!
The workaround was detected by my co-worker inside the same dragula.js test
https://github.com/bevacqua/dragula/blob/master/test/drag.js
Exactly
Raise function was declarated on
https://github.com/bevacqua/dragula/blob/master/test/lib/events.js
We are going to send a script to execute which will dispatch custom events with the correct reference elements.
You could use something like this (typescript version):
Or in javascript version to test directly on browser:
This solution work for me, maybe should be adapted to ng2-dragula tests.
I have just made an e2e test of our Angular 5 app which uses ng2-dragula and it worked by using the default protractor method of:
I'm running protractor v5.3.2 with chromedriver v2.38 and chrome v67.0.3396.87.
Not sure who fixed what but my answer is to use the versions I have gave above and it works!