react-native - 在测试开始排毒之前重新启动应用程序
问题描述
React Native 应用程序在运行 Detox e2e 测试套件之前重新启动。最初,它显示应用程序的第一个屏幕并重新启动应用程序测试套件。
这种行为的问题在于,当我尝试在 com.bitbar.com 设备农场服务门户上运行测试套件时,测试用例成功运行,而它必须失败并将日志写入文件。
我在本地对其进行了测试,如果我们不尝试将记录记录到日志文件中,那么它会成功运行应用程序,但是如果我们尝试将记录记录到日志文件中,那么测试用例首先会停止(不必要的)屏幕启动,使测试用例通过。如何停止排毒测试用例的这种行为。
测试用例:
describe('Example', () => {
it('Login Screen, Logging into the app', async () => {
await device.reloadReactNative();
await element(by.id(TestIDs.LoginScreen.usernameInput)).typeText('+1234567890');
await element(by.id(TestIDs.LoginScreen.passwordInput)).typeText('0123');
await Expect(element(by.id('not found'))).toBeVisible();
await Expect(element(by.id(TestIDs.LoginScreen.submitButton))).toBeVisible();
// await element(by.id(TestIDs.LoginScreen.submitButton)).tap();
})
命令运行测试而不将日志保存到
detox test --configuration android.emu.debug -l verbose
命令运行测试并将日志保存到
"detox test --configuration android.emu.debug -l verbose > detox.log 2>&1 "
日志
`
send: {"type":"isReady","params":{},"messageId":-1000}
INSTRUMENTATION_STATUS: class=com.mobile.repletehealth.DetoxTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.mobile.repletehealth.DetoxTest:
INSTRUMENTATION_STATUS: test=runDetoxTests
INSTRUMENTATION_STATUS_CODE: 1
nstrumentation stdout:
onMessage: {"messageId":-1000,"type":"ready","params":{}}
rbx
send: {"type":"reactNativeReload","params":{},"messageId":-1000}
onMessage: {"messageId":-1000,"type":"ready","params":{}}
rbx
send: {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"android.support.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["usernameInput"]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"android.support.test.espresso.action.ViewActions"},"method":"typeText","args":["+1234567890"]}}]},"messageId":1}
onMessage: {"messageId":1,"type":"invokeResult","params":{"result":"(null)"}}
rbx
send: {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"android.support.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["passwordInput"]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"android.support.test.espresso.action.ViewActions"},"method":"typeText","args":["0123"]}}]},"messageId":2}
onMessage: {"messageId":2,"type":"invokeResult","params":{"result":"(null)"}}
rbx
send: {"type":"cleanup","params":{"stopRunner":true},"messageId":3}
onMessage: {"messageId":3,"type":"cleanupDone","params":{}}`
解决方案
推荐阅读
- azure - 如何将 azure blob 设置为 Azure 中托管的 Open shift 群集中的持久存储
- sql - postgresql:从列表中的非表表达式?
- android - 如何管理 InApp 购买订阅恢复用例?
- android - Android:使用系统签名登录安卓应用
- windows - 如何使用 PowerShell 列出我附近的蓝牙设备
- java - 基于另一个集合创建新的 ArrayList
- android - 我可以只将图像放在 xxhdpi 文件夹中吗
- wso2 - WSO2 中的 contentType binary/x-gzip 是否有可用的 messageFormater 或 messageBuilder?
- r - 将类似列表的对象转换为带有列的数据框
- php - RBAC 总是返回异常