Improve CheckDashboardHasResourcesAsync in workload tests
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
CheckDashboardHasResourcesAsync has some improvements I'd like to see to make it less brittle to changes and improve the error message output.
Expected Behavior
- Asserts are hardcoded to cell position and number. The test will break if the number or order of columns changes. I'd like the test to get cells using something other than position. Perhaps we can give each cell a class to look up. Or if that isn't possible, then embed content in divs with classes. I think it's ok to make some modest changes to the generated HTML to make testing better.
- If a row's content doesn't match the expected content, then the test doesn't match the row and skips adding it to found rows. But that means the error message just says that the resource wasn't found. It doesn't say exactly what didn't match for the row (e.g. the wrong number of endpoints). Knowing why it didn't match would be useful.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version info
No response
Anything else?
No response
cc @radical
@adamint would you be interested in taking this up, since you recently worked on dashboard playwright tests?
@radical sure!
Also, queries such as //fluent-data-grid-row[@class='resource-row'] require the exact classes to match the query. It would be better if the query returned elements named fluent-data-grid-row with the class resource-row and any other classes.
Is there a better way to write this kind of query that isn't so brittle to HTML changes?
See https://github.com/dotnet/aspire/pull/4892#discussion_r1680435584
Also, queries such as
//fluent-data-grid-row[@class='resource-row']require the exact classes to match the query. It would be better if the query returned elements namedfluent-data-grid-rowwith the classresource-rowand any other classes.Is there a better way to write this kind of query that isn't so brittle to HTML changes?
See #4892 (comment)
Yes, it is recommended not to use css classes or html elements where possible
What's the alternative?