Tic*_*acV 7 react-native react-native-ios detox
尝试为示例反应本机应用程序运行基本的 detox e2e。我正在关注这个博客。
但是 stepdetox test不运行测试。它只是挂在模拟器中(在 detox init 阶段),并且由于超时而失败。
有谁知道如何解决它?或者有人有任何排毒的工作样本吗?
排毒、节点、设备、Xcode 和 macOS 版本
detox 16.2.0 节点 v10.16.0 macOs 10.13.6 High Sierra Xcode 版本 10.1
错误:
detox test
detox[89159] INFO: [test.js] configuration="ios.release" reportSpecs=true useCustomLogger=true DETOX_START_TIMESTAMP=1586928640139 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"
detox[89160] INFO: [DetoxServer.js] server listening on localhost:57696...
detox[89160] INFO: [AppleSimUtils.js] org.reactjs.native.example.testAM launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn 52AC48F5-EC9A-4423-8947-11EB05E187E7 log stream --level debug --style compact --predicate 'process == "testAM"'
detox[89160] INFO: Example: should have "Step One" section
detox[89160] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
{ DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
at Detox.[_assertNoPendingInit] (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22) name: 'DetoxRuntimeError' }
detox[89160] 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[89160] INFO: Example: should have "Step One" section [FAIL]
detox[89160] INFO: Example: should have "See Your Changes" section
detox[89160] INFO: Example: should have "See Your Changes" section [FAIL]
FAIL e2e/firstTest.spec.js (301.625s)
Example
? should have "Step One" section (20ms)
? should have "See Your Changes" section (3ms)
? Example › should have "Step One" section
Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.
at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:27:45)
? Example › should have "Step One" section
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
? Example › should have "Step One" section
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
? Example › should have "Step One" section
DetoxRuntimeError: Detox instance has not been initialized
HINT: There was an error on attempt to call detox.init()
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
1 | describe('Example', () => {
2 | beforeEach(async () => {
> 3 | await device.reloadReactNative();
| ^
4 | });
5 |
6 | it('should have "Step One" section', async () => {
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
at device (../node_modules/detox/src/utils/MissingDetox.js:46:16)
at _callee$ (firstTest.spec.js:3:11)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
at ../node_modules/regenerator-runtime/runtime.js:170:11
at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
at Object._callee (firstTest.spec.js:2:14)
? Example › should have "Step One" section
DetoxRuntimeError: Detox instance has not been initialized
HINT: There was an error on attempt to call detox.init()
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
4 | });
5 |
> 6 | it('should have "Step One" section', async () => {
| ^
7 | await expect(element(by.text('Step One'))).toBeVisible();
8 | });
9 |
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
at get (../node_modules/detox/src/utils/MissingDetox.js:46:16)
at _callee2$ (firstTest.spec.js:6:40)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
at ../node_modules/regenerator-runtime/runtime.js:170:11
at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
at Object._callee2 (firstTest.spec.js:6:40)
? Example › should have "See Your Changes" section
Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.
at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:27:45)
? Example › should have "See Your Changes" section
DetoxRuntimeError: Detox instance has not been initialized
HINT: There was an error on attempt to call detox.init()
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
at MissingDetox._defineRequiredProperty (../node_modules/detox/src/utils/MissingDetox.js:8:71)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
? Example › should have "See Your Changes" section
DetoxRuntimeError: Detox instance has not been initialized
HINT: There was an error on attempt to call detox.init()
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
1 | describe('Example', () => {
2 | beforeEach(async () => {
> 3 | await device.reloadReactNative();
| ^
4 | });
5 |
6 | it('should have "Step One" section', async () => {
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
at device (../node_modules/detox/src/utils/MissingDetox.js:46:16)
at _callee$ (firstTest.spec.js:3:11)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
at ../node_modules/regenerator-runtime/runtime.js:170:11
at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
at Object._callee (firstTest.spec.js:2:14)
? Example › should have "See Your Changes" section
DetoxRuntimeError: Detox instance has not been initialized
HINT: There was an error on attempt to call detox.init()
DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
8 | });
9 |
> 10 | it('should have "See Your Changes" section', async () => {
| ^
11 | await expect(element(by.text('See Your Changes'))).toBeVisible();
12 | });
13 | });
at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
at get (../node_modules/detox/src/utils/MissingDetox.js:46:16)
at _callee3$ (firstTest.spec.js:10:48)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
at ../node_modules/regenerator-runtime/runtime.js:170:11
at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
at Object._callee3 (firstTest.spec.js:10:48)
detox[89159] ERROR: [cli.js] Error: Command failed: node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"
Run Code Online (Sandbox Code Playgroud)
小智 0
我在 GitHub 操作流程上遇到了同样的错误,
为了解决这个问题,我更改了模拟器设备(Nexus -> Pixel -> 等..)并更改了 android api 版本直到它起作用,
这有点令人沮丧,但这对我有帮助(最终它在带有 Android api 31(默认)的 Nexus 6 上对我有用。
我认为您也可以尝试在主流程文件(我的是mine.test.js)中添加jest.setTimeout(120000)测试函数之前。
我能想到的另一个解决方案是最初添加“重新加载”
beforeAll(async () => {
await device.launchApp({ newInstance: true })
await device.reloadReactNative()})
Run Code Online (Sandbox Code Playgroud)
我希望你们发现其中一些有帮助,如果没有任何效果,可能会重新安装 Detox 并更严格地遵循文档,
我认为这可能与版本有关。
| 归档时间: |
|
| 查看次数: |
864 次 |
| 最近记录: |