Hi there I am new to Android Junit testing:
I have written some test code in MainActivityFunctionalTest.java file
MainActivityFunctionalTest.java:
I had the same issue and adding the closeSoftKeyboard() method resolved it for me.
onView(withId(R.id.view)).perform(typeText(text_to_be_typed), closeSoftKeyboard());