vendredi 8 décembre 2017

Xamarin UITest: Querying element/container with two text elements

I am writing Xamarin UI tests for an online booking system (Not created by me). The timeslots display the time and the slots availability, which can be Available, Request, or Unavailable. What I want my test to do is tap the first "Available" timeslot and to return the time for that slot as a string, for assertion later on. Is there anyway to do this? Currently, I cannot establish any relationship between the 'container', the availability text, and the timslot text. As you can see in the screenshot link below, if a timeslot is unavailable, then there's no text displayed for availability:

http://ift.tt/2k946WE

When running tree command on this page using repl, I am displayed the following:

[LabelRenderer] label: "TimeSlotLabelId_Container"
                    [FormsTextView] id: "NoResourceEntry-892",  label: "TimeSlotLabelId",  text: "09:00"
                [Platform_DefaultRenderer > Platform_DefaultRenderer]
                  [LabelRenderer] label: "TimeSlotLabelId_Container"
                    [FormsTextView] id: "NoResourceEntry-894",  label: "TimeSlotLabelId",  text: "09:30"
                  [LabelRenderer]
                    [FormsTextView] id: "NoResourceEntry-895" text: "Available"

If I query the "TimeSlotLabelId_Container", then there's nothing that seems to links the times to the availability:

[0] {
Id => null,
Description => "md5b60ffeb829f638581ab2bb9b1a7f4f3f.LabelRenderer{14f1b71 V.E...... ........ 0,0-120,65}",
Rect => {
    Width => 120,
    Height => 65,
    X => 40,
    Y => 842,
    CenterX => 100,
    CenterY => 874
},
Label => "TimeSlotLabelId_Container",
Text => null,
Class => "md5b60ffeb829f638581ab2bb9b1a7f4f3f.LabelRenderer",
Enabled => true

Aucun commentaire:

Enregistrer un commentaire