两个浏览器并行的Nightwatch只能在浏览器堆栈上默认运行

时间:2019-01-07 16:03:36

标签: nightwatch.js browserstack

我已经配置了几个测试设置,并且我想运行并行chrome和ie。 当我运行

  

./ node_modules / .bin / nightwatch --env chrome

测试镀铬的运行

  

./ node_modules / .bin / nightwatch --env即

测试即跑

  

./ node_modules / .bin / nightwatch --env,即Chrome

测试firefox的运行(我猜这只能运行默认运行,仅此而已)

Nightwatch 1.0.18

{
  "src_folders": [
    "test"
  ],
  "output_folder": "reports",
  "live_output" : true,
  "custom_commands_path": "config/commands",
  "test_runner": {
    "type" : "mocha",
    "options" : {
      "grep": "@acc"
    }
  },

  "test_settings": {
    "default": {
      "selenium_host": "hub-cloud.browserstack.com",
      "selenium_port": 80,
      "launch_url": "localhost",
      "browserstack.key": "KEY",
      "browserstack.user": "USER",
      "browserstack.local": "true"
    },

    "chrome-local": {
      "default_path_prefix": "",
      "launch_url": "localhost",
      "screenshots": {
        "enabled": true,
        "on_failure": true,
        "on_success": true,
        "on_error": true,
        "path": "./screenshots"
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "chromeOptions": {
          "args": [
            "--no-sandbox",
            "headless",
            "window-size=1920,1200"
          ]
        },
        "acceptSslCerts": true,
        "acceptInsecureCerts": true,
        "elementScrollBehavior": 1
      }
    },
    "chrome": {
      "desiredCapabilities": {
        "browser": "chrome"
      }
    },
    "ie": {
      "desiredCapabilities": {
        "browserName": "ie",
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

有关使用Nightwatch运行并行测试的信息,请参见-https://github.com/browserstack/nightwatch-browserstack

由于您需要在Chrome和IE浏览器上运行并行测试,因此需要对https://github.com/browserstack/nightwatch-browserstack/blob/master/package.json#L10行进行如下更改-

  

“ parallel”:“ ./node_modules/.bin/nightwatch -c conf / parallel.conf.js   -e即铬”