Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading images with jest and detox #263

Closed
SMJ93 opened this issue Sep 5, 2017 · 7 comments
Closed

Error loading images with jest and detox #263

SMJ93 opened this issue Sep 5, 2017 · 7 comments

Comments

@SMJ93
Copy link
Contributor

SMJ93 commented Sep 5, 2017

Description

We have installed detox and have set it up to run with Jest using help from this issue.

The app runs fine through xcode and when running react-native run-ios through the command line, but when running through detox we get the following error:

Missing request token for request:
<NSMutableURLRequest:
0x61000000d980> { URL: http://localhost:8081/assets/node_modules/interface/assets/header.png?platform=ios&hash=######HASH######

There seems to a problem loading assets with detox. If I reload the app it loads as expected.

Steps to Reproduce

Setup detox with Jest using the issue above. Run a React Native app which uses images.

  • Node: 8.1.0
  • Device: iPhone 6 10.3
  • Xcode: 9 beta
  • macOS: Sierra 10.12.6
  • React Native version: 0.47.2
@LeoNatan
Copy link
Contributor

LeoNatan commented Sep 5, 2017

Could this be related to this?
facebook/react-native#10553

The comments there are not encouraging.

same on RN 0.46.4, random happen.

random happen.reload again

This issue is occurring for me as well.

@SMJ93
Copy link
Contributor Author

SMJ93 commented Sep 6, 2017

@LeoNatan Yeah I saw that, but it's weird how this issue only occurs when running detox tests. We've never had this problem running the app on Android or iOS.

@LeoNatan
Copy link
Contributor

LeoNatan commented Sep 6, 2017

I am not really an RN guy, so I cannot really help here. Just tried to look for the issue. In that FB issue, there is no real explanation why it happens so that I could think what could be happening that detox might be doing. I don’t see detox in any of those flows, so I doubt it has anything to do with this issue, but I will keep the issue open for now until there is a clearer explanation what’s going on.

If you can provide a demo project where this reproduces, please attach it here.

@SMJ93
Copy link
Contributor Author

SMJ93 commented Sep 6, 2017

We fixed this issue by updating the detox configuration to run in Release mode in the package.json:

"detox": {
  "configurations": {
    "ios.sim.release": {
      "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/Devlyfe.app",
      "build": "xcodebuild -project ios/homelyfeMobile.xcodeproj -scheme Devlyfe -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
      "type": "ios.simulator",
      "name": "iPhone 6"
    }
  }
},

@SMJ93 SMJ93 closed this as completed Sep 6, 2017
@Obooman
Copy link

Obooman commented Oct 25, 2017

update configuration from debug to release is totally not a solution, rebuild a release app is painful.Any other suggestions?

@SMJ93
Copy link
Contributor Author

SMJ93 commented Oct 25, 2017

@Obooman it seems to be a problem with Jest on iOS. The solution maybe mocking images.

We managed to get both iOS and Android running with mocha and Detox 5.9.1.

I've tried using Jest as a test runner - see here, but have encountered a few problems compared to using it with Mocha #362.

I will try to investigate further and let you know if I find a fix.

@Obooman
Copy link

Obooman commented Oct 26, 2017

I'm using Mocha as my test runner and also crash into this issue.Each time detox uninstalls and reinstalls my app the error will be reproduced, while with --reuse flag the issue comes up much less often.Waiting for good news.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants