12

I was trying to run a robo test for my react native app on firebase TestLab, but I couldn't get the robo test pass login.

The first problem is that it doesn't type in email and password.

In my js file I had:

<Input ... testID="usernameInput" />
<Input ... testID="passwordInput" />

and I put this in my firebase console

enter image description here

However, it didn't work at all. I checked the video recording, it was not typed in.

Second problem is that even if I hard code my username and password in debug apk, it won't even click on the login button which is defined as:

<Button onClick={() => {this.handleLogin()}}>Login</Button>

I wonder what is happening here. Did anyone ever got firebase TestLab robo test working with react native app?

Tianhao Zhou
  • 784
  • 1
  • 9
  • 28
  • Jaxon, did you manage to get Firbase TestLab working with React Native? We're studying this tool or AWS Device Farm to test our Rect Native apps. – Hernán Albertario Jan 28 '19 at 15:37
  • @HernánAlbertario yes as per the first answer. However, so far my understanding has been that it's way too hacky and complicated to make it work which makes it almost doesn't worth it to do so. Maybe cavy plus jest will be a better option. – Tianhao Zhou Feb 08 '19 at 17:16

2 Answers2

5

Currently, Robo only allows you to pre-fill form fields that can be identified uniquely by native Android resource IDs (like an EditText widget). I'm not too familiar with react native, but it looks like it will generate a native Android app. That's probably why Robo can navigate your app at all -- it's using some native Android widgets to implement your UI. But if you can get React to use native Android resource IDs (or figure out which resource IDs are already being used), and reference those names in your test, that might work.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • hmm, that's a fair point. React native does generate a native Android app. However, I think injecting resource-id into the native elements is currently not supported in react native. Are you saying that whatever element that doesn't have a resource-id is invisible to robo test? – Tianhao Zhou Jul 28 '17 at 06:10
  • Views without named resource IDs can't currnetly be targeted by the Robo test pre-fill fields. You need a named Android resource ID to put in that form. – Doug Stevenson Jul 28 '17 at 07:21
  • But what about non-prefilled field? Does having resource-id or not still matters? – Tianhao Zhou Jul 28 '17 at 20:01
  • If the text field already has some string in it, that should be fine. Robo isn't going to try to wipe out anything that already exists there. – Doug Stevenson Jul 28 '17 at 20:10
  • 1
    resource-id is not supported right now on react-native, but there's a open PR for it: https://github.com/facebook/react-native/pull/18527 – Estevão Lucas May 11 '18 at 16:56
  • 2
    Now the pull request is closed. :( – Hjulle Feb 14 '20 at 10:57
0

My suggestion is to do one of these:

  1. Create a "deep link" with a long random key that will auto-login as a test user to your app (and bypass the login flow), you can provide this deep link to the robo test as an initial start point. (e.g. myapp://6zOOT9b1duKykHqE8bLFROGymYQDsRXn)

  2. Create a "special" binary to test using the robo test which has the user name and password for your test user as a default in the text inputs (so the robo test will just sign in by clicking on the button)

Yair Levi
  • 1,261
  • 10
  • 11