React Native Android Detox Tests Not Working

react-native
android
#1

I have been trying to run my Detox Android tests on Bitrise for almost a week now with almost no positive outcome. So I’ll list the steps I’ve followed below:

  • First off, I have built them for iOS, iOS runs very well and headless too.
  • I can run my detox tests for both platforms smoothly locally from ground up.
  • The emulator name is definitely absolutely correct.
  • I have tried;
    • using avd manager step
    • creating my own windowless avd
    • creating my own avd with window so I can actually see what is happening with remote connection.

I did all the above like 20 times by now, as a result what I can see is;

The main problem I can see is that detox is having problems interacting with the bitrise emulator. First of all, the swipes do not work at all, they work when I drag the emulator with my mouse, but Detox cannot trigger them (even though it can when I run it on my mac). Second issue I saw was that some waitFor(element(by.id(elementId))) queries simply do not work. Even though they are very visible, even though I have the exact same emulator on my computer which can see them, these elements are not seen by detox as I assume there are some limitations here.

Am I doing something wrong? Is there a secret way to run detox tests for Android? I really wasted a lot of time on this already, so an answer would make me very happy. I have looked through both online and the community and I couldn’t really find an answer for this either.

Thanks in advance

0 Likes

#2

Howdy @denizbilgin!

Many of our customers are able to use Detox on Bitrise and we do offer some best practices. With that said, we don’t officially support Detox. There’s a limit to the scope of support we can provide, although we do make a best effort to help.

I have two suggestions. First, if you haven’t read through our Detox documentation I suggest that you check it out: https://devcenter.bitrise.io/testing/running-detox-tests-on-bitrise/

Second, a lot of folks aren’t aware that the Android Emulator needs to be started in two steps:

Make sure you have both of them in your workflow or the Android Emulator may not work as expected.

0 Likes

#3

Hey @matthew.jones, thanks for your reply.

I talked to bitrise support about this directly and honestly did not get any resolution there either.
I have read the detox documentation and if you could also take a look, it’s only for iOS and not Android.

I have tried the steps you mentioned as well, I also tried creating the emulator myself and waiting for it. There is definitely no problem with the wait as the build takes long enough. I have tried creating the emulator windowless and with window and even watched it in the remote connection. I could see it with my own eyes that it’s only barely working. Stuff like swiping wouldn’t work at all.

The problem is not that the tests don’t start at all, they start, but detox can’t navigate properly as it does in my local computer as I mentioned in the question

0 Likes

#4

Which emulator version are you using? The GPU notice is concerning. Our machines don’t have any GPU acceleration, so that might contribute to the problem.

0 Likes

#5

I think I tried 26 and 27.
Not 100% about this, but I think the GPU notice only appears when I run the emulator with a window. It wasn’t there when I was running it windowless, but I would have the same tests fail.

0 Likes