0

I am trying to write some ui tests for a react-native app with espresso and I didn't found much help. is there a way to use espresso with react-native and espresso recorder ??

Anass NAZIH
  • 111
  • 1
  • 7

2 Answers2

1

Yes, you can use Espresso Recorder with Reactive Native Android Apps. Just import the Android package from your React Native project.

However, Espresso Recorder is not under any active development and was originally made by the Firebase team so it is not open sourced under AndroidX Test or maintained by the Android Studio tooling team.

You can definitely still use the Android tools to inspect a React Native application, and to write Espresso tests, but the code you get from the Espresso Recorder should be taken with a grain of salt.

Check out How to use Espresso UI Testing for React Native? and the linked gist: https://gist.github.com/cybergrind/0a2ad855352a5cd47cb5fb6a486c5eaa for more on creating Espresso tests for React Native Android apps.

Mark Han
  • 2,785
  • 2
  • 16
  • 31
0

You can write espresso tests the same way as a native app, run your app from android studio and try Espresso test recorder, it will do a decent job to get you started. You can open Layout Inspector checkout the element tree and follow the basic steps.

Also while its possible to write espresso tests for any Android app, since your app is in JavaScript with RN, have you looked into something like appium through which you can have tests in JS?

satyajit
  • 1,470
  • 3
  • 22
  • 43
  • The problem was, when I try to run react project in android studio it fail. And for appium, I'm trying to run my test in test lab so it doesn't support it. Thanks :) – Anass NAZIH Jul 22 '19 at 09:41