I'm trying to implement Cypress into my angular project with data-cy attributes, but they act very inconsistent. In some places the attribute does show in the dom, but in other places it doesn't.
Example where it doesn't show:
<mat-radio-button
*ngFor="let opt of question.options"
[attr.data-cy]="question.key + '-' + opt.key"
[value]="opt.key">
{{opt.value}}
</mat-radio-button>
The value attribute does show, so somethings work. I've tried different handles like removing the brackets, removing attr. (but I'm aware this shouldn't work at all), and giving a different value as only a string saying test
Example where it does work:
<fa-icon class="logoutButton" [attr.data-cy]="'profile-button'"></fa-icon>
Any ideas on what I'm doing wrong?
