Forum Xamarin Xamarin Test Cloud (Read Only)

Testing for a button being enabled

My problem is that I have an entry that when selected displays a picker. The user picks an entry from the picker and the selected value is then entered into the text entry. The text entry is not being populated quickly enough so the test then attempts to move on to the step which is failing due to the text entry not having a value.

Is there a way in which I can wait for the button to become enabled (i.e. the text entry has been populated)?

Thanks in advance.

Best Answer

Answers

  • GrinenkoAGrinenkoA USMember ✭✭

    Did you try subscribing to this event?

    //In .xaml:
    <TextEntry PropertyChanged="YourTextEntry_PropertyChanged"/>
    
    //And in .xaml.cs:
    void YourTextEntry_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    {
        //do stuff
    }
    

    You can check if the correct property was changed like that:

    if (e.PropertyName == "propertyName");
    
  • SteveDixSteveDix USMember ✭✭

    Thanks for the reply but what I'm after is a way of doing this via UITest (i.e. using WaitFor to test to see if the button is enabled or something similar).

Sign In or Register to comment.