ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - HashNuke/hound: Elixir library for writing integration tests and browser automation
Elixir library for writing integration tests and browser automation - HashNuke/hound
Visit Site

GitHub - HashNuke/hound: Elixir library for writing integration tests and browser automation

GitHub - HashNuke/hound: Elixir library for writing integration tests and browser automation

Hound

For browser automation and writing integration tests in Elixir.

Source | Documentation

Build Status

Features

  • Can run multiple browser sessions simultaneously. See example.

  • Supports Selenium (Firefox, Chrome), ChromeDriver and PhantomJs.

  • Supports Javascript-heavy apps. Retries a few times before reporting error.

  • Implements the WebDriver Wire Protocol.

Internet Explorer may work under Selenium, but hasn't been tested.

Example

ExUnit example
defmodule HoundTest do
  use ExUnit.Case
  use Hound.Helpers

  hound_session()

  test "the truth", meta do
    navigate_to("http://example.com/guestbook.html")

    element = find_element(:name, "message")
    fill_field(element, "Happy Birthday ~!")
    submit_element(element)

    assert page_title() == "Thank you"
  end

end

Here's another simple browser-automation example.

Setup

Hound requires Elixir 1.0.4 or higher.

  • Add dependency to your mix project

{:hound, "~> 1.0"}
  • Start Hound in your test/test_helper.exs file before the ExUnit.start() line:
Application.ensure_all_started(:hound)
ExUnit.start()

When you run mix test, Hound is automatically started. You'll need a webdriver server running, like Selenium Server or Chrome Driver. If you aren't sure what it is, then read this.

If you're using Phoenix

Ensure the server is started when your tests are run. In config/test.exs change the server option of your endpoint config to true:

config :hello_world_web, HelloWorldWeb.Endpoint,
  http: [port: 4001],
  server: true

Configure

To configure Hound, use your config/config.exs file or equivalent.

Example:

config :hound, driver: "phantomjs"

More examples here.

Usage

Add the following lines to your ExUnit test files.

# Import helpers
use Hound.Helpers

# Start hound session and destroy when tests are run
hound_session()

If you prefer to manually start and end sessions, use Hound.start_session and Hound.end_session in the setup and teardown blocks of your tests.

Helpers

The documentation pages include examples under each function.

The docs are at http://hexdocs.pm/hound.

More examples? Checkout Hound's own test cases

FAQ

Can I run multiple browser sessions simultaneously

Oh yeah ~! Here is an example.

If you are running PhantomJs, take a look at the Caveats section below.

Can I run tests async?

Yes.

The number of tests you can run async at any point in time, depends on the number of sessions that your webdriver can maintain at a time. For Selenium Standalone, there seems to be a default limit of 15 sessions. You can set ExUnit's async option to limit the number of tests to run parallelly.

Will Hound guarantee an isolated session per test?

Yes. A separate session is started for each test process.

PhantomJs caveats

PhantomJs is extremely fast, but there are certain caveats. It uses Ghostdriver for its webdriver server, which currently has unimplemented features or open issues.

Running tests

You need a webdriver in order to run tests. We recommend phantomjs but any can be used by setting the WEBDRIVER environment variable as shown below:

$ phantomjs --wd
$ WEBDRIVER=phantomjs mix test

Maintainers

Customary proclamation...

Copyright © 2013-2015, Akash Manohar J, under the MIT License (basically, do whatever you want)

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory