【问题标题】:React Native Detox tests fail when remote debugger not enabled未启用远程调试器时,React Native Detox 测试失败
【发布时间】:2018-07-31 10:31:40
【问题描述】:

如果我无法在运行前通过 In-App Developer Menu 启用远程 JS 调试(即未及时键入 command + D 并单击“启用远程 JS 调试”),则以下测试失败:

describe('Login form tests', () => {
  beforeEach(async () => {
  await device.reloadReactNative();
});

it('logins in user', async (done) => {
 // typeText method doesn't work because of https://github.com/wix/detox/issues/92
    await element(by.id('login_email')).replaceText('email@email.com');
    await element(by.id('login_password')).replaceText('fakepassword');

   // $FlowFixMe
   await element(by.id('login_button')).tap();

   done();
 });
});

我在 package.json 中使用与文档建议相同的配置,但 -configuration Debug 在应用程序和反应本机重新加载时不会启用调试器。有没有默认启用调试器?

【问题讨论】:

  • 我得到了完全相同的行为。你有想过这个吗?

标签: react-native detox


【解决方案1】:

我认为问题与默认的 UserAgent 相关,即 Safari 而不是 chrome,但是在我的情况下,我遇到了同样的问题,但我通过使用 safari 设置启用自动调试来解决它,如下所示:

 1. Enable Develop menu in Safari: Preferences → Advanced → Select "Show Develop menu in menu bar"
 2. Select your app's JSContext: Develop → {Your Simulator} → Automatically Show Web Inspector for JS JSContext
 3. Safari's Web Inspector should open which has a Console and a Debugger

希望这能解决你的问题

【讨论】:

    猜你喜欢
    • 2014-01-23
    • 1970-01-01
    • 2022-10-20
    • 2022-10-16
    • 2020-02-14
    • 2018-12-17
    • 2019-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多