01 January 2014

Hound is a library for browser automation and to write integration tests in Elixir. I’ve been working on it during the last few weeks of 2013.

TL;DR: Source code, API docs

Thanks to Jose Valim for feedback on refactoring the internals of Hound.

And to everyone on the Elixir IRC for helping out during the countless times I’ve come with an odd query.

Hound provides a lot of simple helpers

For example, here’s how you visit a page and click on a link.

find_element(:class, "projects-link")
|> click()

There’s a lot of other helpers.

And there’s a lot of examples and documentation

You can find links to documentation about all helpers on the readme or on the API docs.

Checkout Hound’s own test cases for examples.

Supports multiple browser sessions, simultaneously

That’s a big YAY if you are working on real time apps.

Here’s how you do it in an ExUnit test case:

test "should be able to exchange messages" do
  navigate_to "http://example.com"

  in_browser_session :second_user do
    navigate_to "http://example.com"
    find_element(:css, "#new_message")
    |> fill_field("hello")

  assert find_element(:css, "#messages")
  |> visible_text()
  |> &(Regex.match?(%rhello/, &1))

Pretty wide support

Supports Selenium (Firefox, Chrome), PhantomJS and the Chrome Driver.

Like it?

Add to your project as a dependency

{:hound. github: "HashNuke/hound", tag: "v0.5.1"}

And start using it by adding Hound.start in your test_helper.exs. Check project readme easy instructions.

More reference docs are available at http://HashNuke.com/docs/hound