It appears that the decision was made to remove ID's (and really, any identifying information) for field inputs from Blazor. How are we supposed to identify individual fields to validate behaviors in both BUnit and other test frameworks like Selenium? Is
it expected that the developer is responsible for writing the code to re-add support for ID's or Name attributes to these inputs, or is there a recommended approach I haven't seen yet?
To be clear, I am aware of the solutions outlined in
this article and other similar approaches. This makes things more difficult than simply being able to ID individual elements to validate their values. Is this really the only approach provided?
None
0 Points
1 Post
Testing Components without Element ID's
Jan 13, 2021 05:39 PM|jmoore5268again|LINK
It appears that the decision was made to remove ID's (and really, any identifying information) for field inputs from Blazor. How are we supposed to identify individual fields to validate behaviors in both BUnit and other test frameworks like Selenium? Is it expected that the developer is responsible for writing the code to re-add support for ID's or Name attributes to these inputs, or is there a recommended approach I haven't seen yet?
To be clear, I am aware of the solutions outlined in this article and other similar approaches. This makes things more difficult than simply being able to ID individual elements to validate their values. Is this really the only approach provided?
All-Star
52101 Points
23237 Posts
Re: Testing Components without Element ID's
Jan 13, 2021 08:33 PM|mgebhard|LINK
You mean the ID attribute in an HTML element? If so, you can add IDs if you like.
Otherwise the HTML is standard. Can you explain the problem you are trying to solve?
Blazor Forms and Validation
https://docs.microsoft.com/en-us/aspnet/core/blazor/forms-validation?view=aspnetcore-5.0