Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Last active August 18, 2017 13:30
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 shankardevy/4ec1b0fc863727b9a16fc5668b47a5f5 to your computer and use it in GitHub Desktop.
Save shankardevy/4ec1b0fc863727b9a16fc5668b47a5f5 to your computer and use it in GitHub Desktop.
defmodule MangoWeb.Acceptance.CartTest do
use Mango.DataCase
use Hound.Helpers
hound_session()
setup do
alias Mango.Repo
alias Mango.Catalog.Product
Repo.insert %Product{ name: "Carrot", pack_size: "1 kg", price: 55, sku: "A123", is_seasonal: true }
Repo.insert %Product{ name: "Apple", pack_size: "1 kg", price: 75, sku: "B232", is_seasonal: true }
:ok
end
test "presence of cart form for each product" do
navigate_to("/")
products = find_all_elements(:css, ".product")
assert Enum.count(products) != 0
products
|> Enum.each(fn(product) ->
button = find_within_element(product, :tag, "button")
assert visible_text(button) == "Add to cart"
end)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment