-1

I am trying to connect my CI tests to BrowserStack. My tests are running using karma-mocha and https://github.com/karma-runner/karma-browserstack-launcher. I can easily run tests on desktop browsers but I am unable to connect mobile browsers to the karma local server. The error that I see is:

the webpage at http://localhost:9876/ could not be loaded because net:ERR_CONNECTION_REFUSED

I am using BrowserStackLocal.exe in order to enable the connection to the localhost karma server:

BrowserStackLocal.exe <Key> -v -localIdentifier **id1** -forcelocal

and in my karma.conf.js:

browserStack: {
        username: '<username>',
        accessKey: '<Key>',
        startTunnel: false,
        tunnelIdentifier: '**id1**'
    }

When working with 'Live' in BrowserStack I am able to connect the browser to my local karma and to execute tests. Here is an example:

Chrome Mobile 50.0.2657 (Android 6.0.99): Executed 76 of 79 (skipped 3) SUCCESS

Any ideas on why the Automate fails? Thanks

Yehuda
  • 619
  • 5
  • 10

1 Answers1

0

After communicating with BrowserStack support I figured out that there is an issue with Android 5.0+ versions since the proxy feature is not supported in emulators, only in real devices. Since BrowserStack Automate is working with emulators this is the reason that the Android browser could not connect to the Karma runner. Tests work fine on emulators with Android 4.4 and below

This also explains why in 'Live' it was working - 'Live' is running with a real device.

The thanks goes to BrowserStack support.

Umang Sardesai
  • 742
  • 5
  • 13
Yehuda
  • 619
  • 5
  • 10