HashNuke / hound

Elixir library for writing integration tests and browser automation

Home Page:http://hexdocs.pm/hound

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(RuntimeError) could not create a new session: econnrefused, check webdriver is running

dbesserman opened this issue · comments

I'm trying to setup hound on a phoenix app. I followed the instructions in the README.md. Yet I can't get a smoke test to fail properly. It fails but not with the error I'm expecting. I'd like it to fail because there is no Hello, World! appearing yet whereas it fails because the webdriver does not seem to be running.

Here is the test which is located in test/smoke_test.ex:

defmodule HoundTest do
  use ExUnit.Case
  use Hound.Helpers

  hound_session()

  test "landing page shows Hello World", meta do
    navigate_to("/")

    assert page_title() == "Hello, World!"
  end
end

and here is the error I get when I run: mix test test/smoke_test.ex:

warning: variable "meta" is unused
  test/smoke_test.ex:7



  1) test landing page shows Hello World (HoundTest)
     test/smoke_test.ex:7
     ** (exit) exited in: GenServer.call(Hound.SessionServer, {:change_session, #PID<0.442.0>, :default, []}, 60000)
         ** (EXIT) an exception was raised:
             ** (RuntimeError) could not create a new session: econnrefused, check webdriver is running
                 (hound) lib/hound/session_server.ex:101: Hound.SessionServer.create_session/2
                 (hound) lib/hound/session_server.ex:78: Hound.SessionServer.handle_call/3
                 (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
                 (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
                 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
     stacktrace:
       (elixir) lib/gen_server.ex:774: GenServer.call/3
       test/smoke_test.ex:5: HoundTest.__ex_unit_setup_0/1
       test/smoke_test.ex:1: HoundTest.__ex_unit__/2



Finished in 0.08 seconds
1 test, 1 failure

Randomized with seed 53903
12:16:02.160 [error] GenServer Hound.SessionServer terminating
** (RuntimeError) could not create a new session: econnrefused, check webdriver is running
    (hound) lib/hound/session_server.ex:101: Hound.SessionServer.create_session/2
    (hound) lib/hound/session_server.ex:78: Hound.SessionServer.handle_call/3
    (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.442.0>): {:change_session, #PID<0.442.0>, :default, []}

Here is my Environment:
osx 10.13.3
elixir 1.5.1
phantomjs 2.1.1
node: 8.2.1
Here are my application dependencies:

    [
      {:phoenix, "~> 1.3.0"},
      {:phoenix_pubsub, "~> 1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.10"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:gettext, "~> 0.11"},
      {:cowboy, "~> 1.0"},
      {:hound, "~> 1.0"}
    ]

What should I do to make the webdriver run ?

I had to start phantomjs in web driver mode

phantomjs --wd