Moropo
RoadmapTerms
  • Welcome to Moropo
  • Quick Start
  • Uploading your app
    • Producing an Android Build
    • Producing an iOS Build
    • Uploading Your Build To Moropo
  • Creating Tests
    • Using the Test Creator
    • Test Configuration
    • Test Step Commands
      • addMedia
      • assertNotVisible
      • assertTrue
      • assertVisible
      • back (Android only)
      • clearKeychain (iOS Only)
      • clearState
      • copyTextFrom
      • doubleTapOn
      • eraseText
      • evalScript
      • extendedWaitUntil
      • hideKeyboard
      • inputRandomEmail
      • inputRandomNumber
      • inputRandomPersonName
      • inputRandomText
      • inputText
      • launchApp
      • longPressOn
      • openLink
      • pasteText
      • pressKey
      • repeat
      • runFlow
      • runScript
      • scroll
      • scrollUntilVisible
      • setLocation
      • startRecording
      • stopApp
      • stopRecording
      • swipe
      • takeScreenshot
      • tapOn
      • travel
      • waitForAnimationToEnd
    • Test Step Selectors
    • Importing From Maestro
    • Environment Variables
      • ${BUNDLEID}
      • ${EXPORELEASECHANNEL}
      • ${MOROPO_TEST_EMAIL}
      • ${MOROPO_EMAIL_URL}
    • Advanced Use Cases
      • JavaScript
      • Conditionals
      • Network Connection
      • Drag and Drop
  • Running Tests
    • Manually Trigger a Test Run
    • Scheduling a Test Run
    • Tags
    • Supported Devices
    • Test Execution Limits
    • Flakiness Tolerance & Retries
  • CI Integration
    • Initial CI Setup In Moropo
    • GitHub Action
    • Moropo API
      • Branches
      • Builds
      • Test Runs
      • Tests
  • Test Results
    • Results Explorer
    • Slack Reporting
    • Email Reporting
  • App Frameworks
    • Flutter
    • React Native
  • Guides
    • React Native Expo
    • Access Emails During A Test Flow
    • Git workflow using Moropo API
  • Infrastructure
    • IP Addresses
  • Security
    • Services Infrastructure
    • Security Best Practices
Powered by GitBook
On this page
  • Building React Native for Moropo
  • Adding Identifiers

Was this helpful?

Edit on GitHub
  1. App Frameworks

React Native

How to get your React Native app into Moropo

Last updated 3 months ago

Was this helpful?

Moropo fully supports React Native.

In this guide, we will look at how to build React Native apps ready to import into Moropo and how to add identifiers to your app to improve test accuracy.

Building React Native for Moropo

We'll start by initialising the .

For each of the apps, we need to ensure that they are built in release mode. When a React Native app is built in development mode it is dependent on the local JS server on your machine.

Remember that you need to make a new build every time that you make changes locally. If you are using Expo then you can make use of OTA updates instead to reduce the number of native builds that you need to create.

If you are currently using GitHub actions to build your app then you can pass the build straight to our .

Android

Run npx react-native build-android --interactive and select assemble, this will create both the debug and release apks in the android folder.

Now take the output app-release.apk and upload it to your app in Moropo.

cd ios to change your working directory to the ios folder and run xcodebuild -workspace AwesomeProject.xcworkspace -configuration Release -scheme AwesomeProject -destination 'generic/platform=iOS Simulator'.

The important parts of that command are the configuration set to release so that the app is not dependent on your local JS server and the destination set to Simulator so that a .app file is built ready for Moropo.

The file will be output to a special Xcode folder. For me that looked like this: /Users/{{YOUR USERNAME}}/Library/Developer/Xcode/DerivedData/AwesomeProject-cxfaqbcfvcboddaxdadozkmshhpg/Build/Products/Release-iphonesimulator/

You will see this location output in the terminal at the end of the build.

Once you have located the file, compress it into a zip file and you're ready to upload to Moropo.

Adding Identifiers

The first build has this full-width kitten addition and I would like to click on it in Moropo.

<Image
  height={200}
  width={width}
  source={{uri: `https://placekitten.com/200/${Math.floor(width)}`}}
/>

Unfortunately, there is no unique identifier against this component so the only thing Moropo sees when you click on the image is the percentage-based coordinates.

The way we solve this problem is by providing a unique reference in the code which allows it to be uniquely identified by Moropo.

Different frameworks have different ways of providing this identifier, on React Native the way to do it is with a testID.

I have given the image a testID of 'kitten':

<Image
  testID='kitten'
  height={200}
  width={width}
  source={{uri: `https://placekitten.com/200/${Math.floor(width)}`}}
/>

And now we have a unique ID!

iOS

I have created 2 builds based on the default React Native app. The first app has an exciting new image component based on my favourite image placeholder site . Update: PlaceKitten is no longer available, but .

🍏
PlaceKitten
alternatives exist
🤖
example React Native app
GitHub Action
npx react-native build-android --interactive
APK location
Successful upload
Compress the .app into a zip file
No cat id 😿
Cat id 😻