【问题标题】:Disable synchronization before launchApp在启动应用程序之前禁用同步
【发布时间】:2020-05-04 00:50:48
【问题描述】:

是否可以在启动应用程序之前/期间禁用同步(使用 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


【解决方案1】:

现在可以使用启动参数-detoxEnableSynchronization NO

请参阅此处的文档: https://github.com/wix/Detox/blob/master/docs/APIRef.DeviceObjectAPI.md#10-detoxenablesynchronizationinitialize-detox-with-synchronization-enabled-or-disabled-at-app-launch


旧答案:

Detox 不支持在启动时禁用同步,但如果网络请求导致问题,您可以将 URL 黑名单作为启动参数传递,这将禁用该网络请求的同步。

await device.launchApp({
  newInstance: true,
  launchArgs: { detoxURLBlacklistRegex: ' \\("http://192.168.1.253:19001/onchange","https://e.crashlytics.com/spi/v2/events"\\)' },
});

https://github.com/wix/Detox/blob/master/docs/APIRef.DeviceObjectAPI.md#10-initialize-the-url-blacklist-at-device-launch

【讨论】:

    猜你喜欢
    • 2014-10-13
    • 1970-01-01
    • 2015-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多