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.
For example, here’s how you visit a page and click on a link.
navigate_to("http://HashNuke.com")
find_element(:class, "projects-link")
|> click()
There’s a lot of other helpers.
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.
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")
end
assert find_element(:css, "#messages")
|> visible_text()
|> &(Regex.match?(%rhello/, &1))
end
Supports Selenium (Firefox, Chrome), PhantomJS and the Chrome Driver.
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