Merge pull request #2128 from midopa/master

fix, if appium url set in nodeconfig, dont autopopulate
This commit is contained in:
Jonathan Lipps
2014-03-24 10:42:40 -07:00
2 changed files with 17 additions and 6 deletions

View File

@@ -32,6 +32,8 @@ Once you start the appium server and it registers with the grid, you will see yo
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://<host_name_appium_server_or_ip-address_appium_server>:<appium_port>/wd/hub",
"host": <host_name_appium_server_or_ip-address_appium_server>,
"port": <appium_port>,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
@@ -42,3 +44,5 @@ Once you start the appium server and it registers with the grid, you will see yo
```
Valid platforms are listed <a href="http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/Platform.html">here</a>
If `url`, `host`, and `port` are not given, the config will be auto updated to point to localhost:whatever-port-Appium-started-on.

View File

@@ -38,13 +38,20 @@ function postRequest(data, addr, port) {
return logger.error("Syntax error in node configuration file: " + e.message);
}
// set the node's url config automatically
jsonObject.configuration.url = 'http://' + addr + ':' + port + '/wd/hub';
jsonObject.configuration.host = addr;
jsonObject.configuration.port = port;
// if the node config doesnt have the appium/webdriver url, host, and port,
// automatically ad it based on how appium was init
// otherwise, we will take whatever the user setup
// because we will always set localhost/127.0.0.1. this won't work if your
// node and grid aren't in the same place
if (!jsonObject.configuration.url || !jsonObject.configuration.host || !jsonObject.configuration.port) {
jsonObject.configuration.url = 'http://' + addr + ':' + port + '/wd/hub';
jsonObject.configuration.host = addr;
jsonObject.configuration.port = port;
// re-serialize the configuration with the auto populated data
data = JSON.stringify(jsonObject);
}
// re-serialize the configuration with the auto populated data
data = JSON.stringify(jsonObject);
// prepare the header
var post_headers = {
'Content-Type' : 'application/json'