'How do I find out the aria role of MUI components for RTL querying?

I've just started migrating from enzyme to react testing library on my project that uses material-ui. From what I understand, RTL queries the dom and the recommended query methods is by aria role. How do I query something like MUI's Typography, Box, or API components like Dialog? Can anyone point me to how I can get the aria roles or how to query Mui components?



Solution 1:[1]

I also faced the same issue a few months back. I've started searching for that element in DOM and then checking for some property like test_id or role or label in DOM. Else you check check github of Material UI they must have pushed test cases as well for reference.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akshay Kumar