Skip to Main Content
Cumulocity IoT Feedback Portal
Status Planning / planned
Created by Korbinian Butz
Created on Mar 7, 2022

Enable UI Testing via unique Element IDs in webSDK

For test automation, we would need "attributes" to find elements to interact with easy
and stable. Is it possible to provide a build that has these kind of attributes?

The general idea is for html elements to have an attribute `data-cy` or `data-test-id`, example:

<input
id="main"
type="text"
class="input-box"
name="name"
data-test-id="name"
/>


The idea behind this is, id and class can change, but `data-test-id` will always stay the same, so the test case can stay the same even if the button style changes due to a change in the class.

If something similar would be possible for cumulocity too, then it would mean that we can write tests once and they would always work. One thing that we have to think about and agree on, is what name for the `data-test-id` to use. Do all of them have to be unique or not and etc.


Here is nice link for best practices when using data-cy: https://www.bigbinary.com/learn-qaautomation-using-cypress/data-cy-conventions
Here is nice link with good example when using data-cy: https://medium.com/agilix/angular-and-cypress-data-cy-attributes-d698c01df062
Only comment I have about this link is to not have data-cy attribute twice...
This: <button data-cy="first" (click)="first()" data-cy="first">First button</button>

  • Attach files
  • Levon Keleman
    Reply
    |
    Dec 14, 2022

    @Oana:

    this one should never expire: data_cy_elements.txt

  • Levon Keleman
    Reply
    |
    Dec 14, 2022
  • oana velicu
    Reply
    |
    Dec 14, 2022

    @Levon: Please provide again the document, the link for accessing it expired.

  • Levon Keleman
    Reply
    |
    Jul 25, 2022

    Hello, I've attached a document which specifies which elements we would like to have an attribute on: data_cy_elements.txt

    Please let me know if this is sufficient.

  • Admin
    Nikolaus Neuerburg
    Reply
    |
    May 31, 2022

    We do plan to add unique identifiers to many UI elements with future releases (10.14 and onwards). If there are specific UI elements for which you need a unique identifier, please send us a list with the description of the element (which app / view / element) to make sure that we consider them.