|
|
|
@ -14,7 +14,8 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
gas_used: 123_987 |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
4 |
|
|
|
|
[oldest_transaction | _] = |
|
|
|
|
3 |
|
|
|
|
|> insert_list(:transaction) |
|
|
|
|
|> with_block() |
|
|
|
|
|
|
|
|
@ -24,7 +25,13 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
lincoln = insert(:address) |
|
|
|
|
taft = insert(:address) |
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
|
# From Lincoln to Taft. |
|
|
|
|
txn_from_lincoln = |
|
|
|
|
:transaction |
|
|
|
|
|> insert(from_address: lincoln, to_address: taft) |
|
|
|
|
|> with_block(block) |
|
|
|
|
|
|
|
|
|
newest_transaction = |
|
|
|
|
:transaction |
|
|
|
|
|> insert( |
|
|
|
|
value: Wei.from(Decimal.new(5656), :ether), |
|
|
|
@ -39,15 +46,9 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
) |
|
|
|
|
|> with_block(block, gas_used: Decimal.new(1_230_000_000_000_123_000), status: :ok) |
|
|
|
|
|
|
|
|
|
insert(:log, address: lincoln, index: 0, transaction: transaction) |
|
|
|
|
|
|
|
|
|
# From Lincoln to Taft. |
|
|
|
|
txn_from_lincoln = |
|
|
|
|
:transaction |
|
|
|
|
|> insert(from_address: lincoln, to_address: taft) |
|
|
|
|
|> with_block(block) |
|
|
|
|
insert(:log, address: lincoln, index: 0, transaction: newest_transaction) |
|
|
|
|
|
|
|
|
|
internal = insert(:internal_transaction, index: 0, transaction: transaction) |
|
|
|
|
internal = insert(:internal_transaction, index: 0, transaction: newest_transaction) |
|
|
|
|
|
|
|
|
|
{:ok, |
|
|
|
|
%{ |
|
|
|
@ -56,7 +57,8 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
internal: internal, |
|
|
|
|
lincoln: lincoln, |
|
|
|
|
taft: taft, |
|
|
|
|
transaction: transaction, |
|
|
|
|
first_shown_transaction: newest_transaction, |
|
|
|
|
last_shown_transaction: oldest_transaction, |
|
|
|
|
txn_from_lincoln: txn_from_lincoln |
|
|
|
|
}} |
|
|
|
|
end |
|
|
|
@ -77,6 +79,24 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
|> assert_has(HomePage.transactions(count: 5)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "viewing new transactions via live update on the homepage", %{session: session, last_shown_transaction: last_shown_transaction} do |
|
|
|
|
session |
|
|
|
|
|> HomePage.visit_page() |
|
|
|
|
|> assert_has(HomePage.transactions(count: 5)) |
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
|
:transaction |
|
|
|
|
|> insert() |
|
|
|
|
|> with_block() |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :transactions, [transaction.hash]}) |
|
|
|
|
|
|
|
|
|
session |
|
|
|
|
|> assert_has(HomePage.transactions(count: 5)) |
|
|
|
|
|> assert_has(HomePage.transaction(transaction)) |
|
|
|
|
|> refute_has(HomePage.transaction(last_shown_transaction)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "contract creation is shown for to_address on home page", %{session: session} do |
|
|
|
|
transaction = |
|
|
|
|
:transaction |
|
|
|
@ -90,7 +110,7 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
|> assert_has(HomePage.contract_creation(internal_transaction)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "viewing the default transactions tab", %{session: session, transaction: transaction, pending: pending} do |
|
|
|
|
test "viewing the default transactions tab", %{session: session, first_shown_transaction: transaction, pending: pending} do |
|
|
|
|
session |
|
|
|
|
|> TransactionListPage.visit_page() |
|
|
|
|
|> assert_has(TransactionListPage.transaction(transaction)) |
|
|
|
@ -122,20 +142,20 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "viewing a transaction page" do |
|
|
|
|
test "can navigate to transaction show from list page", %{session: session, transaction: transaction} do |
|
|
|
|
test "can navigate to transaction show from list page", %{session: session, first_shown_transaction: transaction} do |
|
|
|
|
session |
|
|
|
|
|> TransactionListPage.visit_page() |
|
|
|
|
|> TransactionListPage.click_transaction(transaction) |
|
|
|
|
|> assert_has(TransactionPage.detail_hash(transaction)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "can see a transaction's details", %{session: session, transaction: transaction} do |
|
|
|
|
test "can see a transaction's details", %{session: session, first_shown_transaction: transaction} do |
|
|
|
|
session |
|
|
|
|
|> TransactionPage.visit_page(transaction) |
|
|
|
|
|> assert_has(TransactionPage.detail_hash(transaction)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "can view a transaction's logs", %{session: session, transaction: transaction} do |
|
|
|
|
test "can view a transaction's logs", %{session: session, first_shown_transaction: transaction} do |
|
|
|
|
session |
|
|
|
|
|> TransactionPage.visit_page(transaction) |
|
|
|
|
|> TransactionPage.click_logs() |
|
|
|
@ -145,7 +165,7 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
test "can visit an address from the transaction logs page", %{ |
|
|
|
|
lincoln: lincoln, |
|
|
|
|
session: session, |
|
|
|
|
transaction: transaction |
|
|
|
|
first_shown_transaction: transaction |
|
|
|
|
} do |
|
|
|
|
session |
|
|
|
|
|> TransactionLogsPage.visit_page(transaction) |
|
|
|
@ -153,7 +173,7 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |
|
|
|
|
|> assert_has(AddressPage.detail_hash(lincoln)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "block confirmations via live update", %{session: session, transaction: transaction} do |
|
|
|
|
test "block confirmations via live update", %{session: session, first_shown_transaction: transaction} do |
|
|
|
|
blocks = [insert(:block, number: transaction.block_number + 10)] |
|
|
|
|
|
|
|
|
|
TransactionPage.visit_page(session, transaction) |
|
|
|
|