Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test drag & drop functionality in AngularJS e2e testing

I am trying to test my application where I need to move a widget from one location to other, in other word I need to test drag & drop functionality in an end to end test.

How would I test this?

like image 634
Zahid Afaque Avatar asked Apr 10 '14 09:04

Zahid Afaque


People also ask

How do you drag click test?

Drag Clicking is when you drag your finger down from the top of the mouse button. This creates friction which basically accidentally tricks the mouse switch to register multiple clicks as you drag your finger down.

How do you know if your drag is clicking?

To drag click, simply flick your wrist slightly at an angle while gently pressing the mouse button in a downward direction (towards the front of the mouse). Don't press too hard, and just allow your finger to glide through the button. You'll know that you're doing it right if you start to hear a “grinding noise”.

What is drag click?

Drag clicking is a way to perform multiple clicks on a mouse without the energy or effort of clicking very fast. It only takes one motion of your finger to create a multitude of clicks, and you will not feel any pressure or stress after doing this.

How do I drag and click on my phone?

A double tap acts as a double click. A double tap and hold allows you to grab and then drag. A two-finger tap acts as a right click. A two-finger drag reproduces the mouse wheel scrolling action.


1 Answers

I had this same issue. The solution for me was to follow the advice in the Selenium issue here: https://code.google.com/p/selenium/issues/detail?id=3604#c20

Starting with the example from @nilsK, here was my solution:

var yourOffset = {x:5,y:5};
ptor().actions()
    .mouseMove(yourElement,yourOffset)
    .mouseDown()
    .mouseMove(yourElement,{x:0,y:0}) // Initial move to trigger drag start
    .mouseMove(youTarget[,targetOffset]) // [] optional
    .mouseUp()
    .perform();

I think this also solves this issue

like image 83
Brady Isom Avatar answered Sep 22 '22 04:09

Brady Isom