Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data-testid attributes to internal elements to facilitate testing #189

Open
franckdervaux opened this issue Feb 1, 2024 · 0 comments

Comments

@franckdervaux
Copy link
Contributor

What problem does this feature solve?

When one writes tests for a UI using the components, it sometimes requires to access the 'internals' of the component.
An example is the DatePicker. You need to search into the shadowroot for an 'input' element to simulate the user clicking the picker.
Or you need to search using the '.next' css class to get to the button to navigate to the next month.
This makes the tests fragile wrt to changes in the component.

What does the proposed API look like?

I would suggest to add 'data-testid' attributes to internal elements that could be necessary for testing. These attributes should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants