首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bitrise + Detox +React本机- Hello示例挂在detox.init上

Bitrise + Detox +React本机- Hello示例挂在detox.init上
EN

Stack Overflow用户
提问于 2019-11-11 19:16:29
回答 1查看 778关注 0票数 3

我正在尝试使用Detox进行react原生的"Hello“应用程序设置,并在Bitrise.io上运行。我浏览了react-本机-cli入门指南,并尝试使用detox + Jest在Detox上运行最简单的解毒测试。

我遇到的具体错误是没有定义deviceelement全局值(请参阅日志或下面的链接)。据我迄今所研究,这是由detox.init从来没有完成。

是否有一些基本的配置与Bitrise,我错过了?detox test命令在本地运行非常好。

我正在使用一个免费的Bitrise帐户,这个项目是公开的。您可以在这里看到一个失败的构建:https://app.bitrise.io/build/e7926ddfc759288f#?tab=log

回购也是公开的:detox/AwesomeProject/e2e/firstTest.spec.js

提前感谢!

位升错误日志

代码语言:javascript
复制
Example: should have welcome screen
Example: should have welcome screen [FAIL]
FAIL e2e/firstTest.spec.js (122.008s)
  Example
    ✕ should have welcome screen (8ms)
  ● Example › should have welcome screen
    Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.
      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)
  ● Example › should have welcome screen
    ReferenceError: device is not defined
      1 | describe('Example', () => {
      2 |   beforeEach(async () => {
    > 3 |     await device.reloadReactNative();
        |           ^
      4 |   });
      5 | 
      6 |   it('should have welcome screen', async () => {

bitrise.yml

代码语言:javascript
复制
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: react-native
trigger_map:
- push_branch: "*"
  workflow: primary
- pull_request_source_branch: "*"
  workflow: primary
workflows:
  deploy:
    description: "## ..."
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@4.0.17: {}
    - script@1.1.5:
        title: Do anything with Script step
    - yarn@0.1.0:
        inputs:
        - workdir: AwesomeProject
        - command: install
    - install-missing-android-tools@2.3.7:
        inputs:
        - gradlew_path: "$PROJECT_LOCATION/gradlew"
    - android-build@0.10.0:
        inputs:
        - project_location: "$PROJECT_LOCATION"
    - certificate-and-profile-installer@1.10.1: {}
    - xcode-archive@2.7.0:
        inputs:
        - project_path: "$BITRISE_PROJECT_PATH"
        - scheme: "$BITRISE_SCHEME"
        - export_method: "$BITRISE_EXPORT_METHOD"
        - configuration: Release
    - deploy-to-bitrise-io@1.9.2: {}
  primary:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@4.0.17: {}
    - yarn@0.1.0:
        inputs:
        - workdir: AwesomeProject
        - command: install
        title: Yarn Install
    - yarn@0.1.0:
        inputs:
        - workdir: AwesomeProject
        - command: test
        title: Unit tests
    after_run:
    - detox
  detox:
    steps:
    - cocoapods-install@1.9.1:
        inputs:
        - source_root_path: "$BITRISE_SOURCE_DIR/AwesomeProject/ios"
    - npm@1.1.0:
        title: Install Global
        inputs:
        - workdir: "$BITRISE_SOURCE_DIR/AwesomeProject"
        - command: install -g detox-cli react-native-cli
    - script@1.1.5:
        inputs:
        - working_dir: "$BITRISE_SOURCE_DIR/AwesomeProject"
        - content: |-
            #!/usr/bin/env bash

            brew tap facebook/fb
            export CODE_SIGNING_REQUIRED=NO
            brew install fbsimctl
            brew tap wix/brew
            brew install applesimutils --HEAD
        title: Install detox utils
    - script@1.1.5:
        inputs:
        - working_dir: "$BITRISE_SOURCE_DIR/AwesomeProject"
        - content: |-
            #!/usr/bin/env bash

            detox build --configuration ios.sim.debug
        title: Detox Build
    - script@1.1.5:
        inputs:
        - working_dir: "$BITRISE_SOURCE_DIR/AwesomeProject"
        - content: |-
            #!/usr/bin/env bash

            detox test --configuration ios.sim.debug --cleanup
        title: Detox Test
app:
  envs:
  - opts:
      is_expand: false
    PROJECT_LOCATION: AwesomeProject/android
  - opts:
      is_expand: false
    MODULE: app
  - opts:
      is_expand: false
    VARIANT: ''
  - opts:
      is_expand: false
    BITRISE_PROJECT_PATH: AwesomeProject/ios/AwesomeProject.xcworkspace
  - opts:
      is_expand: false
    BITRISE_SCHEME: AwesomeProject
  - opts:
      is_expand: false
    BITRISE_EXPORT_METHOD: ad-hoc
meta:
  bitrise.io:
    machine_type: elite
EN

回答 1

Stack Overflow用户

发布于 2021-11-23 04:08:04

不幸的是,这是一个非常通用的错误,可能是由多种原因引起的(不兼容的OS/jest + detox版本/node+ detox版本等等)。

如果您正在使用MacOS,您可以使用的一个选项是通过屏幕共享连接Bitrise的VM中出现的问题:我建议在包安装步骤(节点、排毒、jest等)之后,在当前的工作流中添加一个while someFileDoesntExist (在没有中止按钮的情况下自然停止迭代),然后检查它是否是在本地运行的。

如果情况并非如此,请检查VM是否运行相同的模拟器--电话模型& OS版本;如果没有,则可以在排毒配置中指定模拟器和OS版本。

如果这也不起作用,我不知道会是什么样子:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58807362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档