I will just start by saying I'm a .Net developer by trade and have little to no experience with Java so apologies if any of this is super obvious but I'm trying to make the lives of our testers a little easier by trying to assess android-espresso-recorder as an option for them to produce automated tests for our Android app written in React Native.
Basically, the issue I am currently facing is we have our React Native app written and we want to add some tests. I've fired up the application on the emulator by running:
yarn start
to trigger Metro followed by
yarn android
in order to launch the application in the Android Emulator.
If I don't perform these preliminary steps, when I try to run the app directly from Android Studio it will present the following error:
Once the application is visible within the emulator, I then open up the Android folder of my project in Android studio.
I select Run > Record Espresso Test and then wait for the App to load in the emulator and attach all of the debuggers necessary for the recorder to function.
Once this process has completed, I record a simple UI test, add an assertion and then finalise the test.
A message pops up stating that missing dependencies will be added to the project automatically to allow support for the Espresso tests so I click 'Yes' and allow it to do its thing. The gradle sync process runs in the bottom of the Android Studio window and it looks like it's doing something then finally I am presented with my test file in java. There are no errors generated during the supposed installation of the dependencies.
However, once the .java file for my test opens up, it is riddled with red errors throughout the code. If I look in the 'Problems' tab I can see multiple cannot resolve symbol messages as shown below:
What's more, the generated file for some reason has been placed in a java(generated) folder alongside what I believe is the normal java folder within the solution (again I'm not sure of this because most of our work is done in React Native and I work on the back-end but have been asked to investigate this as the most senior developer).
I've tried multiple things within the code file itself including trying to right click and use the context options to add the missing dependencies but these don't seem to do anything:
I've also tried doing a:
./gradlew clean
To see if the missing dependencies are added in once Android Studio is closed down but this doesn't seem to make and difference either and I'm unable to even run the generated test because of the errors within the file.
A few other things I have tried based upon a number of Google searches is:
File > Sync Project With Gradle Files
File > Invalidate Caches
File > Restart IDE
I've followed several tutorials online including the main one from Android Studio with regards to how to get this up and running but in all the ones I have seen, nobody seems to encounter this issue.
I've also tried on 3 different machines (mac and windows) to ensure it wasn't some form of rogue cache somewhere but it fails on every single machine.
Any help with this would be greatly appreciated. I understand the information provided is a bit sparse and I'm happy to provide any further information that is required but as this is not my area and is mainly a favour to my front end team to try and find a solution I'm sure you can all appreciate I'm trying to provide as much information as possible in what is effectively a language I don't develop in and generally actively avoid.
Thanks in advance,
J