I am trying to create UITest for Xamarin.Forms project. I have tryed using some inf available on Xamarin forum but had no luck with it.
Country list for the Picker:
List<country> countryList = new List<country>({id="GB", name="United Kingdom"}, {id="US", name="United States"}.... etc);
Code for Picker:
var countryPicker = new Picker();
countryPicker.SetBinding(Picker.SelectedIndexProperty, "myIndex");
countryPicker.BindingContext = getCountry;
countryPicker.BackgroundColor = Color.White;
countryPicker.AutomationId = "countryPicker";
countryPicker.SelectedIndexChanged += ((s, e) =>
{
foreach (var element in countryList)
{
if (element.name.Equals(countryPicker.Items[countryPicker.SelectedIndex]))
{
getCountry.myCountry = element.id;
}
}
});
//adding all the countries to the list
foreach (var item in countryList)
{
countryPicker.Items.Add(item.name);
}
nunit code:
app.Query(c=>c.Marked("countryPicker").Invoke("selectValue", "United States"));
Answer: Query for Marked("countryPicker").Invoke("selectValue", "United States") gave 1 results. But nothing is happening - selection is not done! I've tryed to select value to "US" - same, no result.
Am I missing something?
Aucun commentaire:
Enregistrer un commentaire