【问题标题】:Setup Wix/Detox - run their react native example设置 Wix/Detox - 运行他们的 react native 示例
【发布时间】:2021-01-17 23:03:19
【问题描述】:

Wix 的 Detox 看起来是一个非常有用的工具,我一直渴望尝试一下。尝试关注README in the demo-react-native folder,但我认为它有点过时了。

如上所述,我无法让它工作。这是我认为自述文件中缺少的内容

  • npm install -g detox-cli - 丢失

  • detox init --runner jest - 丢失

我已尝试将我的.detoxrc.json 设置为

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

但是在一个终端中运行 npm startdetox build -c ios 会抛出这个

$ 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] }

运行 detox build --configuration ios.sim.release(如 README 中所述)会抛出:

$ 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

会为我认为缺少的东西做一个 PR,但想确保它首先能正常工作 - 我无法做到。

任何帮助将不胜感激

【问题讨论】:

    标签: javascript react-native testing jestjs detox


    【解决方案1】:

    请注意,不再为 iOS 维护演示项目。您最好创建一个新的 RN 项目,按照我们的文档集成 Detox,然后开始添加您的第一个测试。

    【讨论】:

    • 感谢您的回复。只是当前的 README 链接到这个演示文件夹。看不到任何声明它们已被弃用。这是您所指的排毒文档吗github.com/wix/Detox/blob/master/docs/…
    • 我指的是我作为 Detox for iOS 的唯一维护者的心态。 ?
    • 它看起来像一个很棒的项目,我很想尝试一下。但是我的自制软件在尝试安装时搞砸了,自制软件帮不了我。不幸的是,这将是其他时间
    • 您的自制软件安装已损坏。我建议不管排毒如何解决这个问题,因为很多软件都依赖于 macOS。
    • 我同意这一点,并努力弄清楚如何解决这个问题
    猜你喜欢
    • 2018-10-24
    • 2018-03-11
    • 2020-03-07
    • 2021-01-07
    • 1970-01-01
    • 2015-06-02
    • 2021-05-10
    • 2019-10-19
    • 1970-01-01
    相关资源
    最近更新 更多