Forum Xamarin.Forms

How to get image source in UI test?

I have an image that toggles which image is shown based on if the typed in password is valid.

                            <Image AutomationId="passwordImageValidation" Source="fail.png" Grid.Column="0">
                                <Image.Triggers>
                                    <DataTrigger
                                        Binding="{Binding Source={x:Reference Password},
                                              Path=IsValid }"
                                        TargetType="Image"
                                        Value="false">
                                        <Setter Property="Source" Value="fail.png" />
                                    </DataTrigger>```
                                    <DataTrigger
                                        Binding="{Binding Source={x:Reference Password},
                                              Path=IsValid }"
                                        TargetType="Image"
                                        Value="true">
                                        <Setter Property="Source" Value="pass.png" />
                                    </DataTrigger> </Image.Triggers></Image>

I was trying to check in a UI test if the image is pass.png or fail.png.

I can do
app.Query(q => q.Marked("passwordImageValidation")).FirstOrDefault()
This returns an AppResult, however I cannot get from that to the source of the image.

Is this possible?

Sign In or Register to comment.