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

Having a problem with Kendo Grid Testing

32 Answers 466 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mindy
Top achievements
Rank 1
Mindy asked on 28 Aug 2012, 03:59 PM
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












32 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 31 Aug 2012, 03:14 PM
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
0
Mindy
Top achievements
Rank 1
answered on 04 Sep 2012, 01:29 PM
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?

0
Mindy
Top achievements
Rank 1
answered on 04 Sep 2012, 03:43 PM
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
0
Plamen
Telerik team
answered on 05 Sep 2012, 11:17 AM
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
0
Mindy
Top achievements
Rank 1
answered on 05 Sep 2012, 02:35 PM
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

0
Plamen
Telerik team
answered on 11 Sep 2012, 10:17 AM
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
0
Mindy
Top achievements
Rank 1
answered on 11 Sep 2012, 02:33 PM
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
0
Plamen
Telerik team
answered on 11 Sep 2012, 02:54 PM
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
0
Mindy
Top achievements
Rank 1
answered on 12 Oct 2012, 01:23 PM

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

0
Plamen
Telerik team
answered on 17 Oct 2012, 10:23 AM
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
0
Mindy
Top achievements
Rank 1
answered on 17 Oct 2012, 12:13 PM
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
0
Mindy
Top achievements
Rank 1
answered on 17 Oct 2012, 12:26 PM
Sorry... I was using the wrong grid name.  I ran that with grid.refresh and it still returned "0".  
0
Ignacio
Top achievements
Rank 1
answered on 18 Oct 2012, 03:49 PM
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.
0
Plamen
Telerik team
answered on 23 Oct 2012, 08:35 AM
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
0
tvsnvs
Top achievements
Rank 1
answered on 08 Jan 2013, 06:03 AM
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!
0
tvsnvs
Top achievements
Rank 1
answered on 08 Jan 2013, 03:46 PM
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.
0
Konstantin Petkov
Telerik team
answered on 10 Jan 2013, 08:55 AM
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
0
tvsnvs
Top achievements
Rank 1
answered on 10 Jan 2013, 03:47 PM
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.

0
Plamen
Telerik team
answered on 15 Jan 2013, 03:56 PM
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
0
Plamen
Telerik team
answered on 22 Jan 2013, 01:54 PM
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
0
Mindy
Top achievements
Rank 1
answered on 29 Jan 2013, 04:19 PM
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
0
Plamen
Telerik team
answered on 01 Feb 2013, 05:13 PM
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
0
Mindy
Top achievements
Rank 1
answered on 04 Feb 2013, 02:19 PM
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
0
Plamen
Telerik team
answered on 05 Feb 2013, 04:06 PM
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
0
Mindy
Top achievements
Rank 1
answered on 06 Feb 2013, 05:11 PM
Hello Plamen,

Attached is the fiddler capture you requested.

Thanks,
Mindy
0
Plamen
Telerik team
answered on 08 Feb 2013, 03:52 PM
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
0
Mindy
Top achievements
Rank 1
answered on 08 Feb 2013, 04:10 PM
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
0
Plamen
Telerik team
answered on 11 Feb 2013, 03:29 PM
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
0
Mindy
Top achievements
Rank 1
answered on 11 Feb 2013, 04:02 PM
Here it is again... Thanks!
0
Plamen
Telerik team
answered on 11 Feb 2013, 05:52 PM
Hello Mindy,

Thanks for providing the Fiddler trace. Using it I was able to 'simulate' the main page(after the login page), however looking the screenshots, from that point of your app I need to click on the Notification tab to reach the Kendo Grid. Unfortunately the Fiddler trace is probably incomplete or corrupted because as you can see in this video I wasn't able to do.

It seems that we have only the following two options left in order to reproduce the issue:

1. Open a new support ticket, which is completely confidential unlike this forum thread and provide credentials and direct access to your application.
2. We can setup a GoToMeeting in order to look at the issue directly on your machine and try to record a proper Fiddler trace. If you agree with this course of action, please let me know your timezone and your availability and I'll setup the meeting.

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Mindy
Top achievements
Rank 1
answered on 11 Feb 2013, 05:57 PM
Hi Plamen,

We could setup a GoToMeeting.  I'm available from 8AM- 4PM EST.

Thanks,
Mindy

Edit:  I wanted to add another one, maybe this will work for you.
0
Byron
Telerik team
answered on 11 Feb 2013, 08:52 PM
Hi Mindy,

1.  Please join my meeting, Tuesday, February 12, 2013 at 3:00 PM Eastern Standard Time.
https://www2.gotomeeting.com/join/662998386

2.  Use your microphone and speakers (VoIP) - a headset is recommended.  Or, call in using your telephone.

Dial +1 (630) 869-1015
Access Code: 662-998-386
Audio PIN: Shown after joining the meeting

Meeting ID: 662-998-386

Greetings,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Mindy
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Mindy
Top achievements
Rank 1
Ignacio
Top achievements
Rank 1
tvsnvs
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Byron
Telerik team
Share this question
or