Commit cf0bce66 authored by Nick Stalter's avatar Nick Stalter

initial commit

parents
# The directory Mix will write compiled artifacts to.
/_build
# If you run "mix test --cover", coverage assets end up here.
/cover
# The directory Mix downloads your dependencies sources to.
/deps
# Where 3rd-party dependencies like ExDoc output generated docs.
/doc
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez
Let's take [White-Bread](https://github.com/meadsteve/white-bread) and add [Hound](https://github.com/HashNuke/hound) to it for Cucumber Driven Browser Automation
Demo Repo for my blog post found [here](https://nickstalter.com/elixir-cucumber-browser-testing.html)
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# 3rd-party users, it should be done in your "mix.exs" file.
# You can configure for your application as:
#
# config :elixirtest, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:elixirtest, :key)
#
# Or configure a 3rd-party app:
#
# config :logger, level: :info
#
config :hound, driver: "phantomjs"
# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
defmodule WhiteBread.DefaultContext do
use WhiteBread.Context
use Hound.Helpers
scenario_starting_state fn state ->
Application.ensure_all_started(:hound)
Hound.start_session
end
scenario_finalize fn state ->
Hound.end_session
end
given_ ~r/^I navigate to "(?<url>[^"]+)"$/, fn state, %{url: url} ->
navigate_to(url)
{:ok, state}
end
then_ ~r/^the page contains the header "(?<expected_header>[^"]+)"$/, fn state, %{expected_header: expected_header} ->
actual_header = find_element(:tag, "h3")
|> visible_text
assert actual_header == expected_header
{:ok, state}
end
end
Feature: Test thing
Scenario: Test 200 status code page
Given I navigate to "http://the-internet.herokuapp.com/status_codes/200"
Then the page contains the header "Status Codes"
\ No newline at end of file
defmodule Elixirtest do
end
defmodule Elixirtest.Mixfile do
use Mix.Project
def project do
[app: :elixirtest,
version: "0.1.0",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[applications: [:logger]]
end
# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# Type "mix help deps" for more examples and options
defp deps do
[
{:white_bread, "~> 2.5", only: [:dev, :test]},
{:hound, "~> 1.0"}
]
end
end
%{"certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], []},
"hackney": {:hex, :hackney, "1.6.1", "ddd22d42db2b50e6a155439c8811b8f6df61a4395de10509714ad2751c6da817", [:rebar3], [{:certifi, "0.4.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.0", [hex: :ssl_verify_fun, optional: false]}]},
"hound": {:hex, :hound, "1.0.2", "b6dd20142d00c28009fad503a23fa4a76bc11899e0d198f36a9c1448427788b2", [:mix], [{:httpoison, "~> 0.8", [hex: :httpoison, optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, optional: false]}]},
"httpoison": {:hex, :httpoison, "0.9.2", "a211a8e87403a043c41218e64df250d321f236ac57f786c6a0ccf3e9e817c819", [:mix], [{:hackney, "~> 1.6.0", [hex: :hackney, optional: false]}]},
"idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
"poison": {:hex, :poison, "3.0.0", "625ebd64d33ae2e65201c2c14d6c85c27cc8b68f2d0dd37828fde9c6920dd131", [:mix], []},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:rebar, :make], []},
"white_bread": {:hex, :white_bread, "2.8.1", "6db293d26b95c5472a88e3131850ba7a92e30e04b518923985738541adc3265b", [:mix], []}}
defmodule ElixirtestTest do
use ExUnit.Case
doctest Elixirtest
test "the truth" do
assert 1 + 1 == 2
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment