Setup Wix/Detox - run their react native example

2.4k views Asked by At

Detox from Wix looks like a VERY useful tool and I have been eager to try it out. Tried to follow the README in the demo-react-native folder but I think it's a bit outdated.

As mentioned I cant get it to work. Here is what I believe is missing in the README

  • npm install -g detox-cli - missing

  • detox init --runner jest - missing

I have tried to set my .detoxrc.json to

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "configurations": {
    "ios": {
      "type": "ios.simulator",
      "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
      "device": {
        "type": "iPhone 11"
      }
    }
  }
}

But running npm start in one terminal and detox build -c ios throws this

$ detox build -c ios
detox[89936] ERROR: [cli.js] DetoxConfigError: Could not find a build script inside "ios" configuration.
detox[89936] ERROR: [cli.js] 
detox[89936] ERROR: [cli.js] HINT: Check contents of your Detox config at path:
detox[89936] ERROR: [cli.js] /Users/norfeldt/Desktop/Detox/examples/demo-react-native/.detoxrc.json
detox[89936] ERROR: [cli.js] 
detox[89936] ERROR: [cli.js] {
detox[89936] ERROR: [cli.js]   configurations: {
detox[89936] ERROR: [cli.js]     ios: {
detox[89936] ERROR: [cli.js]       type: 'ios.simulator',
detox[89936] ERROR: [cli.js]       binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/example.app',
detox[89936] ERROR: [cli.js]       device: [Object]
detox[89936] ERROR: [cli.js]     }
detox[89936] ERROR: [cli.js]   }
detox[89936] ERROR: [cli.js] }

running detox build --configuration ios.sim.release (as stated in the README) throws this:

$ detox build --configuration ios.sim.release
detox[91765] ERROR: [cli.js] DetoxConfigError: Failed to find a configuration named "ios.sim.release" in Detox config at path:
detox[91765] ERROR: [cli.js] /Users/norfeldt/Desktop/Detox/examples/demo-react-native/.detoxrc.json
detox[91765] ERROR: [cli.js] 
detox[91765] ERROR: [cli.js] HINT: Below are the configurations Detox was able to find:
detox[91765] ERROR: [cli.js] * ios

Would have made a PR for the things I think is missing it but want to make sure it all works first - which I can't get it to.

Any help would be appreciated

1

There are 1 answers

5
Léo Natan On BEST ANSWER

Please note that the demo projects are no longer maintained for iOS. You are better off creating a new RN project, integrating Detox following our documentation, and start adding your first test.