This is a migrated thread and some comments may be shown as answers.

Making a more reliable Drag\Drop

5 Answers 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 06 Apr 2017, 07:34 PM

I'm REALLY struggling with the recorded drag\drop :/  It's easily my least reliable test and I hate that I have to maximize the browser as a step to get it to work even slightly.

Is there no way to like get the position of the box, then get the height of the first item to then calculate the drag height or something?

 

http://demos.telerik.com/kendo-ui/sortable/index

 

This is the generated drag code...

[CodedStep(@"Drag First item to second place")]
public void CpsPlacementsRanking_DragItem()
{
    // Drag First item to second place
    Pages.ClinicalPlacements.RankableLocationFirstItem.Wait.ForExists(30000);
    ActiveBrowser.ResizeContent(2577, 25, 2093, 1297);
    ActiveBrowser.ScrollBy(0, 0);
    Pages.ClinicalPlacements.RankableLocationFirstItem.DragToWindowLocation(ArtOfTest.Common.OffsetReference.TopLeftCorner, 333, 19, true, ArtOfTest.Common.OffsetReference.TopLeftCorner, 1127, 300, true);
     
}

5 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 11 Apr 2017, 10:23 AM
Hello Steve,

Thank you for the detailed description. 

Please find further details how to add a verification image step and what adjustments you could manuallt apply to it. I hope this will be helpful to you to build the appropriate step as per your requirements. 

Please let me know if additional assistance is required. Thanks! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 25 Apr 2017, 04:25 PM

Hi, apologies for getting back so late...

I don't need image verification, I need to be able to properly (reliably) pull off a drag\drop is the problem.  I need to be able to calculate the elements such that it'll work every time instead of having to re-wrestle with the thing every few months when something changes.  It's also really annoying for the test to have to go fullscreen.

Thoughts?

0
Nikolay Petrov
Telerik team
answered on 28 Apr 2017, 12:05 PM
Hello Steve,

There is an article that explains all available methods related to DragTo() method available in Telerik Testing Framework. I hope that you could find there the one that will make your tests more stable.

There is .ScrollToVisible() method on an element that might obsolete the maximization of the window.

Please provide more specific case details in order be able to provide further assistance.

Regards,
Nikolay Petrov
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 28 Apr 2017, 12:45 PM

The problem isn't the dragdrop otself, the problem is it uses measurements.  I'm looking for some way to do those measurements in code so it doesn't matter where the window is or if the drag items change padding.

 

I can do all the math, just looking for the api i guess to try?

0
Elena
Telerik team
answered on 03 May 2017, 10:38 AM
Hello Steve,

Thanks for getting back to us. 

Please find attached a test that logs to the execution log the coordinates and size of a html element. This is the "Try it" button on the page. Please note that you have to add reference to System.Drawings.dll in your project to be able to use the provided code. 

I hope this will be useful to you. 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Elena
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Nikolay Petrov
Telerik team
Share this question
or