Inaccessible UI elements in Espresso connectedDebugAndroidTest

I am trying to run the command ./gradlew build connectedAndroidTest command which will trigger the android UI tests written for an app.

The tests are fine and passes when ran locally using an emulator or phone with a normal screen size. But the emulator that travis uses for testing seems to be illogically small and a few of the elements in the screen (which is visible normally) is reported to be not visible in travis build (it throws androidx.test.espresso.NoMatchingViewException which means the same to the best of my knowledge). I was able to confirm this when I added a scroll function down to make the bottom half of the screen visible and that led to passing my build. But this is not possible to implement throughout the app.

Is there any change that I must make to the config file to get a normal sized emulator or to skip the UI test so that I can stick with running it locally only?

Links

Imprint