设置Sahi,Behat& PhantomJS on Vagrant

时间:2015-01-07 16:12:28

标签: phantomjs automated-tests behat sahi

我正在尝试使用PhantomJS,Behat和Sahi在我的流浪机上进行自动化测试。

当我尝试使用behat:

运行测试时,我得到以下输出
[Behat\SahiClient\Exception\ConnectionException]                                       
  Exception has been thrown in "afterStep" hook, defined in FeatureContext::afterStep()  
  Connection time limit reached

这是我的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

我的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运行输出:

--------
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
-----

我尝试重新安装一堆东西,尝试使用端口,进程,代理设置,什么都没有。

2 个答案:

答案 0 :(得分:0)

你的流浪汉带有空或没有数据库。因此,当您尝试连接到您的应用程序时,例如使用某个已知用户登录它会崩溃,因为它无法找到它!

一切顺利;)

答案 1 :(得分:0)

自BrowserType版本4.3.2更改设置。由于没有标签力。请检查。

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