Search code examples
testingautomated-testse2e-testingweb-testingtestcafe

Unable to connect to a site from Testcafe IDE on OSX


My fixtures are set up like so

{
  "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": "[email protected]"
            }
          ]
        }
      ]
    }
  ]
}

with one simple test to find the input and type some text but when running the command I get

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.

I've seen this issue a couple of times on their issues board one relating to CI integration on a Linux server and another which seems like a similar issue of trying to connect to localhost

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

New to testcafe any help would be appreciated!


Solution

  • I've found the solution some network policies don't allow access to your machine on some ports in my example it's 57501.

    testcafe chrome login.testcafe --hostname localhost
    

    adding --hostname resolves the issue

    documentation

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

    I still don't know how to launch from the IDE but this resolves my main issue.