如何配置Nightwatch.js + Selenium Hub + Appium +真正的移动设备?

问题描述:

我有一个工作硒配置与硒轮毂,这是我通过Nightwatch.js启动的firefox/chrome桌面测试的入口点。如何配置Nightwatch.js + Selenium Hub + Appium +真正的移动设备?

现在我想补充用于移动设备的测试,因此,一些搜索后,我已经在Mac上配置的Appium,用我的枢纽如下插入:

{ 
    "capabilities": [ 
     { 
      "browserName": "Safari", 
      "platformName": "iOS", 
      "platformVersion": "9.3", 
      "maxInstances": 1, 
      "platform": "MAC" 
     } 
    ], 
    "configuration": { 
     "cleanUpCycle": 2000, 
     "timeout": 30000, 
     "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", 
     "url":"http://192.168.24.222:4723/wd/hub", 
     "host": "192.168.24.222", 
     "port": 4723, 
     "maxSession": 1, 
     "register": true, 
     "registerCycle": 5000, 
     "hubPort": 4444, 
     "hubHost": "selenium-hub-host" 
    } 
} 

现在我想于:

  1. 配置与Appium虚拟设备(我失去了与官方文档,我不熟悉的苹果设备)
  2. 有一个适当的Nightwatch测试配置在它们上面运行
  3. 添加一个或多个真实设备上的Appium侧

欢迎任何帮助,感谢

编辑:我已经DEF提升企业在nightwatch任务能力达到1和2以及appium功能:

在Nightwatch.js:

"ios": { 
    "desiredCapabilities" : { 
     "browserName" : "Safari", 
     "deviceName": "iPhone Simulator", 
     "platformName" : "iOS", 
     "platform" : "MAC", 
     "javascriptEnabled" : true, 
     "acceptSslCerts" : true 
    } 
} 

在Appium nodeconf.json:

"capabilities": [ 
    { 
     "browserName": "Safari", 
     "platformName": "iOS", 
     "platformVersion": "9.3", 
     "deviceName": "iPhone Simulator", 
     "maxInstances": 1, 
     "platform": "MAC" 
    } 
] 

但现在我坚持了真正的设备,它并不想注册我的硒枢纽nodeconf(无效PARAM,显然):

{ 
    "browserName": "Safari", 
    "platformName": "iOS", 
    "platformVersion": "8.1", 
    "deviceName": "testmac’s iPad", 
    "udid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 
    "maxInstances": 1, 
    "platform": "MAC" 
} 

这里是我的枢纽电网: selenium hub grid

要连接多个iOS设备,您必须使用here所述的解决方法。启动Appium时必须提供其他参数:

.node -p 6001 -U --tmp /temp/dir1 & 
.node -p 6002 -U --tmp /temp/dir2 & 

运行Android设备不限于此方式。我不知道这是否是正确的态度,但几周前它对我有用。配置文件 - huaweiG6.json:

{ 
    "capabilities": 
    [ 
    { 
     "browserName": "HuaweiG6", 
     "deviceName":"8c34fd0c5a94", 
     "version":"4.3", 
     "maxInstances": 1, 
     "platform":"ANDROID", 
     "newCommandTimeout":"30", 
     "deviceReadyTimeout":5 
    } 
    ], 
    "configuration": 
    { 
    "cleanUpCycle":2000, 
    "timeout":10800, 
    "url":"http://127.0.0.1:4727/wd/hub", 
    "host": "127.0.0.1", 
    "port": 4727, 
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", 
    "maxSession": 1, 
    "register": true, 
    "registerCycle": 5000, 
    "hubPort": 4444, 
    "hubHost": "172.17.0.232" 
    } 
} 

而开始Appium与命令:

appium --nodeconfig huaweiG6.json -p 4727 -cp 4727 -U 8c34fd0c5a94 

-U参数是等效如上所述here到-udid。你可以通过运行得到这个ID:

adb devices 

安装Android SDK后可能会出现这种情况。您的deviceName参数应具有相同的值。如果您在连接到集线器时遇到问题,请尝试更改hubHost参数 - 它应该是正在运行的集线器实例的域或IP。

我已经通过使用https://github.com/michaeltamm/junit-toolbox的跑步者进行了测试。Java用户的替代方案是使用Maven surefire插件http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html

祝你好运