mardi 21 novembre 2017

How to set visibility of the textview using android espresso test

I want to set visibility for the text view from test cases.I am using espresso for testing the UI. I used the viewAction to set the text to the text view. But I want to set visibility for the text view. Please, any one helps me to resolve this issue. Here is my code for setting the text to the text view.

public ViewAction setTextInTextView(final String value){
    return new ViewAction() {
        @SuppressWarnings("unchecked")
        @Override
        public void perform(UiController uiController, View view) {
            ((TextView) view).setText(value);
        }

        @Override
        public Matcher<View> getConstraints() {
            return allOf(isDisplayed(), isAssignableFrom(TextView.class));
        }

        @Override
        public String getDescription() {
            return "replace text";
        }
    };
} 

Aucun commentaire:

Enregistrer un commentaire