functional-testinginternbrowserstack

Specify multiple environments in Intern w/ Browserstack


I am trying to run parallel functional tests on BrowserStack using Intern. My current working intern.json config looks like this:

{
  "proxyPort": 9000,

  "capabilities": {
    "browserstack.local": false,
    "browserstack.debug": true,
    "browserstack.video": true,
    "fixSessionCapabilities": false
  },

  "environments": [
    { "browserName": "Chrome",  "version": 62  },
    { "browserName": "Firefox", "version": 38  },
    { "browserName": "Safari",  "version": 9   },
    { "browserName": "IE",      "version": 11  }
  ],

  "tunnel": "browserstack",

  "tunnelOptions": {
      "username": "myUsername",
      "accessKey": "myAccessKey"
  },

  "reporters": ["pretty"],
  "functionalSuites": ["dist/functional/tests/demo.js"]
}

However, my tests won't run when I try to specify an OS, os_version, or anything else inside of each environments object, like this:

{ "browserName": "Chrome",  "version": 62, "os" : "OS X" },

I have been referring to the BrowserStack docs: https://www.browserstack.com/automate/capabilities

Additionally, I am unable to specify any mobile device within this configuration - it yells that its missing a browserName property...

Any idea to how to do either of the above? Thanks!!!!


Solution

  • Here is a working sample for your configuration:

        define({
      proxyPort: 9000,
    
      capabilities: {
        'browserstack.local': false,
        fixSessionCapabilities: false
      },
    
      defaultTimeout: 300000,
    
      environments: [
          { browser: 'Chrome',  'browser_version': '62','os': 'Windows','os_version': '7'  },
            { browser: 'Firefox', 'browser_version': '38'  },
            { browser: 'Safari','browser_version': '9'   },
            { browser: 'IE',  'browser_version': '11'  },
    
            // This will ONLY work on real_mobile supported devices
            { browser: 'Safari', 'device': 'iPhone X', 'real_mobile': 'true'  },
            // This will work as an emulated mobile device
            {"browser": "android", "device": "Google Nexus 7", "os_version": "4.1"}
    
      ],
    
      maxConcurrency: 3,
    
      tunnel: 'BrowserStackTunnel',
    
      tunnelOptions: {
        verbose: true,
         username: '<Username>',
         accessKey: '<AccessKey>'
      },
    
      reporters: [ 'Pretty' ],
    
      loaderOptions: {
        packages: null
      },
    
      suites: null,
    
      functionalSuites: [ 'tests/single_test' ],
    
      excludeInstrumentation: true
    });
    

    The above demonstrates env configuration for a real_mobile supported device and an emulated mobile device.

    List of all devices supported by BrowserStack Automate can be found here: https://www.browserstack.com/list-of-browsers-and-platforms?product=automate. Devices marked with blue icon are real mobile devices and not available as emulators.