我的排毒设置在 Android 上运行良好,但在 iOS 上有问题。
问题是从 Metro 捆绑程序加载捆绑包后,应用程序卡在启动/启动屏幕上。排毒记录不多:
App has not responded to the network requests below:
(id = -1000) isReady: {}
Unresponded network requests might result in timeout errors in Detox tests.
设置如下:
.detoxrc.json
...
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/<app_name>.app",
"build": "xcodebuild -workspace ios/<project_name>.xcworkspace -scheme <scheme> -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"device": {
"type": "iPhone 11 Pro"
}
},
...
e2e/Login.e2e.js
const detox = require('detox');
const config = require('../.detoxrc.json');
describe('Login', () => {
beforeAll(async () => {
await detox.init(config, { launchApp: false });
await device.launchApp({
newInstance: true,
launchArgs: { detoxPrintBusyIdleResources: 'YES' },
permissions: {
notifications: 'YES',
camera: 'YES',
medialibrary: 'YES',
photos: 'YES',
microphone: 'YES',
},
});
});
beforeEach(async () => {
// await device.reloadReactNative();
});
it('should be able to login successfully', async () => {
await element(by.id('EmailInput')).typeText('email\n');
await element(by.id('PasswordInput')).typeText('pass\n');
await element(by.id('LoginButton')).tap();
});
it('should display the welcome screen after the login', async () => {
await expect(element(by.id('WelcomeScreen'))).toBeVisible();
});
});
观察 EarlGrey 日志的命令,但不记录单个字符:
xcrun simctl spawn booted log stream --level debug --style compact --predicate "category=='EarlGreyStatistics'"
我现在真的绞尽脑汁想弄清楚为什么应用程序卡住了以及为什么我没有收到任何日志,非常感谢您的帮助。
环境:
机器:
MacOS: 10.15.5
XCode: 11.6
applesimutils: 0.8
Node: 12.18.1
detox-cli: 17.1.0
项目:
"react": "16.11.0",
"react-native": "0.62.1",
"detox": "^17.3.4",
"jest": "^26.2.2",
"jest-circus": "^26.2.2",
已经找到解决办法了。请查看[https://github.com/wix/Detox/issues/42821