Nightwatch/Appium 在 iOS 模拟器上测试浏览器的配置

Nightwatch/Appium configuration for testing browser on iOS emulator

我无法找到与配置 Nightwatch 以使用 Appium 测试移动网络应用程序相关的资源。

这可能吗?非常感谢任何指导。

试试这个设置(Nightwatch.js 文件),它对我有用

var path = require('path');

var appPath = path.join(process.cwd(), '<your app path>');// .app file


module.exports = {
    "src_folders": ["./tests/"],
  "globals_path": './lib/globals/Globals.js',

    "selenium": {
        "start_process": true,
        "server_path": "node_modules/selenium-server/lib/runner/selenium-server-standalone.jar",
        "log_path": "./results",
        "host": "127.0.0.1",
        "port": 4444,
        "cli_args": {
            "webdriver.chrome.driver": "./node_modules/.bin/chromedriver"
        }
    },

    "test_settings": {
        "default": {
            "globals" : {
                "waitForConditionTimeout" : 20000,
            },
            "launch_url": "http://localhost:4723/wd/hub",
            "selenium_host": "localhost",
            "selenium_port": 4723,
            "silent": true,
            "output": true,
            "screenshots": {
                "enabled": false,
                "path": ""
            },
            "exclude": ['nightwatch-config.js', 'pageObjects']
        },
        "ios-sim": {
            "desiredCapabilities": {
                "fullReset": false,
                "app": appPath,
                "platformName": "iOS",
                "platformVersion": "9.0",
                "deviceName": "iPhone 5s"
            }
        }
    }
};

它涉及正确的环境设置,如果有任何问题,您将遇到错误。我写了一篇关于使用 Nightwatch 和 Appium 测试 iOS 浏览器的完整博客,这是最近的 (08/2016)

http://www.shaneofalltrades.com/2016/08/26/Mobile-Web-Testing-Using-Nightwatchjs-part-1/

如果您有任何问题,请随时在此处或评论中提问。基本上使用默认的 Nightwatch Google 测试,所以你可以确定这不是你的测试失败,而是配置如果有的话。这是我的配置示例...

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

但请通读并遵循文档,其中有几个独特的重要步骤。