Skip to content

Instantly share code, notes, and snippets.

@pragtobgists
Last active October 23, 2017 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pragtobgists/b9b1ec129d19a734d50f619933400cf5 to your computer and use it in GitHub Desktop.
Save pragtobgists/b9b1ec129d19a734d50f619933400cf5 to your computer and use it in GitHub Desktop.
Benchee Hound
# ATTENTION: gotta start phantomjs via `phantomjs --wd` first..
Application.ensure_all_started(:hound)
{:ok, server} = SimpleServer.start
Application.put_env(:hound, :app_host, "http://localhost")
Application.put_env(:hound, :app_port, SimpleServer.port(server))
use Hound.Helpers
Benchee.run(%{
"fill_in text_field" => fn ->
fill_field({:name, "user[name]"}, "Chris")
end,
"visit forms" => fn ->
navigate_to("#{server.base_url}/forms.html")
end,
"find by css #id" => fn ->
find_element(:id, "button-no-type-id")
end
},
time: 18,
formatters: [
Benchee.Formatters.HTML,
Benchee.Formatters.Console
],
html: [file: "benchmarks/html/hound.html"],
before_scenario: fn(input) ->
Hound.start_session()
navigate_to("#{server.base_url}/forms.html")
input
end,
after_scenario: fn(_return) ->
Hound.end_session
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment