Drag & Drop Step Releases Too Soon

9 posts, 2 answers
  1. Alan
    Alan avatar
    15 posts
    Member since:
    Aug 2014

    Posted 05 May 2015 Link to this post

    I have recorded a drag & drop step in my test that drags a row from a RadGrid to a specific element on the page. After dragging the row to the element, a popup window is supposed to open that I will close, then the information from the row is displayed attached to the element. When I run the recorded drag & drop step, the popup window never opens. It does appear the row is getting dragged to the correct location. I was able to get the popup window to open if I set the Pause property of this step to After, then run the step. The row gets dragged to the element, the test pauses, and the popup window opens like it should, but then test execution stops while I manually answer the Test Studio pause window before the test continues. Based on this behavior, it seems like my application wants the dragged row to hover over the element for a certain amount of time before it's released (with a LeftMouseUp action) and Test Studio is releasing it immediately after dragging the row to the center of the element.

    I looked at the code for the drag & drop step to see if I could drag the row over to the element and hold it there for a moment before releasing it, but that does not appear to be an option. In the code for the drag and drop step, can I replace the DragTo statement with the code to control the mouse so I can insert a wait before the LeftMouseUp action?

    I am using Test Studio Product Version 2014.4.1211.0

     Here's the code for my drag & drop step:

            [CodedStep(@"Desktop command: Drag & Drop ContentPlaceHolder1EquipmentUnInstalledListGrdEquipments0TableRow to x19Span")]
            public void _06_Add_BTI_eq_to_Site_A_CodedStep()
            {
                // Desktop command: Drag & Drop ContentPlaceHolder1EquipmentUnInstalledListGrdEquipments0TableRow to x19Span
                      Pages.OrderManagementSystem.ContentPlaceHolder1EquipmentUnInstalledListGrdEquipments0TableRow.Wait.ForExists(30000);
                ActiveBrowser.ResizeContent(1280, 107, 1600, 792);
                ActiveBrowser.ScrollBy(0, 0);
                Pages.OrderManagementSystem.x19Span.Wait.ForExists(30000);
                Pages.OrderManagementSystem.ContentPlaceHolder1EquipmentUnInstalledListGrdEquipments0TableRow.DragTo(ArtOfTest.Common.OffsetReference.TopLeftCorner, 268, 28, true, Pages.OrderManagementSystem.x19Span, ArtOfTest.Common.OffsetReference.AbsoluteCenter, 0, 0, true);
            }

  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 08 May 2015 Link to this post

    Hello Alan,

    Try to leave only the following line of code:

    Pages.OrderManagementSystem.ContentPlaceHolder1EquipmentUnInstalledListGrdEquipments0TableRow.DragTo(ArtOfTest.Common.OffsetReference.TopLeftCorner, 268, 28, true, Pages.OrderManagementSystem.x19Span, ArtOfTest.Common.OffsetReference.AbsoluteCenter, 0, 0, true);


    And see how this will work.

    If this workaround does not help you will have to update to latest version of Test Studio and see if this behavior is still reproducible.

    I've ran multiple drag and drops on my end without being able to experience the behavior described, but having in mind I am using latest version this is expected.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Alan
    Alan avatar
    15 posts
    Member since:
    Aug 2014

    Posted 24 Jul 2015 in reply to Ivaylo Link to this post

    I have finally gotten some time to look at this issue again. Here are more details about what my application does when I manually drag the table row, which works just fine when done manually.
      - I position my cursor over the center of a RadGrid table row and hold down the left mouse button.
      - As soon as I start to move the cursor, while holding down the mouse button, a copy of the selected row positions itself under the cursor so the cursor is over the upper, left corner of the row copy.
      - I drag the copy of the row element over to the destination element where I want to drop it. I need to drag the row over so the cursor hovers over the destination element.
      - The destination element changes color when the cursor hovers over the element.
      - When I see the color change, I release the left mouse button (left click up) and the row I dragged over then gets dropped on the destination element.
        
    When I use the UI to perform this drag and drop, it appears (just from watching the application while the test is running) the UI is dragging the row over and releasing it before the hover occurs, so the drag and drop never completes successfully. Is there a way to get the UI to hover over the destination element before dropping the grid row?

    If I have to do this in code, can you show me an example of what the code should look like?
  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 29 Jul 2015 Link to this post

    Hello Alan,

    In order to continue investigating we may need access to your application. Would you think this could be possible? If yes, please provide details and repro steps so we can continue working. Please note that you may need to submit a ticket instead if you are going to provide sensitive data.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  5. Alan
    Alan avatar
    15 posts
    Member since:
    Aug 2014

    Posted 16 Nov 2015 in reply to Ivaylo Link to this post

    I downloaded the latest version, Ver. 2015.3.1015.0, and ran the previously recorded drag and drop step and it failed the same way. The element was dragged to the target element, but was released before "sticking" to the target element. The dragged element went back to the original location on the page and never landed on the target. I went to re-record the step and found the Drag and Drop action is no longer on the list of Mouse actions. So here are my questions:

       1. What are the steps to record a drag and drop step with the new release?

       2. If I have to perform this step in code, can you provide some example code that I can use in my test?

    Thanks.

    Alan

  6. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 19 Nov 2015 Link to this post

    Hi Alan,

    Here is an article which describes how to record a Drag&Drop step.

    And you can check this one for the coded solution.

    Let me know if that helps.

    Regards,
    Boyan Boev
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  7. Alan
    Alan avatar
    15 posts
    Member since:
    Aug 2014

    Posted 19 Nov 2015 in reply to Boyan Boev Link to this post

    Boyan,

    In the documentation for recording a drag and drop step, the directions state to select the DragDrop Mouse Action (Step 4). As I mentioned in my previous post, the DragDrop action is no longer on the list of Mouse Actions, so I was not able to use that procedure to record a drag and drop step in my test. See the attached screenshot. I was able to work around this issue by manually recording the drag and drop and then updating the properties of that step with the correct originating and target element information. That solved the problem of recording the drag and drop step, but it didn't solve my original issue. When I replay the drag and drop step, the originating element gets dragged to the target element, but instead of landing on and staying on the target element, once the originating element is released by the mouse, it goes back to it's original location.

    Using the DragTo method gives me the same result, the element is dragged to the target and then released and goes back to the original location.

    I was hoping the new release would fix this issue, but apparently not. Can I use the Click method of the Mouse class to manually step through the drag and drop operation, e.g., left click down the originating element, move the element to the target, wait, then left click up? When I tried using the Mouse class in my code, I got an error ((CS0143) The type 'ArtOfTest.WebAii.Win32.Mouse' has no constructors defined). It's possible (probable, more likely) that I didn't code these steps properly, so it would help me a lot if you could give me a working example of code that uses the Mouse class to perform a drag and drop operation.

  8. Alan
    Alan avatar
    15 posts
    Member since:
    Aug 2014

    Posted 20 Nov 2015 Link to this post

    I have found the example code in the documentation and now my drag and drop operation works the way I want it to. The example code is on this page of the documentation:

    http://docs.telerik.com/teststudio/testing-framework/automate-browser-actions

     

  9. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 24 Nov 2015 Link to this post

    Hello Alan,

    I am happy to hear that.

    If you need additional assistance please let us know!

    Regards,
    Boyan Boev
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top