This is a new React Native project, bootstrapped using @react-native-community/cli
.
Note: Make sure you have completed the Set Up Your Environment guide before proceeding.
First, you will need to run Metro, the JavaScript build tool for React Native.
To start the Metro dev server, run the following command from the root of your React Native project:
# Using npm
npm start
# OR using Yarn
yarn start
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
# Using npm
npm run android
# OR using Yarn
yarn android
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
bundle install
Then, and every time you update your native dependencies, run:
bundle exec pod install
For more information, please visit CocoaPods Getting Started guide.
# Using npm
npm run ios
# OR using Yarn
yarn ios
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
doc link: https://wix.github.io/Detox/docs/introduction/environment-setup
Step-01: Install Command Line Tools (detox-cli)
npm install detox-cli --global
Step-02: Install [MacOS Only] applesimutils
brew tap wix/brew
brew install applesimutils
Step-01: Install jest as a development decency
npm install "jest@^29" --save-dev
Step-02: Install detox as a development decency
npm install detox --save-dev
Step-03: Initialize Detox in your project
detox init
// Normally you should see an output like:
Created a file at path: .detoxrc.js
Created a file at path: e2e/jest.config.js
Created a file at path: e2e/starter.test.js
Step-04: App configs
1. Open Detox config.js and replace YOUR_APP placeholder with the actual app name: Like name is ReactNativeDetoxTest
2. Also past actual simulator device name : like :iPhone 15 Pro Max
Step-05: Run test
// build script IOS
detox build --configuration ios.sim.debug
// build script ANDROID
detox build -c android.emu.debug
// test script IOS
detox test --configuration ios.sim.debug
// test script ANDROID
detox test --configuration android.emu.debug
Other-Command
# clean and rebuild Detox:
detox clean-framework-cache && detox build
App delegate Issues
This project i feach some of issues ios I need to change this file : ios/ReactNativeDetoxTest/AppDelegate.swift and need to add this code on this file
@objc var reactNativeFactory: RCTReactNativeFactory?