简体   繁体   中英

React Native Detox tests fail when remote debugger not enabled

The following test fails if I am not able to Enable Remote JS Debugging through the In-App Developer Menu before it runs (ie not type command + D and click on 'Enable Remote JS Debugging' in time):

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();
 });
});

I'm using the same configuration in my package.json as the docs suggest, but the -configuration Debug does not enable the debugger when the app & react native reload. Is there anyway to enable the debugger by default?

I think the problem related to the default UserAgent which is Safari not chrome, However in my case I face same problem but I resolve it by enable the automatic debugging with safari settings which is as following:

 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

Hopefully this will fix yours

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM