Test Automation IDs
See original GitHub issueAs we are trying to roll out end to end testing on our frontend assets using webdriver.io and selenium we find it increasingly challenging to target elements from our underlying UI library, material-ui.
There is no easy single solution to this problem. Adding data-test
attributes to all elements would be the optimal solution, with an option to parameterize per component to avoid conflicts.
Please consider automated testing on your next iteration of your awesome library.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
ID & Automation ID - Progress Test Studio - Documentation
Static and unique id attribute for the elements in a dynamic application. It is recommended to assign such during the application development process...
Read more >Why automation attributes are a non-negotiable part of web ...
Test ids work best when they are unique, readable, and concise. It should be unique so the framework doesn't need logic to figure...
Read more >ID's Required for UI automation in selenium in all html pages
Using ids for element's lookup in automation is generally considered as a best practice. If you use ids your automation tests will become ......
Read more >5 tips for a stable element ID in Selenium automation - ACCELQ
Element Identification is a crucial step in achieving automated test interaction in Selenium against browser-based applications.
Read more >Is adding IDs to everything standard practice when using ...
It's not unusual. IDs tend to aid greatly in creating more stable UI tests, since class name changes or other refactoring is less...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Following https://material-ui.com/customization/themes/#properties you can already set attributes on a per component basis.
This is currently only missing an option for all components.
Depending on your target you could fake this with a Proxy. Checkout this codesandbox: https://codesandbox.io/s/zp0jrmkox (the interesting part is in
withRoot
)This is just something hacked together in a few minutes so use this with caution.
You can use the
theme.props.MuiButton['date-test'] = 'MuiButton'
feature of Material-UI for that.