You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am interested to know how I can request a change of these excerpts from the Testing guides, and whom I can reach for the following concerns. Kindly guide.
While you can use CSS classes as selectors, a best practice for testing is to <strong>separate the concerns between styling and testing</strong>. Class names and DOM structure change over time—for the better—by you, your team, and addon developers. If you rely on CSS classes, your tests will break and need a significant rewrite.
Class names and DOM structure change over time—for the better—by you, your team, and addon developers. If you rely on CSS classes, your tests will break and need a significant rewrite
concern
When DOM changes are unavoidable, it is natural that the data-test selectors will also need to be moved, and refactored. How does using data-test selectors provide any perceivable/measurable value?
[Ember Test Selectors](https://github.com/simplabs/ember-test-selectors) is an addon that helps you **write tests that are more resilient to DOM changes**. You use `data-test-*` attributes to mark the elements that will be used in your tests. The addon works with QUnit DOM and helpers from [@ember/test-helpers](https://github.com/emberjs/ember-test-helpers/). It also removes the `data-test-*` attributes in the production build.
If you rely on CSS classes, your tests will break and need a significant rewrite.
concern
Don’t we want this? Classes are part of the user experience, so tests should break if they change. If not, then this concern is also applicable to data-test selectors. That is, when you change the DOM you also need to move/change data-test selectors without which the tests will break in a similar fashion and will need rewrite.
In that case, data-test selector becomes useful exactly in this case when you have an element
that can change the type (span ➞ div ➞ li, etc),
can change the class,
but still, needs to play the same role? This is not common and is sometimes unrealistic.
The text was updated successfully, but these errors were encountered:
I am interested to know how I can request a change of these excerpts from the Testing guides, and whom I can reach for the following concerns. Kindly guide.
excerpt
guides-source/guides/release/testing/testing-tools.md
Line 92 in 1ae44e8
concern
When DOM changes are unavoidable, it is natural that the
data-test
selectors will also need to be moved, and refactored. How does usingdata-test
selectors provide any perceivable/measurable value?excerpt
guides-source/guides/release/testing/testing-tools.md
Line 99 in 1ae44e8
concern
Don’t we want this? Classes are part of the user experience, so tests should break if they change. If not, then this concern is also applicable to
data-test
selectors. That is, when you change the DOM you also need to move/changedata-test
selectors without which the tests will break in a similar fashion and will need rewrite.In that case,
data-test
selector becomes useful exactly in this case when you have an elementThe text was updated successfully, but these errors were encountered: