如何将nightwatch.json设置为跨平台

如何将nightwatch.json设置为跨平台,nightwatch.js,Nightwatch.js,目前,在我的nightwatch.json中,我可以在mac上运行: { "src_folders" : ["specs"], "output_folder" : "tests/e2e/reports", "custom_commands_path" : "", "custom_assertions_path" : "", "page_objects_path" : "", "globals_path" : "", "selenium" : { "start

目前,在我的
nightwatch.json中,我可以在mac上运行:

{
  "src_folders" : ["specs"],
  "output_folder" : "tests/e2e/reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "bin/selenium-server-standalone-2.48.2.jar",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "bin/chromedriver 2",
      "webdriver.ie.driver" : ""
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "someurl",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    }
  }
}

但是,chrome的驱动程序需要运行
chromedriver.exe
。解决这个问题的最佳实践方法是什么?我需要2个配置文件吗?我不希望有这个,因为我需要对此进行额外检查。

解决方案是使用nightwatch.conf.js文件,即:

module.exports = (function (settings) {

  //Setting chromedriver path at runtime to run on different architectures
  if (process.platform === "darwin") {
    settings.selenium.cli_args["webdriver.chrome.driver"] = "bin/chromedriver 2";
  }
  else if (process.platform === "win32" || process.platform === "win64") {
    settings.selenium.cli_args["webdriver.chrome.driver"] = "bin/chromedriver.exe";
  }

  return settings;

})(require('./nightwatch.json'));

那么你是如何在你的Mac上测试Edge或IE的呢?