【问题标题】:how to give custom test files path for detox e2e testing如何为排毒 e2e 测试提供自定义测试文件路径
【发布时间】:2018-09-21 07:44:38
【问题描述】:

我们正在使用 Detox 框架进行 IOS e2e 测试。 Detox 默认创建 e2e 文件夹并运行在其下创建的所有测试文件。

有什么方法可以在其他文件夹中创建测试文件并配置该路径并运行它?

【问题讨论】:

    标签: react-native jestjs ios-ui-automation detox


    【解决方案1】:

    是的,你可以设置测试的路径

    由于只支持MochaJest,因此如API中所述

    在你的 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"
        }
    

    config.json 是this

    【讨论】:

    • 感谢它对我有用。我必须将 config.json 和 spec 文件放在同一个文件夹中。
    【解决方案2】:

    开玩笑的例子:

    "detox": {
        "test-runner": "jest",
        "runner-config": "e2e/config.json" // default
        "configurations": {
          ...
        }
    }
    

    config.json 示例:

    {
        ...
        "roots": ["../src/..../e2e"],
        "testMatch": [  
          "**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)" // default
        ]
    }
    

    【讨论】:

      猜你喜欢
      • 2020-11-05
      • 1970-01-01
      • 2019-08-04
      • 2013-01-24
      • 1970-01-01
      • 2018-05-13
      • 1970-01-01
      • 1970-01-01
      • 2012-01-16
      相关资源
      最近更新 更多