在实习生w / Browserstack中指定多个环境

时间:2018-03-26 18:21:37

标签: functional-testing intern browserstack

我正在尝试使用Intern在BrowserStack上运行并行功能测试。我当前工作的intern.json配置如下所示:

{
  "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"]
}

但是,当我尝试在每个环境对象中指定操作系统,os_version或其他任何内容时,我的测试不会运行,如下所示:

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

我一直在提到BrowserStack文档:https://www.browserstack.com/automate/capabilities

此外,我无法在此配置中指定任何移动设备 - 它大声说它缺少一个browserName属性......

任何想法如何做以上任何一种?感谢!!!!

2 个答案:

答案 0 :(得分:1)

以下是配置的工作示例:

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

以上演示了支持real_mobile的设备和模拟移动设备的env配置。

BrowserStack Automate支持的所有设备列表可在此处找到:https://www.browserstack.com/list-of-browsers-and-platforms?product=automate。标有蓝色图标的设备是真正的移动设备,不能用作模拟器。

答案 1 :(得分:0)

  1. 似乎并非每个os_version BrowserStack都列在其容量中。但是我尝试了下面的配置并且它有效!

    { browser: "Chrome", version: "62", os: "OS X", os_version: "El Capitan" }

  2. 这个也应该有效:

    { browser: "Chrome", version: "62", os: "OS X"}
    
    1. 要在移动设备上运行:我不使用移动设备,所以我不太确定,但我认为获取设备的正确名称是好的,os_version ..(你最好是直接询问BrowserStack) 但我试过了,这个对我有用:

      {browser: "android", device: "Google Nexus 7", os_version: "4.1"}