Run your Detox tests on LambdaTest Real Device Cloud Platform using HyperExecute.
- Clone this repository
- Ensure you have the following installed:
- Node.js 18 (required)
- npm (comes with Node.js)
- React Native development environment
- HyperExecute CLI
# Install nvm if you haven't already
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# Load nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Install and use Node.js 18
nvm install 18
nvm use 18
Export your LambdaTest credentials. You can get these from your LambdaTest Profile
export LT_USERNAME="your_username"
export LT_ACCESS_KEY="your_access_key"
curl -O https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute
chmod +x hyperexecute
curl -O https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute
chmod +x hyperexecute
curl -O https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe
Install the project dependencies:
npm install
The project includes a detox.config.js
file configured for LambdaTest:
module.exports = {
apps: {
"android.release": {
"type": "android.apk",
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -"
}
},
devices: {
"hyperexecute.raw.device": {
type: 'android.attached',
device: {
adbName: '.*'
}
}
},
configurations: {
"lambdatest": {
"device": "hyperexecute.raw.device",
"app": "android.release"
}
}
};
The test execution is managed by two scripts in the lambdatest/scripts
directory:
This script handles the environment setup:
- Installs and configures nvm
- Sets up Node.js 18
- Configures Android SDK
- Installs project dependencies
This script runs the actual tests with the specified configuration.
Run your tests using HyperExecute CLI:
# For sequential test execution
./hyperexecute --user $LT_USERNAME --key $LT_ACCESS_KEY --config yaml/hyperexecute.yaml
# For parallel test execution
./hyperexecute --user $LT_USERNAME --key $LT_ACCESS_KEY --config yaml/hyperexecuteParallel.yaml
The test scripts that will be executed are defined in package.json
:
{
"scripts": {
"test:lambdatest-android": "detox test --configuration lambdatest --loglevel trace --debug-synchronization 10000",
"test:firstTest": "detox test --configuration lambdatest --testNamePattern='should have welcome screen' --loglevel trace --debug-synchronization 10000",
"test:secondTest": "detox test --configuration lambdatest --testNamePattern='should show hello screen after tap' --loglevel trace --debug-synchronization 10000",
"test:thirdTest": "detox test --configuration lambdatest --testNamePattern='should show goodbye screen after tap' --loglevel trace --debug-synchronization 10000"
}
}
The project supports running tests in parallel using HyperExecute. This is configured through:
-
yaml/hyperexecuteParallel.yaml
:- Sets concurrency level (3 parallel devices)
- Configures test reporting
- Defines test discovery and execution settings
-
lambdatest/discoveryParallel.txt
:- Lists the test scripts to be executed in parallel:
test:firstTest test:secondTest test:thirdTest
- Lists the test scripts to be executed in parallel:
The project is configured to generate both HTML and JUnit test reports:
-
HTML Reports:
- Generated using
jest-html-reporter
- Available at
reports/test-report.html
- Includes detailed test results and failure messages
- Generated using
-
JUnit Reports:
- Generated using
jest-junit
- Available at
reports/junit.xml
- Useful for CI/CD integration
- Generated using
The reporting configuration is managed in e2e/jest.config.js
:
reporters: [
"detox/runners/jest/reporter",
["jest-html-reporter", {
"pageTitle": "Detox Test Report",
"outputPath": "./reports/test-report.html",
"includeFailureMsg": true
}],
["jest-junit", {
"outputDirectory": "./reports",
"outputName": "junit.xml",
"ancestorSeparator": " › ",
"uniqueOutputName": "false",
"suiteNameTemplate": "{filepath}",
"classNameTemplate": "{classname}",
"titleTemplate": "{title}"
}]
]
- Visit LambdaTest Dashboard
- Find your test execution
- View detailed reports, screenshots, and logs
If you face any issues while running the tests, please report them in the issues section.