Dynamic prefix to provided ID's #7569
Unanswered
AliceBryer
asked this question in
Q&A
Replies: 1 comment
-
We recommend using test IDs: https://react-spectrum.adobe.com/react-spectrum/testing.html#test-ids You could also wrap your tests in an SSRProvider to get consistent IDs: https://react-spectrum.adobe.com/react-aria/ssr.html#automatic-id-generation |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey!
I'm fairly new to React Aria (and coding in general) so forgive my naivety here...
In the company I work for, we are using react-aria for components such as the tabs.
In our testing, our preferred method to access the element is via an ID, but with components such as the tabs, a dynamic generated prefix is created - (Our Id provided here is 0)
Is there any way that the prefix's can be removed when the node environment is test? So that we would just be left with
id="0"
or whatever we provideFor context we are using React 18 and cypress for testing.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions