Having a problem with Kendo Grid Testing

33 posts, 0 answers
  1. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 28 Aug 2012 Link to this post

    Hi,

    I have 2 questions about Kendo Grid, please.

    1) Developers are using Kendo mvc and regular Kendo java scripts libraries.  Do I need to add any reference to those in my project, if I want to code to get the grid object, row, cells, textcontent, ect..?

    2)  I'm having a problem testing a grid.  I didn't have a problem testing other similar grids; and I noticed the only different with this grid is the grid data source is using AJAX.  Is there a special way to handle it?

    An example of a simple test:   

    1 line of code --> KendoGrid: "Data' item count 'Equals' '4'.      (I used the tool to verify without manipulating the code).

    Ran the script and was expecting it to pass, but it failed.  The log 

    Exception thrown executing coded step: '[Sort_Pesonnel_and_Metrics_CodedStep1] : KendoGrid: 'Data' item count 'Equals' '4'.'.InnerException:ArtOfTest.Common.Exceptions.AssertException: Number match failed (CompareType:Equals) - [Expected:4],[Actual:1] at ArtOfTest.WebAii.Controls.BaseControlAssert`1.Assert(Boolean condition, String message, String expected, String actual, Boolean throwAssert) at ArtOfTest.WebAii.Controls.BaseControlAssert`1.AssertNumber(Int32 leftPortion, Int32 rightPortion, NumberCompareType compareType, Boolean throwOnFailure) at Telerik.TestingFramework.Controls.KendoUI.KendoControlAssert.NumberValue(String controlPropertyName, Int32 expected, NumberCompareType compareType) at Titan.WebTests.Sort_Pesonnel_and_Metrics.Sort_Pesonnel_and_Metrics_CodedStep1() in c:\Users\mpham\Desktop\Telerik\Titan.WebTests\Personnel\Sort Pesonnel and Metrics.tstest.cs:line 120

    Thanks,
    Mindy












  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 31 Aug 2012 Link to this post

    Hi Mindy,

    1. You don't need to reference any libraries that your developers are using. The only reference you need is to the Telerik.TestingFramework.Controls.KendoUI.dll(which you should have in your test project by default).

    Here's a sample code created against this Kendo Grid demo site. The code demonstrates how to find and delete a row in Kendo Grid.  
      
    //Get the grid object
    KendoGrid grid = ActiveBrowser.Find.ById<KendoGrid>("grid");
      
      
    //Search for a row that contains "Chang" in its first cell
    foreach (KendoGridDataItem row in grid.DataItems)
    {
        if (row.Cells[0].TextContent == "Chang")
        {
            //Create a Confirm dialog
            ConfirmDialog cd = new ConfirmDialog(ActiveBrowser, DialogButton.OK);
            Manager.DialogMonitor.AddDialog(cd);
            Manager.DialogMonitor.Start();
      
            //Click on the last cell to delete the row
            row.Cells[3].MouseClick();
      
            //Handle the Confirm dialog
            cd.WaitUntilHandled();
            Manager.DialogMonitor.RemoveDialog(cd);
        }
    }

    2. I wasn't able to reproduce the problem as you described it. See this video. Can you please provide the means to reproduce the issue locally(either in your app or on a public site), so we can continue troubleshooting? You can try to reproduce it against our Kendo Grid demos, for example.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 04 Sep 2012 Link to this post

    Yes, I also used that code to try and get a row count and i only get 1 row instead of 4.

    I went back and added a delay like 3 mins before the extraction line and it passed.  Where in the code should i put the delay?  After getting the grid object?

  4. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 04 Sep 2012 Link to this post

    Please ignore my last question, I got it working now after adding a 5 seconds delay.

    My next question is, how do you get the text if the column is listing hyperlink?  I was able to use "row.Cells[0].TextContent" for other columns but one.  And that column is listing the hyperlink for each row, so User can click it to go to that page.

    What I am trying to do is test out sorting of each column.

    Thanks,
    Mindy
  5. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 05 Sep 2012 Link to this post

    Hello Mindy,

    You should be able to get the hyperlink text using the InnerText property. Please try it like this: "row.Cells[0].InnerText" and let me know if that works.


    Kind regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  6. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 05 Sep 2012 Link to this post

    Yes, that works.  Thanks!

    Another question :)

    I recorded the 2 clicks on the column, so that the order is in descending.  Then next step is my coded step, please see the code attachment file.

    When I ran it, it passed when I was expecting it to fail.  And the Logwrite showed ascending instead of descending.  Do you know what I'm doing wrong?

    Thanks,
    Mindy

  7. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 11 Sep 2012 Link to this post

    Hello Mindy,

    I apologize for the delay in getting back to you on this.

    I have tested your code against this Kendo UI Grid demo and as you can see in this video it works as expected. Maybe in your case, the DOM tree is not getting refreshed after the second click and Test Studio acts against the cached copy of the DOM(the items are still in ascending order). Try using the following line at the beginning of your coded step:
    ActiveBrowser.RefreshDomTree();

    This will force Test Studio to refresh the DOM tree before getting the grid items and performing the verification.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  8. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 11 Sep 2012 Link to this post

    Hi Plamen,

    That code didn't work for me.  But I found a way for it to work.  I needed a delay between the 2 clicks to sort the column. 

    Thanks,
    Mindy
  9. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 11 Sep 2012 Link to this post

    Hi Mindy,

    Glad to hear it! Thank you for the update.

    Regards,
    Plamen
    the Telerik team
    Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
    Vote now
  10. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 12 Oct 2012 Link to this post

    Hi Plamen,

    I have another question about kendo grid please.

    I have 2 different grids, both using AJAX:
    Grid1 worked when I do this: KendoGrid grid = ActiveBrowser.Find.ById<KendoGrid>("grid1"); I put a message box to do a grid count and it gave me the correct count.
    Grid2 doesn't.  It found the grid correctly but not the grid count.  It returned "0" instead of the correctly number.

    I asked a Developer to see that is different with the two grids and found out that Grid2 has the virtual scrolling turned on and Grid1 doesn't. 

    Do you know if that is the problem?  If so, could you tell me what I should do to get into the grid to test sorting?

    Thanks,
    Mindy

  11. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 17 Oct 2012 Link to this post

    Hello Mindy,

    The problem is probably that Grid2 contains more items than Grid1 and takes more time to load these items in the DOM tree. A simple refresh of the grid should resolve the problem you are experiencing. 
    KendoGrid grid = ActiveBrowser.Find.ById<KendoGrid>("grid1");
    grid.Refresh();
    Log.WriteLine(grid.DataItems.Count.ToString());

    Kind regards,
    Plamen
    the Telerik team
    Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
    Vote now
  12. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 17 Oct 2012 Link to this post

    Hi Plamen,

    I tried the that and I got a error when I ran it.  Line 79 is "grid.Refresh();"
    Failure Information: 
    ~~~~~~~~~~~~~~~
    Exception thrown executing coded step: '[Testing_CodedStep] : New Coded Step'.
    InnerException:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Titan.WebTests.Testing.Testing_CodedStep() in c:\Users\mpham\Desktop\Telerik\Titan.QA\Titan.WebTests\Nomination\Testing.tstest.cs:line 79
  13. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 17 Oct 2012 Link to this post

    Sorry... I was using the wrong grid name.  I ran that with grid.refresh and it still returned "0".  
  14. Ignacio
    Ignacio avatar
    2 posts
    Member since:
    Aug 2012

    Posted 18 Oct 2012 Link to this post

    http://www.telerik.com/automated-testing-tools/community/forums/test-studio/general-discussions/having-a-problem-with-kendo-grid-testing.aspx#2256515


    Hi... What if I have a grid with multiple pages?
    I want to locate an element in page 2. When I change the page, it keeps getting the same elements as page 1.

    Thanks in advance,
    Ignacio.
  15. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 23 Oct 2012 Link to this post

    Hi,

    @Mindy
    Can you please provide the means to reproduce the issue locally(either in your app or on a public site), so we can continue troubleshooting? You can try against our Kendo UI Grid demos for example. If you feel any of this information is sensitive, you can submit a support ticket which is confidential, unlike this forum. Thank you for providing the information we need to best assist you.
     
    @Ignacio
    Thank you for reporting the issue, I was able to reproduce it and logged it as a bug. You can track its progress here: Public URL.

    In the meantime, to workaround the issue, you need to get the Grid object every time you navigate to a different grid page. See this video for more information.

    Regards,
    Plamen
    the Telerik team
    Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
    Vote now
  16. tvsnvs
    tvsnvs avatar
    4 posts
    Member since:
    Jan 2013

    Posted 08 Jan 2013 Link to this post

    I'm trying to test Kendo Grid and retrieve the rows from the grid, the grid.DataItems always returning 0.

    I'm using the grid from your demo website. Below is my code.

     [CodedStep(@"New Coded Step")]
            public void WebTest_CodedStep1()
            {
                ActiveBrowser.NavigateTo("http://demos.kendoui.com/web/grid/index.html");
                //Get the Calendar object
                KendoGrid grid = ActiveBrowser.Find.ById<KendoGrid>("grid");
                Log.WriteLine("Grid DataItems Count--- "+grid.DataItems.Count);
            }

    Can you please let me know whats wrong in my code. I'm using Test Studio.

    Please find the Test Log Result below

    Overall Result: Pass
    ------------------------------------------------------------
    '1/8/2013 12:01:31 AM' - Using .Net Runtime version: '4.0.30319.296' for tests execution.
    '1/8/2013 12:01:31 AM' - Starting execution....
    '1/8/2013 12:01:36 AM' - Detected custom code in test. Locating test assembly: Learning_Test_Studio.dll.
    '1/8/2013 12:01:36 AM' - Assembly Found: C:\Users\skandan\Documents\Test Studio Projects\Learning_Test_Studio\bin\Learning_Test_Studio.dll
    '1/8/2013 12:01:36 AM' - Loading code class: 'Learning_Test_Studio.WebTest'.
    ------------------------------------------------------------
    ------------------------------------------------------------
    '1/8/2013 12:01:36 AM' - Using 'InternetExplorer' version '8.0' as default browser.
    1. '1/8/2013 12:01:41 AM' - LOG: Grid DataItems Count--- 0
    '1/8/2013 12:01:41 AM' - 'Pass' : 1. [WebTest_CodedStep] : Navigate to : 'http://demos.kendoui.com/web/grid/index.html'
    ------------------------------------------------------------
    '1/8/2013 12:01:41 AM' - Overall Result: Pass
    '1/8/2013 12:01:41 AM' - Duration: [0 min: 4 sec: 694 msec]
    ------------------------------------------------------------
    '1/8/2013 12:01:42 AM' - Test completed!
  17. tvsnvs
    tvsnvs avatar
    4 posts
    Member since:
    Jan 2013

    Posted 08 Jan 2013 Link to this post

    Please find the attached screenshot where the Test Studio is showing the data Item count is 0. I'm not sure whats wrong with it. Please help me in this.
  18. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 10 Jan 2013 Link to this post

    Hello,

    I have to admit this is a known problem with the Kendo Grid compatibility. I just checked and can confirm the problem is already resolved.

    We had to update the Grid Translators in Test Studio due to a recent change in the Grid. The change didn't make it into the official release 2012.2.1204 though but will go live with the next internal build. We should be ready to publish it next week.

    Please let me know if that works for you or you need solution earlier.

    Greetings,
    Konstantin Petkov
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  19. tvsnvs
    tvsnvs avatar
    4 posts
    Member since:
    Jan 2013

    Posted 10 Jan 2013 Link to this post

    Thanks for the reply and please update me when the next release is available.

    I've one more issue, I'm not sure how to do the pagination testing, sorting on Kendo Grid UI. Please help me in this.

    waiting for the next release.

  20. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 15 Jan 2013 Link to this post

    Hello,

    Sure, we'll let you know when the new internal build is ready and available for download. As for your last question "how to do the pagination testing, sorting on Kendo Grid UI?", can you please provide more detailed information on what exactly is the automation scenario you are trying to create? Once I know that, I'll try to provide you with a sample test against our Kendo UI demos covering that scenario. Thanks for providing the info we need to best assist you.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  21. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 22 Jan 2013 Link to this post

    Hi,

    Just to let you know that our new internal build version 2012.2.1317 is now live on the website. It contains the latest changes in our Kendo UI translators. You can download it from your Telerik account here: Public URL .

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  22. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 29 Jan 2013 Link to this post

    Hello,

    With this new version, I having a hard time extracting the grid data item count using the tool (not coding).  I hovered all over the grid area in an attempt to get it working and I can't seem to get it to work at all.  I don't remember having such difficult time with this in previous version.

    Any one else having the same problem?  Please show me your trick.

    Thanks,
    Mindy
  23. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 01 Feb 2013 Link to this post

    Hi Mindy,

    I have tried to reproduce the problem you are experiencing with the new version of Test Studio against this Kendo UI Grid demo, but as you can see in this video everything works as expected. I was able to extract the grid items count without coded step.

    If you're trying to extract the items count using the same approach and you're not able to do so, please provide the means to reproduce the issue locally(either in your app or on a public site), so we can try to determine what is causing the problem.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  24. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 04 Feb 2013 Link to this post

    Hi Plamen,
    I don't have the same problem when I used your demo site to exact, but I still have the same problem on my site.  I don't have a public site that I can point you to verify.

    But I noticed something different.  On your test site, I noticed there are 4 nubs (the circle, the KendoGridDataCell, KendoGridDataItem, KendoGrid).  So when you select the KendoGrid nub, you were able to exact the count correctly.

    But on my grid, I only have 2 (the circle and the KendoGrid).  When I select the KendoGrid nub, it said "0" when I tried to exact.  I tried different ways by moving on different part of the grid and still unable to get the correct number.

    Is that why?  

    But before this version, I saw those 4 nubs before when I was extracting dataitem count.  What changed?  Did our Developer changed the code for this grid? 

    Mindy
  25. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 05 Feb 2013 Link to this post

    Hello Mindy,

    Since direct access to your app is not possible, please take a Fiddler trace using FiddlerCap and send it to us in a zip file, so we can reproduce the problem locally and find a workable solution for you.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  26. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 06 Feb 2013 Link to this post

    Hello Plamen,

    Attached is the fiddler capture you requested.

    Thanks,
    Mindy
  27. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 08 Feb 2013 Link to this post

    Hi Mindy,

    Unfortunately there is no Fiddler trace in your attachment. I can only see txt and xml files in it. The captured Fiddler trace should be a single .saz file. When you press the "Save Capture" button in FiddlerCap you can chose where to save that file(see this video). Then you can place it in a zip file and attach it here. 

    Hope to hear from you soon.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  28. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 08 Feb 2013 Link to this post

    That's strange.  It was a .saz file saved and I zipped it up.  

    Here is another try, let me know it this works.

    Thanks,
    Mindy
  29. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 11 Feb 2013 Link to this post

    Hi Mindy,

    Unfortunately it still doesn't work. Please see this video. As you can see in the video I also zipped up a sample .saz file to demonstrate how it works on my side. If you unzip the attachment you sent in your previous reply do you see it as a single file? Please try to send me the trace again, but this time before you send the ticket please open the .zip file and make sure that it contains only the .saz file. 

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  30. Mindy
    Mindy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 11 Feb 2013 Link to this post

    Here it is again... Thanks!
Back to Top