reactjs - 排毒 e2e 测试分配给未定义并跳过所有测试
问题描述
在我们的 react-native 项目中,我们使用 detox 进行 e2e 测试。这些工作正常,直到突然我们体验到测试套件被分配给未定义。奇怪的是,在将任何更改恢复到之前排毒工作的状态时,这个问题仍然存在。该问题存在于 iOS 和 Android 配置中。
(这个问题与这个问题类似,但是,到目前为止,detox 应该适用于我们的 react native 版本。)
我的 detoxrc.json
:
{
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"configurations": {
"ios": {
"type": "ios.simulator",
"binaryPath": "ios/build/Build/Products/Test-iphonesimulator/Cliniserve One.app",
"build": "xcodebuild -workspace ios/shiftapp.xcworkspace -scheme shiftapp.test -configuration Test -sdk iphonesimulator -derivedDataPath ios/build",
"device": {
"type": "iPhone 11"
}
},
"android": {
"type": "android.emulator",
"binaryPath": "android/app/build/outputs/apk/development/debug/shiftapp_development_debug.apk",
"build": "cd android && ./gradlew assembleDevelopmentDebug assembleDevelopmentDebugAndroidTest -DtestBuildType=debug && cd ..",
"device": {
"avdName": "Pixel_API_29_AOSP"
}
}
}
}
我的e2e/config.json
{
"setupFilesAfterEnv" : ["./init.js"],
"testEnvironment": "./environment",
"testRunner": "jest-circus/runner",
"testTimeout": 120000,
"testRegex": "\\.e2e\\.js$",
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true
}
和e2e/environment.js
const {
DetoxCircusEnvironment,
SpecReporter,
WorkerAssignReporter,
} = require('detox/runners/jest-circus');
class CustomDetoxEnvironment extends DetoxCircusEnvironment {
constructor(config) {
super(config);
// Can be safely removed, if you are content with the default value (=300000ms)
this.initTimeout = 300000;
// This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
// This is strictly optional.
this.registerListeners({
SpecReporter,
WorkerAssignReporter,
});
}
}
module.exports = CustomDetoxEnvironment;
任何关于如何让它再次工作的帮助或想法将不胜感激。
解决方案
推荐阅读
- json - 如何在 mule4 中使用 Dataweave 从 json 中删除键值对
- api - 有没有办法从 Walmart API 获取有关其他卖家产品的信息?
- reactjs - 使用 Yup 和 React 表单挂钩时有多个模式?
- java - 错误2:当我将jar作为windows服务运行时,系统找不到指定的文件
- javascript - 如何使用类选择器定位最后一个 div 项
- python - Django_Crontab 似乎没有运行
- exception - 使用回退队列时,我们如何保持对客户端的一致读取承诺?
- javascript - AG Grid 单元格编辑器,具有来自 API 的动态参数和数据绑定
- apache-spark - 通过 apache livy 进行的 hudi delta 流媒体作业
- c# - 关于WCF的两个问题