如何解决应用程序未响应以下网络请求:在运行排毒测试时 (Detox + Jest)
我的设置
排毒:18.0.0 开玩笑:26.6.3 反应原生cli:2.0.1 节点:14.15.4 npm : 6.14.10 纱线:1.22.10 操作系统:Ubuntu 18.04 真实连接设备:Samsung M 01
My init.js
const detox = require('detox');
const adapter = require('detox/runners/jest/adapter');
const specReporter = require('detox/runners/jest/specReporter');
// Set the default timeout
jest.setTimeout(2000);
jasmine.getEnv().addReporter(adapter);`enter code he`enter code here`re`
// This takes care of generating status logs on a per-spec basis. By default,jest only reports at file-level.
// This is strictly optional.
jasmine.getEnv().addReporter(specReporter);
beforeAll(async () => {
await detox.init();
device.launchApp();
},300000);
beforeEach(async () => {
try {
await adapter.beforeEach();
} catch (err) {
// Workaround for the 'jest-jasmine' runner (default one): if 'beforeAll' hook above fails with a timeout,// unfortunately,'jest' might continue running other hooks and test suites. To prevent that behavior,// adapter.beforeEach() will throw if detox.init() is still running; that allows us to run detox.cleanup()
// in that emergency case and disable calling 'device','element','expect','by' and other Detox globals.
// If you switch to 'jest-circus' runner,you can omit this try-catch workaround at all.
await detox.cleanup();
throw err;
}
});
afterAll(async () => {
await adapter.afterAll();
await detox.cleanup();
});
My Package.json :
"detox": {
"configurations": {
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk","build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..","type": "android.attached","device": {
"adbName":"R9BN90441KJ"
}
},"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk","build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..","type": "android.emulator","name": "Test Kirana"
}
},"specs": "e2e","test-runner": "jest"
},"rnpm": {
"assets": [
"android/app/src/main/assets/fonts/Roboto/Roboto-Regular.ttf"
]
}
请在下面找到错误消息:
detox[10532] WARN:[Client.js/PENDING_REQUESTS] 应用没有响应以下网络请求:
提示:很可能,您的测试在等待来自检测过程的“就绪”消息(通过 WebSocket)时已超时并调用了 detox.cleanup()。
(使用 node --trace-warnings ...
显示警告的创建位置)
测试运行完成后,Jest 没有退出一秒。
detox[10520] 错误:[cli.js] 错误:命令失败:jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e/01-placeorder_from_all_page.spec.js
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。