使用NightwatchJS进行移动测试

时间:2017-04-05 07:32:27

标签: ios-simulator nightwatch.js appium-ios

我正在使用带有appium的nightwatchjs进行移动测试。 这是nightwatch.json:

{
"src_folders" : ["./examples/tests"],
"output_folder" : "./examples/reports",
"custom_commands_path" : "./examples/custom-commands",
"page_objects_path" : "./examples/pages",
"custom_assertions_path" : "",
"globals_path" : "",
"live_output" : false,
"parallel_process_delay" : 10,
"disable_colors": false,
"test_workers" : false,

"selenium" : {
"start_process" : false,
"server_path" : "bin/selenium-server-standalone-2.53.1.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4723,
"cli_args" : {
  "webdriver.chrome.driver" : "",
  "webdriver.ie.driver" : "",
  "webdriver.firefox.profile" : ""
 }
},

  "test_settings" : {
  "default" : {
  "launch_url" : "http://localhost",
  "selenium_host" : "127.0.0.1",
  "selenium_port" : 4723,
  "silent" : true,
  "disable_colors": false,
  "screenshots" : {
    "enabled" : false,
    "path" : ""
  },
  "desiredCapabilities" : {
    "browserName" : "firefox",
    "javascriptEnabled" : true,
    "acceptSslCerts" : true
  }
},

 "ios" : {
 "selenium_port" : 4723,
 "selenium_host" : "127.0.0.1",
 "silent": true,
 "desiredCapabilities" : {
 "fullReset": false,
 "browserName" : "Safari",
 "platformName" : "iOS",
 "platformVersion" : "9.3",
 "deviceName" : "iPhone 6"
}
},


 "saucelabs" : {
  "selenium_host" : "ondemand.saucelabs.com",
  "selenium_port" : 80,
  "username" : "${SAUCE_USERNAME}",
  "access_key" : "${SAUCE_ACCESS_KEY}",
  "use_ssl" : false,
  "silent" : true,
  "output" : true,
  "screenshots" : {
    "enabled" : false,
    "on_failure" : true,
    "path" : ""
   },
   "desiredCapabilities": {
    "name" : "test-example",
    "browserName": "firefox"
  },
  "globals" : {
    "myGlobal" : "some_sauce_global"
  },
  "selenium" : {
    "start_process" : false
  }
 },

  "phantomjs" : {
   "desiredCapabilities" : {
     "browserName" : "phantomjs",
     "javascriptEnabled" : true,
     "acceptSslCerts" : true,
     "phantomjs.binary.path" : "/path/to/phantomjs"
   }
  },

  "browserstack" : {
  "selenium" : {
    "start_process" : false
   },
  "selenium_host" : "hub.browserstack.com",
  "selenium_port" : 80,
  "silent" : true,
  "desiredCapabilities": {
    "name" : "test-example",
    "browserName": "firefox",
    "browserstack.user" : "...",
    "browserstack.key" : "..."
  }
 },

 "testingbot" : {
  "selenium_host" : "hub.testingbot.com",
  "selenium_port" : 80,
  "apiKey" : "${TB_KEY}",
  "apiSecret" : "${TB_SECRET}",
  "silent" : true,
  "output" : true,
  "screenshots" : {
    "enabled" : false,
    "on_failure" : true,
    "path" : ""
    },
   "desiredCapabilities": {
     "name" : "test-example",
     "browserName": "firefox"
   },
   "selenium" : {
    "start_process" : false
   }
 }
 }
}

然后, 我开始appium和写 bin / nightwatch --env ios -t examples / tests / googlePageObject.js

如果需要重定向到google.com,Xcode iphone模拟器运行但只重定向127.0.0.1/4723并且命令提示符返回错误

   Error retrieving a new session from the selenium server

   Connection refused! Is selenium server started?
   { Error: socket hang up
   at createHangUpError (_http_client.js:253:15)
   at Socket.socketCloseListener (_http_client.js:285:23)
   at emitOne (events.js:101:20)
   at Socket.emit (events.js:188:7)
   at TCP._handle.close [as _onclose] (net.js:501:12) code:          'ECONNRESET' }

任何帮助?

0 个答案:

没有答案