Closed powerdude closed 10 months ago
hum, at glance, page.Find<MauiControls.Label>("name").Text.Should().Be("m");
shouldn't be page.Find<MauiControls.Label>("name").Text.Should().Be("name");
?
is the test failing?
Well, an exception is thrown before it gets to the assertion. System.InvalidOperationException: Element with automation id name not found or requested type is not correct
When I debug, I also see that the RenderFavoriteItem
is never called.
OK, I see the problem, items are not materialized until the view is actually rendered (more or less) so in our case, this never occurs. I'm going to fix it by forcing the creation of the items internally when the automation lookup is performed.
Anyway, I'm not sure that this could solve any kind of issues involving a DataTemplate, but for now for every ItemsView-derived control it works.
Please update to the latest version of the package as it will be available,
Thanks for your cooperation
Hey @adospace, thank you for the quick fix. Unfortunately, it still won't find the item if the view is just a label. So this works:
private VisualNode RenderFavoriteItem(DataModel location) => new VStack()
{
new Label(location.Name).AutomationId("l")
};
but this doesn't:
private VisualNode RenderFavoriteItem(DataModel location) =>
new Label(location.Name).AutomationId("l")
ah yes, sorry, now it should also work for the first level control, please check the latest version 142
Hello, I have the following test class:
It seems like
BugPage.RenderFavoriteItem
doesn't get called. Is there something wrong with how the page is set up?