wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.25k stars 1.92k forks source link

Detox tests fail with Travis #1931

Closed bryanboyko closed 4 years ago

bryanboyko commented 4 years ago

🐛 Bug Report

Environment

NOTE: This is my local environment and not the travis environment

  Expo CLI 3.12.0 environment info:
    System:
      OS: macOS 10.14.4
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.12.0 - /usr/local/bin/node
      Yarn: 1.19.1 - /usr/local/bin/yarn
      npm: 6.11.3 - /usr/local/bin/npm
    IDEs:
      Android Studio: 2.3 AI-162.3871768
      Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^36.0.2 => 36.0.2 
      react: 16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4 
      react-navigation: ^3.11.1 => 3.13.0 
    npmGlobalPackages:
      expo-cli: 3.12.0

Steps to Reproduce

Push code to travis with the following .travis.yml, package.json, and setup.sh

---
language: node_js

node_js:
  - node
  - lts/*

env:
  global:
  - NODE_VERSION=stable

addons:
  homebrew:
    packages:
    - applesimutils
    taps: wix/brew

install:
  - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
  - export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
  - nvm install $NODE_VERSION
  - nvm use $NODE_VERSION
  - nvm alias default $NODE_VERSION

  - npm install -g react-native-cli
  - npm install -g expo-detox-cli && expotox clean-framework-cache && expotox build-framework-cache
  - yarn add --dev detox \ detox-expo-helpers \ expo-detox-hook

cache:
  directories:
    - ~/.npm
    - .jest

before_script:
  - npm install -g npm@latest

script:
  - npm ci
  - npx jest --ci
  - ./script.sh
  - detox build --configuration ios.sim
  - detox test --configuration ios.sim --cleanup
{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "jest"
  },
  "dependencies": {
    "@expo/vector-icons": "^10.0.6",
    "@ptomasroos/react-native-multi-slider": "^1.0.0",
    "@react-native-community/masked-view": "0.1.5",
    "@react-native-community/netinfo": "4.6.0",
    "apollo-boost": "^0.3.1",
    "apollo-cache-hermes": "^0.8.10",
    "apollo-cache-inmemory": "^1.5.1",
    "apollo-cache-persist": "^0.1.1",
    "apollo-client": "^2.6.8",
    "apollo-link": "^1.2.9",
    "apollo-link-context": "^1.0.15",
    "apollo-link-error": "^1.1.8",
    "apollo-link-http": "^1.5.12",
    "apollo-link-state": "^0.4.2",
    "apollo-link-ws": "^1.0.15",
    "aws-sdk": "^2.432.0",
    "axios": "^0.19.0",
    "expo": "^36.0.2",
    "expo-analytics-amplitude": "~8.0.0",
    "expo-app-auth": "~8.0.0",
    "expo-asset": "~8.0.0",
    "expo-av": "~8.0.0",
    "expo-facebook": "~8.0.0",
    "expo-file-system": "~8.0.0",
    "expo-font": "~8.0.0",
    "expo-google-app-auth": "^6.0.0",
    "expo-image-picker": "~8.0.1",
    "expo-linear-gradient": "~8.0.0",
    "expo-permissions": "~8.0.0",
    "graphql": "^14.1.1",
    "lodash.flowright": "^3.5.0",
    "moment": "^2.24.0",
    "react": "16.9.0",
    "react-apollo": "^3.1.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
    "react-native-appearance": "~0.3.1",
    "react-native-aws3-cognito": "0.0.2",
    "react-native-check-box": "^2.1.7",
    "react-native-datepicker": "^1.7.2",
    "react-native-dialog": "^5.6.0",
    "react-native-dotenv": "^0.2.0",
    "react-native-easy-toast": "^1.2.0",
    "react-native-email-link": "^1.7.1",
    "react-native-emoji": "^1.8.0",
    "react-native-gesture-handler": "~1.5.0",
    "react-native-image-view": "^2.1.4",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-modal": "^11.5.3",
    "react-native-modalbox": "^2.0.0",
    "react-native-picker-select": "^6.1.0",
    "react-native-reanimated": "~1.4.0",
    "react-native-safe-area-context": "0.6.0",
    "react-native-screens": "2.0.0-alpha.12",
    "react-native-snap-carousel": "^3.7.5",
    "react-native-svg": "9.13.3",
    "react-native-svg-charts": "^5.2.0",
    "react-native-swipe-list-view": "^2.1.3",
    "react-native-thumbnail-video": "^0.1.2",
    "react-navigation": "^3.11.1",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0",
    "sentry-expo": "^2.0.1",
    "subscriptions-transport-ws": "^0.9.15"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-plugin-react": "^1.0.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "babel-preset-expo": "^5.0.0",
    "detox": "^15.3.0",
    "detox-expo-helpers": "^0.6.0",
    "eslint": "^5.15.1",
    "eslint-config-equimper": "^2.2.2",
    "eslint-config-react-app": "^3.0.7",
    "eslint-plugin-babel": "^5.3.0",
    "eslint-plugin-class-property": "^1.1.0",
    "eslint-plugin-flowtype": "^3.4.2",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-react": "^7.12.4",
    "eslint-plugin-react-native": "^3.6.0",
    "expo-codemod": "^1.0.6",
    "expo-detox-hook": "^1.0.10",
    "jest-expo": "^36.0.1",
    "metro-react-native-babel-preset": "^0.53.1",
    "react-native-testing-library": "^1.12.0",
    "react-test-renderer": "^16.12.0",
    "reactotron-react-native": "^3.2.1",
    "url": "^0.11.0"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|@sentry/.*|sentry-expo|native-base|react-native-multi-slider|@ptomasroos/.*)"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/setupTests.js"
    ],
    "collectCoverage": true,
    "collectCoverageFrom": [
      "**/*.{js,jsx}",
      "!**/coverage/**",
      "!**/node_modules/**",
      "!**/babel.config.js",
      "!**/jest.setup.js"
    ]
  },
  "private": true,
  "detox": {
    "test-runner": "jest",
    "configurations": {
      "ios.sim": {
        "binaryPath": "bin/Exponent.app",
        "type": "ios.simulator",
        "name": "iPhone 8"
      }
    }
  }
}
#!/bin/bash -e

# query expo.io to find most recent ipaUrl
IPA_URL=`curl https://expo.io/--/api/v2/versions |  python -c 'import sys, json; print json.load(sys.stdin)["iosUrl"]'`

# download tar.gz
TMP_PATH=/tmp/exponent.tar.gz
wget -O $TMP_PATH $IPA_URL

# recursively make app dir
APP_PATH=bin/Exponent.app
mkdir -p $APP_PATH

# unzip tar.gz into APP_PATH
tar -C $APP_PATH -xzf $TMP_PATH

Expected Behavior

Travis environment is setup and tests run successfully

Actual Behavior

Tests fail due to what appears to be a missing dependency

ERROR:

    expo-detox-hook is not installed in your osx Library. Run `npm install -g expo-detox-cli && expotox clean-framework-cache && expotox build-framework-cache` to fix this.

Reproducible Demo

Can attempt to provide a demo project if necessary

support[bot] commented 4 years ago

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

Feel free to post your Stack Overflow question here for more visibility. We'll take a look at it.

For issues with Expo apps, it is most likely not an issue with Detox itself, but with the Expo runtime or with incorrect Detox setup. For support on how to use Detox with Expo, you should contact the Expo team or the Expo community.

For more information on bots in this repository, read this discussion.