5

I'm testing my React application using Selenium IDE and want to add an unique ID ("data-testid" for example) to all elements so I'd be able to select them easily.

So far I encountered libraries which accomplish that by adding some code (react-html-id for example), but I'm looking for a solution which will add these data attribute automatically on build time.

For Example:

Given a component

<SomeComponent /> // returns <span>Hello World<span>

When building the React application, it should be resulted with:

<span data-testid="123">Hello World</span>

0 Answers0