1

I'm trying to set up automated testing with PhantomJS, Behat and Sahi on my vagrant machine.

I'm getting the following output, when trying to run a test with behat:

[Behat\SahiClient\Exception\ConnectionException]                                       
  Exception has been thrown in "afterStep" hook, defined in FeatureContext::afterStep()  
  Connection time limit reached

Here is my userdata.properties:

# dirs. Relative paths are relative to userdata dir. Separate directories with semi-colon
scripts.dir=scripts;
# default log directory.
logs.dir=logs
# Directory where auto generated ssl cerificates are stored
certs.dir=certs

# Use external proxy server for http
ext.http.proxy.enable=false
ext.http.proxy.host=
ext.http.proxy.port=
ext.http.proxy.auth.enable=false
ext.http.proxy.auth.name=kamlesh
ext.http.proxy.auth.password=password

# Use external proxy server for https
ext.https.proxy.enable=false
ext.https.proxy.host=
ext.https.proxy.port=
ext.https.proxy.auth.enable=false
ext.https.proxy.auth.name=kamlesh
ext.https.proxy.auth.password=password

# There is only one bypass list for both secure and insecure.
ext.http.both.proxy.bypass_hosts=localhost|127.0.0.1|*.internaldomain.com

# Mark this property true to disable the proxy alert
proxy_alert.disabled=false

And my browswer_types.xml:

<browserTypes>
    <browserType>
            <name>phantomjs</name>
            <displayName>PhantomJS</displayName>
             <icon>safari.png</icon>
            <path>/usr/bin/phantomjs</path>
            <options>--ignore-ssl-errors=yes --proxy=localhost:9999 --ssl-protocol=any /usr/local/sahi/phantomjs-sahi.js</options>
            <processName>phantomjs</processName>
            <capacity>100</capacity>
            <force>true</force>
    </browserType>
</browserTypes>

behat.yml:

default:
  extensions:
    Behat\MinkExtension\Extension:
      javascript_session: sahi
      browser_name: phantomjs
      goutte: ~
      sahi:
        host: localhost
        port: 9999

Sahi run output:

--------
SAHI_HOME: ..
SAHI_USERDATA_DIR: ../userdata
SAHI_EXT_CLASS_PATH:
--------
Sahi properties file = /usr/local/sahi/config/sahi.properties
Sahi user properties file = /usr/local/sahi/userdata/config/userdata.properties
Added shutdown hook.
>>>> Sahi OS v5.0 started. Listening on port: 9999
>>>> Configure your browser to use this server and port as its proxy
>>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Controller
-----
Reading browser types from: /usr/local/sahi/userdata/config/browser_types.xml
-----

I've tried reinstalling a bunch of stuff, tried playing around with the ports, processes, proxy settings, nothing.

casraf
  • 21,085
  • 9
  • 56
  • 91

2 Answers2

0

your vagrant comes with an empty or no db. so when you try to connect to your app, e.g log in with some known user it will crash cause it won't find it!

all the best ;)

0

Since version 4.3.2 of BrowserType change settings. Since there is no tag force. please check.

https://sahipro.com/docs/using-sahi/sahi-headless-execution-with-phantomjs.html#Documentation since Sahi Pro V4.3.2