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

Hit and miss selecting checkbox on Kendo grid where column is set: Selectable

3 Answers 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Veteran
Matt asked on 23 Jun 2020, 07:57 PM

Hi,

we have a grid where a column is set to selectable. Recording the select event and then playing that back does not always work. The checkbox has no id or other identifying property which would make it easy for test studio to find seeing how it is on every row...

 

Any suggestions?

 

Matt

3 Answers, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 24 Jun 2020, 09:54 AM

Hi Matt,

I will do my best to help you automate the checkbox selection in your grid and execute the test reliably.

As you mentioned, the checkbox itself does not have "id" or other specific attributes that you can use to pinpoint which element you need to click. In addition to that, in most cases the parent row element "tr" does not have any specific attributes, as well.

In this case, Test Studio will use chained find expression to find the grid and then look for the correct checkbox element by its "tagindex" (see attached sample web test and screenshot). This solution will work, if there are no changes to the application's structure and the grid is not reordered or changed. 

Another option is to use a coded step to iterate through the table until you find the exact row of data that you need. Then, go to the column that holds the checkbox and click it. You can find more details and sample code in the linked article.

I hope you will find the above details and suggestions helpful for your test scenario. Please test it against the application you want to automate and do not hesitate to contact us again, if you need further assistance.

Regards,
Plamen Mitrev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Matt
Top achievements
Rank 1
Veteran
answered on 24 Jun 2020, 01:53 PM

HI Plamen,

since I am using a data bound test, iterating over many grid scenarios, the only real solution would be a coded approach. I just REALLY wish the grid would support a template on this column where I could assign an id, by row count, so that these other steps would not be needed.

 

Would seem by far the easiest approach..

 

Thanks,

 

Matt

 

0
Plamen Mitrev
Telerik team
answered on 26 Jun 2020, 10:42 AM

Hi Matt,

I understand your concerns and what difficulties the developing and maintaining of the coded approach could bring. Actually, adding an "id" or other attribute to the checkbox element is something that comes from the grid implementation. Test Studio works with the DOM tree of the application under test and with the currently available tags, attributes and content.

There are two ways to automate the grid, in my understanding. Please check the suggestions and details below.

Add custom attribute to the grid:

The Kendo grid supports custom templates for columns and you can use those instead of "selectable: true". That will allow you to configure the checkbox <input> element according to your requirements. 

In the linked example, I set my custom attribute "data-my-attr" with the value from the "name" column. You can use similar approach to set an "id" or other attribute with an unique value from another column.

After changing the grid, you will need to record the test steps against the checkbox again, or modify the element's find expression to include the new attribute. You can also have data driven find expressions to help you locate the correct element in your test.

Please discuss this with the developers of the application, if that is not you, and explore the possibilities. If you need more help with the Kendo grid's implementations, please open a new ticket for the respective product, so you can get the best help from my colleagues there.

Data driven test in code:

You can achieve data driven testing in a coded step, by accessing the data of the current iterations (see point 22 of this article). Based on that value, you can iterate the table and click on the required checkbox. Please try to apply this to your coded step and let me know if that works for your test scenario. 

I hope the above suggestions will help you automate the test scenario. I remain available to answer any follow up questions that you might have and advise you further.

Thank you for your cooperation in this discussion.

Regards,
Plamen Mitrev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Matt
Top achievements
Rank 1
Veteran
Answers by
Plamen Mitrev
Telerik team
Matt
Top achievements
Rank 1
Veteran
Share this question
or