6

Our UI tests fail for Android 9 because our test environments don't use HTTPS. The problem is that we are making network calls from the espresso tests (for example creating brand new user directly on the back end to be used in the test) which means they run on the espresso test app.

Adding networkSecurityConfig to the app manifest does not help because the app is not the problem but the espresso app.

How can I fix this? Does the espresso app have manifest where I can add that or any way to change this permission programmatically?

My question is different from

CLEARTEXT communication not supported on Retrofit and Android 8: Cleartext HTTP traffic not permitted

Because I can't find a way to access the espresso app manifest. I can make the changes in my app manifest but it does not matter because the app is already working. I'm failing from the espresso part.

STARGATEBG
  • 251
  • 1
  • 8
  • Possible duplicate of [CLEARTEXT communication not supported on Retrofit](https://stackoverflow.com/questions/41650965/cleartext-communication-not-supported-on-retrofit) – Jeel Vankhede Jan 09 '19 at 10:57
  • 1
    @STARGATEBG I have a common problem with the scenario you've described above. The tricky part is to allow `HTTP`requests on Espresso App running Android 8+, because when running UI tests via Espresso, another app is created. How to do this? – Kostadin Georgiev Jan 09 '19 at 12:21
  • Possible duplicate of [Android 8: Cleartext HTTP traffic not permitted](https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted) – Zoe Jun 14 '19 at 19:29

1 Answers1

1

Go to Android Manifest file. In the Application tag, write this line

android:usesCleartextTraffic="true"
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
MANOJ G
  • 632
  • 7
  • 7