Imagine a structure like this, a list with products.
<div class="container">
<div class="teaser">
<img src="...">
<p>Product 1</p>
</div>
<div class="teaser">
<img src="...">
<p>Product 2</p>
</div>
</div>
We need to test the amount of .teaser elements in .container is greater than X.
Now the question. I suggested to my team that we rename the generic classnames to real semantic names, so we change the css to fit the semantic classes and we can do frontend-tests for the semantic fields.
My suggestion:
Radically change the classes and the CSS, no extra classnames for testing purpose.
<div class="product-list">
<div class="product">
<img src="...">
<p>Comment</p>
</div>
<div class="product">
<img src="...">
<p>Another Comment 2</p>
</div>
</div>
My teams counter suggestion:
Keep the classnames we already have and add test-specific classes (with prefix testing) only used for testing purpose:
<div class="container testing-product-list">
<div class="teaser testing-product">
<img src="...">
<p>Comment</p>
</div>
<div class="teaser testing-product">
<img src="...">
<p>Another Comment 2</p>
</div>
</div>
Which solution is better?
.teaserelements in.containerwithout doing all of these alterations?