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_
Thanks,
Mindy
32 Answers, 1 is accepted
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.
// Navigate to : 'http://demos.kendoui.com/web/grid/editing-custom.html'
ActiveBrowser.NavigateTo(
"http://demos.kendoui.com/web/grid/editing-custom.html"
);
//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
Test Studio Trainings
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?
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
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
Test Studio Trainings
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
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
Test Studio Trainings
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
Glad to hear it! Thank you for the update.
Regards,
Plamen
the Telerik team
Vote now
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
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
Vote now
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
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.
@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
Vote now
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/8/2013 12:01:41 AM' - LOG: Grid DataItems Count--- 0
------------------------------------------------------------
'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!
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
Test Studio Trainings
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.
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
Test Studio Trainings
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
Test Studio Trainings
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
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
Test Studio Trainings
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
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
Test Studio Trainings
Attached is the fiddler capture you requested.
Thanks,
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
Test Studio Trainings
Here is another try, let me know it this works.
Thanks,
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
Test Studio Trainings
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
Test Studio Trainings
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.
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
Test Studio Trainings