Why might Intern timeout with BrowserStack, but not Sauce Labs?

Edit: This has since been solved as an interesting network issue, see my comments and answer below.

Original Post:

My goal: Setup proof-of-concept tests on BrowserStack with Intern.

I went through the intern-tutorial, which all worked beutifully for me on Sauce Labs, and now I just want to learn what it takes to modify that configuration to test on BrowserStack, which keeps failing for me.

The terminal command, as per the tutorial:

./node_modules/.bin/intern-runner config=tests/intern

When running that, I get:

Listening on 0.0.0.0:9000
Starting tunnel...
BrowserStackLocal v2.2
Connecting to BrowserStack using WebSocket protocol...
Connected.
Ready
Error: connect ETIMEDOUT
  at errnoException  <net.js:904:11>
  at Object.afterConnect [as oncomplete]  <net.js:895:19>

TOTAL: tested 0 platforms, 0/0 tests failed; fatal error occurred

Environment:
OS: Mac OS X 10.9.4
Node: 0.10.29
NPM: 1.4.21
Intern: 2.0.1

Variables set in ~/.bash_profile as:

export BROWSERSTACK_USERNAME="<my_actual_username>"
export BROWSERSTACK_ACCESS_KEY="<my_actual_access_key>"

Intern configuration set in tests/intern as:

define({
    proxyPort: 9000,
    proxyUrl: 'http://localhost:9000/',

    capabilities: {
        'selenium-version': '2.41.0'
    },

    environments: [
        { os: "Windows", os_version: "8.1", browser: "chrome", browser_version: "34.0" }
    ],

    maxConcurrency: 3,

    tunnel: 'BrowserStackTunnel',
    tunnelOptions: {
        verbose: true
    },

    loader: {
        packages: [ { name: 'app', location: 'app' } ]
    },

    suites: [ 'tests/hello' ],

    functionalSuites: [ 'tests/functional/index' ],

    excludeInstrumentation: /^(?:tests|node_modules)\//
});

As in, this is all that has been changed since the completed tutorial:

  • Removed all but one environment object (for simplicity), modified it to a format supported by BrowserStack.
  • Set the 'tunnel' property to the appropriate tunnel class.
  • Set tunnelOptions: { verbose: true } for debugging.

Things I've tried:

My environment object should be valid, as its based on one coming back from:
https://www.browserstack.com/automate/browsers.json

I feel like there's some basic thing here I'm missing about the configuration.

Can you have a look into the intern config file, which I use to run tests on browserstack. Hope it will help you solve your problem.

I have confirmed via A/B testing on different networks and with the same configuration, that this is due to the fact that Verizon Wireless blocks WebSocket connections, which has been reported elsewhere (see my comments on the original question).

This can be very tricky to diagnose. I hope it helps someone in the future!