能否在启动App之前禁用同步(newInstance: true)?理想情况下,我希望:
await device.launchApp({ newInstance: true, url });
立即解决。
我继承了一个应用程序,它在启动时做了一些奇怪的事情,所以我想在一开始就绕过同步,之后才重新启用。
我试过这样的方法。
await device.disableSynchronization();
await device.launchApp({ newInstance: true, url });
await waitFor(element(by.id('root'))).toBeVisible().withTimeout(10000);
await device.enableSynchronization();
但从文档中我读到,同步总是在新实例中重新启用。
有没有办法强制同步关闭,以便device.launchApp能够真正解析?
Detox不支持在启动时禁用同步,但如果一个网络请求引起了问题,你可以传递一个URL黑名单作为启动参数,这将禁用该网络请求的同步。
await device.launchApp({
newInstance: true,
launchArgs: { detoxURLBlacklistRegex: ' \\("http://192.168.1.253:19001/onchange","https://e.crashlytics.com/spi/v2/events"\\)' },
});