将 Jest 设置为 detox 环境后发出 Hang Detox Test

如何解决将 Jest 设置为 detox 环境后发出 Hang Detox Test

这是我在控制台上遇到的错误,不知道如何解决

 detox test -c Adebug --loglevel verbose   
detox[13529] INFO:  [test.js] DETOX_CONFIGURATION="Adebug" DETOX_FORCE_ADB_INSTALL=false DETOX_LOGLEVEL="verbose" DETOX_READ_ONLY_EMU=false DETOX_REPORT_SPECS=true DETOX_START_TIMESTAMP=1616519506213 DETOX_USE_CUSTOM_LOGGER=true jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e
detox[13530] INFO:  [DetoxServer.js] server listening on localhost:56236...
detox[13530] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:56236
detox[13530] DEBUG: [DetoxServer.js/LOGIN] role=tester,sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36
detox[13530] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester,sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36
detox[13530] DEBUG: [exec.js/EXEC_CMD,#0] "/Users/medsalahbdioui/Library/Android/sdk/emulator/emulator" -list-avds --verbose
detox[13530] DEBUG: [exec.js/EXEC_CMD,#1] "/Users/medsalahbdioui/Library/Android/sdk/emulator/emulator" -version 
detox[13530] DEBUG: [EmulatorVersionResolver.js/EMU_BIN_VERSION_DETECT] Detected emulator binary version { major: 30,minor: 4,patch: 5,toString: [Function: toString] }
detox[13530] DEBUG: [EmulatorDeviceAllocation.js/ALLOCATE_DEVICE] Trying to allocate a device based on "Pixel_3"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#2] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb"  devices
detox[13530] DEBUG: [exec.js/EXEC_SUCCESS,#2] List of devices attached
emulator-16296  device


detox[13530] DEBUG: [FreeDeviceFinder.js/DEVICE_LOOKUP] Found a matching & free device emulator-16296
detox[13530] DEBUG: [EmulatorDeviceAllocation.js/ALLOCATE_DEVICE] Settled on emulator-16296
detox[13530] DEBUG: [exec.js/EXEC_CMD,#3] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "getprop dev.bootcomplete"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#4] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "getprop ro.build.version.sdk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#5] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "settings put global animator_duration_scale 0"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#6] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "settings put global window_animation_scale 0"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#7] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "settings put global transition_animation_scale 0"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#8] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
detox[13530] DEBUG: [exec.js/EXEC_CMD,#9] "/Users/medsalahbdioui/Library/Android/sdk/build-tools/30.0.3/aapt" dump badging "/Users/medsalahbdioui/reactProjects/dailyPso/android/app/build/outputs/apk/dev/debug/app-dev-debug.apk" | grep -e "package: name="
detox[13530] DEBUG: [exec.js/EXEC_CMD,#10] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "am force-stop fr.infostrates.dailypsodev"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#11] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm list packages fr.infostrates.dailypsodev"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#12] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 uninstall fr.infostrates.dailypsodev
detox[13530] DEBUG: [exec.js/EXEC_CMD,#13] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm list packages fr.infostrates.dailypsodev.test"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#14] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 uninstall fr.infostrates.dailypsodev.test
detox[13530] DEBUG: [exec.js/EXEC_CMD,#15] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "rm -fr /data/local/tmp/detox"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#16] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "mkdir -p /data/local/tmp/detox"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#17] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 push "/Users/medsalahbdioui/reactProjects/dailyPso/android/app/build/outputs/apk/dev/debug/app-dev-debug.apk" "/data/local/tmp/detox/Application.apk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#18] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#19] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 push "/Users/medsalahbdioui/reactProjects/dailyPso/android/app/build/outputs/apk/androidTest/dev/debug/app-dev-debug-androidTest.apk" "/data/local/tmp/detox/Test.apk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#20] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm install -r -g -t /data/local/tmp/detox/Test.apk"
detox[13530] INFO:  Example is assigned to emulator-16296 (Pixel_3)
detox[13530] DEBUG: [exec.js/EXEC_CMD,#21] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "am force-stop fr.infostrates.dailypsodev"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#22] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "date +\"%m-%d %T.000\""
detox[13530] DEBUG: [exec.js/EXEC_CMD,#23] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 reverse tcp:56236 tcp:56236
detox[13530] DEBUG: [exec.js/EXEC_CMD,#24] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm list instrumentation"
detox[13530] DEBUG: [exec.js/SPAWN_CMD,#25] [pid=13561] /Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb -s emulator-16296 shell am instrument -w -r -e detoxServer ws://localhost:56236 -e detoxSessionId 3529d3cf-9fa0-d471-2c8e-738e1be0eb36 -e debug false fr.infostrates.dailypsodev.test/androidx.test.runner.AndroidJUnitRunner
detox[13530] DEBUG: [exec.js/EXEC_CMD,#26] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""
detox[13530] ERROR: [exec.js/EXEC_FAIL,#26] ""/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""" failed with error = ChildProcessError: Command failed: "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""
 `"/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""` (exited with error code 1) (code=1),stdout and stderr:

detox[13530] ERROR: [exec.js/EXEC_FAIL,#26] 
detox[13530] ERROR: [exec.js/EXEC_FAIL,#26] 
detox[13530] DEBUG: [exec.js/EXEC_CMD,#27] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""
detox[13530] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected,cannot fw action (sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36)
detox[13530] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected,cannot fw action (sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36)
detox[13530] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 13561]: /Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb -s emulator-16296 shell am instrument -w -r -e detoxServer ws://localhost:56236 -e detoxSessionId 3529d3cf-9fa0-d471-2c8e-738e1be0eb36 -e debug false fr.infostrates.dailypsodev.test/androidx.test.runner.AndroidJUnitRunner
detox[13530] DEBUG: [exec.js/EXEC_CMD,#28] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 reverse --remove tcp:56236
detox[13530] INFO:  Example: should have welcome screen
detox[13530] INFO:  Example: should have welcome screen [FAIL]

detox[13530] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = -1000) isReady: {}

Unresponded network requests might result in timeout errors in Detox tests.

detox[13530] DEBUG: [DetoxServer.js/DISCONNECT] role=tester,sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36
detox[13530] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
 FAIL  e2e/firstTest.e2e.js (18.393 s)
  Example
    ✕ should have welcome screen (1 ms)

  ● Example › should have welcome screen

    DetoxRuntimeError: Failed to run application on the device

    HINT: Most likely,your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.

      at MonitoredInstrumentation._getInstrumentationCrashError (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:68:12)
      at MonitoredInstrumentation._rejectPendingCrashPromise (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:56:37)
      at MonitoredInstrumentation._onInstrumentationTerminated (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:51:10)
      at Instrumentation._onTerminated (../node_modules/detox/src/devices/drivers/android/tools/Instrumentation.js:52:18)

detox[13529] ERROR: [cli.js] Command failed: jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e

在我的 .detoxrc.json 文件上有这个配置

{  
  "testRunner": "jest","runnerConfig": "e2e/config.json","devices": {
    "android.attached": {
            "type": "android.attached","device": {
                "adbName": "278a2cdd6e1c7ece"
            }
        },"emulator": {
      "type": "android.emulator","device": {
        "avdName": "Pixel_3"
      }
    },"simulator":{
    
        "type": "ios.simulator","device": {
          "type": "iPhone 12"
        }
  }
},"apps": {
    "android.debug": {
      "type": "android.apk","binaryPath": "android/app/build/outputs/apk/dev/debug/app-dev-debug.apk","build": "cd android && ./gradlew assembleDebug  -DtestBuildType=debug && cd .."
    },"android.release": {
      "type": "android.apk","binaryPath": "android/app/build/outputs/apk/release/app-release.apk","build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd .."
    },"ios.debug": {
      "type": "ios.app","binaryPath": "ios/staging.app","build": "xcodebuild -workspace ios/dailypso.xcworkspace -configuration Debug -sdk iphonesimulator -scheme staging -derivedDataPath ios/build"
    },"ios.release": {
      "type": "ios.app","build": "xcodebuild -workspace ios/detox_poc.xcworkspace -configuration Debug -sdk iphonesimulator -scheme detox_poc -derivedDataPath ios/build"
    }
  },"configurations": {
    "android.attached":{
      "device":"android.attached","app": "android.debug"
    },"Adebug": {
      "device": "emulator","Arelease": {
      "device": "emulator","app": "android.release"
    },"Idebug": {
      "device": "simulator","app": "ios.debug"
    },"Irelease": {
      "device": "simulator","app": "ios.release"
    }
  }
}

使用这些版本的软件包

本机反应:“0.63.4” 开玩笑:“^26.6.3”

只想从简单的测试代码开始 e2e/.firstTest.e2e.js

describe('Example',() => {
  beforeAll(async () => {
    await device.launchApp();
  });

  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should have welcome screen',async () => {
    await expect(element(by.id('welcome'))).toBeVisible();
  });

});

最后这个 android/build.gradle 配置

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 18
        compileSdkVersion = 27
        targetSdkVersion = 27
        kotlinVersion = '1.4.20'
        // firebaseMessagingVersion = "21.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        classpath('com.google.gms:google-services:4.3.4')
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

任何想法???!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)> insert overwrite table dwd_trade_cart_add_inc > select data.id, > data.user_id, > data.course_id, > date_format(
错误1 hive (edu)> insert into huanhuan values(1,'haoge'); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive> show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 <configuration> <property> <name>yarn.nodemanager.res