lundi 7 décembre 2020

Need to get text value out of LinearLayout

Have the below piece of Android UI ouput got from Repl()

      [LinearLayout] id: "LayoutRoot"
                    [RelativeLayout > LinearLayout] id: "ClickableArea"
                      [LinearLayout]
                        [LinearLayout]
                          [TextView] id: "PrimaryText" text: "Cats"
                          [TextView] id: "SecondaryText" text: "1 animal"
                        [ImageView] id: "ErrorIcon"
                        [TextView] id: "ErrorCount" text: "1"
                      [FrameLayout] id: "SmallAccessory"
                        [ImageView] id: "Expand"
                    [View]

I am writing UI tests for an Android app, have 2 checks for the PrimaryText and SecondayText as well

Assert.IsNotEmpty(application.Query(q => q.Id("ClickableArea").Descendant().Text(UITestElements.HoldingPen.Liveweight)));
Assert.IsNotEmpty(application.Query(q => q.Id("ClickableArea").Descendant().Text(UITestElements.HoldingPen.Liveweight).Sibling().Id("SecondaryText").Text("1 animal")));

What I would like to be able to do is check the ErrorCount Text property for each ClickableArea, have tried variation of the above with Child, Sibling, Parent but just can't get my head around it.

Not all of them have an ErrorCount and the ID tags are not there if they do not have error

There are approx 30 of these ClickableAreas on the page and they do require scrolling to.

Anyone know how to do this?

Aucun commentaire:

Enregistrer un commentaire