Description
I'm using Bitrise to run Detox tests. The build command runs ok and is a success. But the test command always fails.
Running locally:
- Command
detox test -c ios.sim.debug
without starting the packager: 'No bundle URL present' error Command
detox test -c ios.sim.debug
with the packager: Opens the packager and everything runs OK.Command
detox test -c ios.sim.release
without the packager: works fine.- Command
detox test -c ios.sim.release
with the packager: works fine.
Running in Bitrise:
- Command
detox test -c ios.sim.debug --cleanup
without starting the packager: 'No bundle URL present' error Command
detox test -c ios.sim.debug --cleanup
with the packager:Verify tests are up "before all" hook: Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/vagrant/git/e2e/tests.spec.js)
Command
detox test -c ios.sim.release --cleanup
without the packager: works fine.- Command
detox test -c ios.sim.release --cleanup
with the packager: works fine.
Disclaimer
With/Without the packager means the variable RCT_NO_LAUNCH_PACKAGER
equals false/true
, respectively.
The package.json file
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PROJECT_NAME.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/PROJECT_NAME.xcworkspace -scheme INTEGRATION_SCHEME -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/PROJECT_NAME.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/PROJECT_NAME.xcworkspace -scheme PRODUCTION_SCHEME -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7 Plus"
},
The bitrise.yml file
_init_install:
steps:
- activate-ssh-key@3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0.11: {}
- script@1.1.5:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
brew uninstall --ignore-dependencies node
brew install node@8
brew link --overwrite --force node@8
- yarn@0.0.7: {}
_detox_tests:
steps:
- npm@0.9.0:
title: Install Detox CLI
inputs:
- command: install -g detox-cli
- npm@0.9.0:
title: Install React-Native CLI
inputs:
- command: install -g react-native-cli
- script@1.1.5:
title: Install Detox Utils
inputs:
- content: |-
#!/bin/bash
brew tap facebook/fb
export CODE_SIGNING_REQUIRED=NO
brew install fbsimctl
brew tap wix/brew
brew install applesimutils --HEAD
- script@1.1.5:
title: Detox - Build Debug App
inputs:
- content: |-
#!/usr/bin/env bash
detox build -c ios.sim.debug
- script@1.1.5:
title: Detox - Run E2E Tests
inputs:
- content: |-
#!/usr/bin/env bash
detox test -c ios.sim.debug --cleanup
- deploy-to-bitrise-io@1.3.10: {}
test_ios:
before_run:
- _init_install
after_run:
- _detox_tests
steps:
- cocoapods-install@1.7.2:
inputs:
- podfile_path: ios/Podfile
- resource-archive@2.0.1:
inputs:
- extract_to_path: "$HOME/Documents/FacebookSDK/"
- archive_url:https://origincache.facebook.com/developers/resources/?id=facebook-ios-sdk-current.zip
- certificate-and-profile-installer@1.9.3: {}
```
Detox, Node, Device, Xcode and macOS Versions
- Detox: v7.4.3
- React Native: v0.51.0
- Node: v9.4.0
- Device: iPhone 7 (simulator)
- Xcode: Version 9.3 (9E145)
- macOS: 10.13.3 (17D102)
Device and verbose Detox logs
- Error
detox test -c ios.sim.debug --cleanup
with the packager
- File
detox.last_launch_app_log.err
prints:
TL;DR
I get an error when running Detox with Bitrise. The command detox test -c ios.sim.debug --cleanup
should open a packager but looks like it's not doing it.
The version that is needed to test is the Debug one, no other options. Maybe I missed something about the installation, but all the files were checked with official docs and other examples and are the identical.