nightwatch.js - 如何使用带夜视仪的酱汁实验室?

标签 nightwatch.js saucelabs

我的 nightwatch.json 文件中有以下配置

"saucelabsChrome": {
  "selenium_host": "ondemand.saucelabs.com",
  "selenium_port": 80,
  "username": "example",
  "access_key": "--REDACTED---",
  "desiredCapabilities": {
    "acceptsSslCerts": true,
    "name": "chrome",
    "browserName": "chrome",
    "platform": "OS X 10.11",
    "version": "45.0"
  }
},

但是,当我使用酱汁实验室运行 nightwatch 时
node nightwatch  ---args '{"beta": "true", "env": "stage"}' --test tests/example.js -e saucelabsChrome

我收到一个错误
Couldn't find element signUpAdobe

两个问题
  • 我在哪里可以看到在 Saucelas 上运行的 nightwatch 命令?
  • 将酱汁实验室与守夜人集成的最佳方法是什么?
  • 最佳答案

    这是我的 nightwatch.json 文件配置为在 Sauce Labs 上运行并行测试的示例。

    {
      "src_folders" : ["tests"],
      "output_folder" : "reports",
      "custom_commands_path" : "custom_commands",
      "custom_assertions_path" : "",
      "page_objects_path" : "",
      "globals_path" : "",
    
      "selenium" : {
        "start_process" : false,
        "server_path" : "",
        "log_path" : "",
        "host" : "127.0.0.1",
        "port" : 4444,
        "cli_args" : {
          "webdriver.chrome.driver" : "",
          "webdriver.ie.driver" : ""
        }
      },
    
      "test_workers" : {"enabled" : true, "workers" : "auto"},
    
      "test_settings" : {
        "default" : {
          "launch_url" : "http://localhost",
          "selenium_port"  : 80,
          "selenium_host"  : "ondemand.saucelabs.com",
          "silent": true,
          "screenshots" : {
            "enabled" : false,
            "path" : ""
          },
          "username" : "${SAUCE_USERNAME}",
          "access_key" : "${SAUCE_ACCESS_KEY}",
    
          "desiredCapabilities": {
            "javascriptEnabled": true,
            "acceptSslCerts": true
          }
        },
    
        "chrome": {
          "desiredCapabilities": {
            "platform": "XP",
            "browserName": "chrome",
            "version": "41"
          }
        },
    
        "firefox" : {
          "desiredCapabilities": {
            "platform": "XP",
            "browserName": "firefox",
            "version": "33"
          }
        },
    
        "internet_explorer_10" : {
          "desiredCapabilities": {
            "platform": "Windows 7",
            "browserName": "internet explorer",
            "version": "10"
          }
        }
      }
    }
    

    如果您想看一看,这里是整个项目的链接:

    https://github.com/saucelabs-sample-test-frameworks/JS-Nightwatch.js

    至于你的第二个问题。您可以在 Sauce Labs 仪表板中看到正在运行的测试。登录 www.saucelabs.com 并单击左上角的测试选项卡。

    关于nightwatch.js - 如何使用带夜视仪的酱汁实验室?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36137270/

    相关文章:

    angularjs - 在基于 AngularJS 的 Web 应用程序中使用 Selenium

    node.js - nightwatch - 使用 Node.js 和 Chrome 进行调试

    selenium - 通过 REPL 驾驶 Nightwatch 测试

    Ruby Selenium Webdriver - 配置 Sauce Labs 通过/失败

    selenium - 使用 Jenkins CI 在 Docker 容器中运行自动化 Selenium Nightwatch.js 测试

    javascript - Nightwatch js 在所有步骤中使用页面对象作为变量

    ssl - TestCafe、HTTPS 和多浏览器测试

    javascript - 使用 intern.js 和 Leadfoot 滚动到 Selenium 中的元素

    java - 如何使用 Android 模拟器在 Saucelabs 上运行 .apk?

    java - Android 模拟器未启动。 browserName 总是抛出错误,但不包含在大写字母中