Separate big feature test into smaller more focused tests

Co-authored-by: tmecklem <timothy@mecklem.com>
pull/130/head
jimmay5469 7 years ago committed by Luke Imhoff
parent 973a52a29c
commit 362920288b
  1. 58
      apps/explorer_web/test/explorer_web/features/contributor_browsing_test.exs

@ -105,7 +105,8 @@ defmodule ExplorerWeb.UserListTest do
|> assert_has(css(".transactions__link--long-hash", text: "0xfaschtnacht")) |> assert_has(css(".transactions__link--long-hash", text: "0xfaschtnacht"))
end end
test "views transactions", %{session: session} do describe "transactions and address pages" do
setup do
block = block =
insert(:block, %{ insert(:block, %{
number: 555, number: 555,
@ -157,18 +158,35 @@ defmodule ExplorerWeb.UserListTest do
Credit.refresh() Credit.refresh()
Debit.refresh() Debit.refresh()
{:ok, %{internal: internal}}
end
test "views transactions", %{session: session} do
session session
|> visit("/en") |> visit("/en")
|> assert_has(css(".transactions__title", text: "Transactions")) |> assert_has(css(".transactions__title", text: "Transactions"))
|> assert_has(css(".transactions__column--hash", count: 5)) |> assert_has(css(".transactions__column--hash", count: 5))
|> assert_has(css(".transactions__column--value", count: 5)) |> assert_has(css(".transactions__column--value", count: 5))
|> assert_has(css(".transactions__column--age", count: 5, visible: false)) |> assert_has(css(".transactions__column--age", count: 5, visible: false))
end
test "can see pending transactions", %{session: session} do
session
|> visit("/transactions") |> visit("/transactions")
|> click(css(".transactions__tab-link", text: "Pending")) |> click(css(".transactions__tab-link", text: "Pending"))
|> click(css(".transactions__link", text: "0xC001")) |> click(css(".transactions__link", text: "0xC001"))
|> assert_has(css(".transaction__item-value--status", text: "Pending")) |> assert_has(css(".transaction__item-value--status", text: "Pending"))
end
test "don't see pending transactions by default", %{session: session} do
session
|> visit("/transactions") |> visit("/transactions")
|> refute_has(css(".transactions__column--block", text: "Pending")) |> refute_has(css(".transactions__column--block", text: "Pending"))
end
test "can see a transaction's details", %{session: session} do
session
|> visit("/transactions")
|> click(link("0xSk8")) |> click(link("0xSk8"))
|> assert_has(css(".transaction__subheading", text: "0xSk8")) |> assert_has(css(".transaction__subheading", text: "0xSk8"))
|> assert_has(css(".transaction__item", text: "123,987")) |> assert_has(css(".transaction__item", text: "123,987"))
@ -189,20 +207,54 @@ defmodule ExplorerWeb.UserListTest do
|> assert_has(css(".transaction__item", text: "block confirmations")) |> assert_has(css(".transaction__item", text: "block confirmations"))
|> assert_has(css(".transaction__item", text: "49 years ago")) |> assert_has(css(".transaction__item", text: "49 years ago"))
|> assert_has(css(".transaction__item", text: "38 years ago")) |> assert_has(css(".transaction__item", text: "38 years ago"))
end
test "can see internal transactions for a transaction", %{
session: session,
internal: internal
} do
session
|> visit("/en/transactions/0xSk8")
|> click(link("Internal Transactions")) |> click(link("Internal Transactions"))
|> assert_has(css(".internal-transaction__table", text: internal.call_type)) |> assert_has(css(".internal-transaction__table", text: internal.call_type))
end
test "can view a transaction's logs", %{session: session} do
session
|> visit("/en/transactions/0xSk8") |> visit("/en/transactions/0xSk8")
|> click(link("Logs")) |> click(link("Logs"))
|> assert_has(css(".transaction-log__link", text: "0xlincoln")) |> assert_has(css(".transaction-log__link", text: "0xlincoln"))
end
test "can visit an address from the transaction logs page", %{session: session} do
session
|> visit("/en/transactions/0xSk8/logs")
|> click(css(".transaction-log__link", text: "0xlincoln")) |> click(css(".transaction-log__link", text: "0xlincoln"))
|> assert_has(css(".address__subheading", text: "0xlincoln")) |> assert_has(css(".address__subheading", text: "0xlincoln"))
|> click(css(".address__link", text: "Transactions")) end
test "see's all addresses transactions by default", %{session: session} do
session
|> visit("/en/addresses/0xlincoln")
|> assert_has(css(".transactions__link--long-hash", text: "0xSk8")) |> assert_has(css(".transactions__link--long-hash", text: "0xSk8"))
|> assert_has(css(".transactions__link--long-hash", text: "0xrazerscooter"))
end
test "can filter to only see transactions to an address", %{session: session} do
session
|> visit("/en/addresses/0xlincoln")
|> click(css(".address__link", text: "To")) |> click(css(".address__link", text: "To"))
|> assert_has(css(".transactions__link--long-hash", text: "0xSk8")) |> assert_has(css(".transactions__link--long-hash", text: "0xSk8"))
|> refute_has(css(".transactions__link--long-hash", text: "0xrazerscooter")) |> refute_has(css(".transactions__link--long-hash", text: "0xrazerscooter"))
end
test "can filter to only see transactions from an address", %{session: session} do
session
|> visit("/en/addresses/0xlincoln")
|> click(css(".address__link", text: "From")) |> click(css(".address__link", text: "From"))
|> assert_has(css(".transactions__link--long-hash", text: "0xSk8")) |> assert_has(css(".transactions__link--long-hash", text: "0xrazerscooter"))
|> refute_has(css(".transactions__link--long-hash", text: "0xSk8"))
end
end end
test "views addresses", %{session: session} do test "views addresses", %{session: session} do

Loading…
Cancel
Save