react-nativejestjsios-ui-automationdetox

how to give custom test files path for detox e2e testing


We are using Detox framework for IOS e2e testing. Detox by default created e2e folder and run all test files created under it.

Is there any way I can create the test files on some other folder and configure that path and run it?


Solution

  • Yes, you can set the path of the tests

    As Mocha and Jest are only supported, therefore as mentioned in the API

    In your package.json

    // For Mocha
    
    "detox": {
          ...
          "test-runner": "mocha"
          "runner-config": "path/to/mocha.opts"
          "specs": "path/to/tests/root"
        }
    
    // For Jest
    
    "detox": {
          ...
          "test-runner": "jest"
          "runner-config": "path/to/config.json"
        }
    

    where config.json is this