Open devtobi opened 3 months ago
With Vue 3.5 and the new useId
functionality this feature might solve this issue by providing incremental deterministic ids. See https://blog.vuejs.org/posts/vue-3-5#useid for information.
Keep in mind we should combine this with a custom prefix which can be define via the configuration on the App instance (see https://github.com/vuejs/core/pull/11404 for further info).
This should be done for both normal applications as well as webcomponents. For webcomponents see https://blog.vuejs.org/posts/vue-3-5#custom-elements-improvements
A first test was very positive, however we should only use this feature if we don't have the requirements for individual object names, as the useId
helper only generates static numbers.
Additional note: Keep in mind generated IDs are only deterministic throughout the current page. If routed to a new page, IDs are generated freshly (and counting does not go up but start again at 0)
Is your feature request related to a problem? Please describe. For better testability (regarding E2E tests) we need a fixed property on interactive elements.
Describe the solution you'd like
data-cy
attribute on elements needed for testing. To enforce setting the attribute https://github.com/davidcalhoun/eslint-plugin-test-selectors might be suitable.Describe alternatives you've considered
Additional context