Automate Grid Controls with Cypress Data Tags

1 Answer 1171 Views
Grid
Justin
Top achievements
Rank 1
Justin asked on 12 Nov 2021, 05:19 PM

Hello,

We are using Cypress automation to automate UI testing. This involves adding a data-cy="FOO" to a control (grid, button, drop down, etc). We want to be able to get at the controls in a grid like a grid button, hyperlink, page size, etc. I have added tags to the individual grids and columns but this doesn't seem to get at the fine grain controls like I would expect. Does anyone have experience doing this?

1 Answer, 1 is accepted

Sort by
0
Martin Bechev
Telerik team
answered on 16 Nov 2021, 11:22 AM

Hello Justin,

We have provided an answer on this question in the private support thread opened by another account but will paste the answer here as well to be visible to the community.

In order to achieve the requirement, the developer needs to add ng-template customization for every single control through the app component template of the grids in question. Keep in mind that this will be a tedious endeavor and it's not really recommended as it may not yield the wanted result.

In general, the majority of the Kendo Angular components are heavily tested to the smallest of details with both unit tests and e2e tests on our side. Most of which can be found in the source code of the components. Please check the following article to see how the source code of a component can be obtained:

https://www.telerik.com/kendo-angular-ui/components/installation/source-code/ 

There are multiple tests for the Grid where we test the selection or clicking of smaller integrated controls there.

If a fine control of every DOM element is needed, using CSS selectors is preferable approach as this is the way we've done in Selenium. Although our tests are using Selenium, they can still be used as a reference for examples on the topic of all testing.

Regards,


Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Justin
Top achievements
Rank 1
Answers by
Martin Bechev
Telerik team
Share this question
or