我正在使用:
react-native 0.61.5
detox 16.2.1
因此,我正在尝试在本机应用程序上修复损坏的排毒android测试运行程序(我认为它们在更新RN后至少已经损坏了一年),事情是我用新的排毒更新了所有文件有关android设置文档的信息,但我遇到了一些甚至还没有发现谷歌搜索的奇怪错误。
首先,我会在文件上随机得到一个错误
android/app/build.gradle
在线
androidTestImplementation "com.wix:detox:+"
尝试并重新安装依赖项后,它将随机开始工作,但随后会出现以下错误:
> Task :app:compileProductionNoTestDevModeOffDebugAndroidTestJavaWithJavac FAILED
/Users/adriansalgado/Documents/debitoor-mobile-next/android/app/src/androidTest/java/com/debitoor.android/DetoxTest.java:24: error: cannot find symbol
Detox.DetoxIdlePolicyConfig idlePolicyConfig = new Detox.DetoxIdlePolicyConfig();
^
symbol: class DetoxIdlePolicyConfig
location: class Detox
/Users/adriansalgado/Documents/debitoor-mobile-next/android/app/src/androidTest/java/com/debitoor.android/DetoxTest.java:24: error: cannot find symbol
Detox.DetoxIdlePolicyConfig idlePolicyConfig = new Detox.DetoxIdlePolicyConfig();
^
symbol: class DetoxIdlePolicyConfig
location: class Detox
2 errors
不确定为什么会发生这种情况,有时它只是起作用。我尝试在runDetoxTests
文件的DetoxTest.java
内注释Detox部分,然后构建成功,它将应用程序加载到模拟器中,但仅返回此错误:
detox[41781] INFO: [test.js] configuration="android.emu.debug.staging" reportSpecs=true readOnlyEmu=false useCustomLogger=true DETOX_START_TIMESTAMP=1594819985890 node_modules/.bin/jest --config test/integration/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 "./test/integration/testFiles"
detox[41782] INFO: [DetoxServer.js] server listening on localhost:65166...
detox[41782] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
{ 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 EmulatorDriver._getInstrumentationCrashError (/Users/adriansalgado/Documents/debitoor-mobile-next/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:175:12)
at EmulatorDriver.instrumentationCloseListener (/Users/adriansalgado/Documents/debitoor-mobile-next/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:142:67)
at EmulatorDriver._terminateInstrumentation (/Users/adriansalgado/Documents/debitoor-mobile-next/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:166:12)
at process._tickCallback (internal/process/next_tick.js:68:7) name: 'DetoxRuntimeError' }
任何人都有任何想法我想念什么?我确定对DetoxTest文件中的内容进行评论是没有用的,但是我不知道该怎么办。
这是我的DetoxTest.java
文件:
package com.debitoor.android;
import com.wix.detox.Detox;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DetoxTest {
@Rule
// Replace 'MainActivity' with the value of android:name entry in
// <activity> in AndroidManifest.xml
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void runDetoxTests() {
Detox.DetoxIdlePolicyConfig idlePolicyConfig = new Detox.DetoxIdlePolicyConfig();
idlePolicyConfig.masterTimeoutSec = 60;
idlePolicyConfig.idleResourceTimeoutSec = 30;
Detox.runTests(mActivityRule, idlePolicyConfig);
}
}