无法从 OSX 上的 Testcafe IDE 连接到站点

Unable to connect to a site from Testcafe IDE on OSX

我的灯具是这样设置的

{
  "fixtures": [
    {
      "name": "login",
      "pageUrl": "http:\/\/localhost:3000\/",
      "tests": [
        {
          "name": "type name",
          "commands": [
            {
              "type": "type-text",
              "studio": {

              },
              "callsite": "0",
              "selector": {
                "type": "js-expr",
                "value": "input[type=email]"
              },
              "options": {

              },
              "text": "example@email.com"
            }
          ]
        }
      ]
    }
  ]
}

通过一个简单的测试来找到输入并键入一些文本但是当 运行 命令时我得到

testcafe chrome login.testcafe
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

Type "testcafe -h" for help.

我在他们的问题板上看到过几次这个问题,一个与 Linux 服务器上的 CI 集成有关,另一个似乎是尝试连接到本地主机的类似问题

https://github.com/DevExpress/testcafe-browser-provider-electron/issues/20 https://github.com/DevExpress/testcafe/issues/1133

testcafe 的新手,如有任何帮助,我们将不胜感激!

我找到了一些网络策略不允许在某些端口上访问您的计算机的解决方案,在我的示例中是 57501。

testcafe chrome login.testcafe --hostname localhost

添加 --hostname 解决了问题

文档

https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--hostname-name

我仍然不知道如何从 IDE 启动,但这解决了我的主要问题。

TestCafe Studio Preview 不支持设置命令行选项(您的主机名)。 TestCafe 团队将在正式版中实现此功能。

因此,目前只能通过命令行 运行 进行测试。

更新:

您可以在 TestCafe Studio Settings dialog:

中设置主机名选项