Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use firebase TestLab with react native

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?

like image 901
Tianhao Zhou Avatar asked Jul 27 '17 20:07

Tianhao Zhou


People also ask

Can I use firebase with react native?

A React Native project can use Firebase services using the NPM react-native-firebase/app module, but the native (Android & iOS) apps need to be added to the Firebase project. The native projects need to be configured to set up Firebase dependencies and the Firebase SDK initialization (iOS only).

How do I import a firebase database into react native?

To install the "app" module, view the Getting Started documentation. # Install & setup the app module yarn add @react-native-firebase/app # Install the database module yarn add @react-native-firebase/database # If you're developing your app using iOS, run this command cd ios/ && pod install && cd ..


1 Answers

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.

like image 192
Doug Stevenson Avatar answered Sep 28 '22 05:09

Doug Stevenson