diff --git a/apps/explorer_web/assets/css/_typography.scss b/apps/explorer_web/assets/css/_typography.scss index 0e0cc4914c..cbdacb91c4 100644 --- a/apps/explorer_web/assets/css/_typography.scss +++ b/apps/explorer_web/assets/css/_typography.scss @@ -52,6 +52,6 @@ a { } .contract-address { - text-decoration: underline; - text-decoration-style: dashed; + border-bottom: 1px dashed currentColor; + display: inline-block; } diff --git a/apps/explorer_web/assets/css/components/_tile.scss b/apps/explorer_web/assets/css/components/_tile.scss index 52a77c7b50..19a1ade3a7 100644 --- a/apps/explorer_web/assets/css/components/_tile.scss +++ b/apps/explorer_web/assets/css/components/_tile.scss @@ -22,7 +22,7 @@ &-transaction { border-left: 4px solid $blue; - .tile-label, .tile-text-highlight { + .tile-label { color: $blue; } } @@ -51,7 +51,7 @@ &-token { border-left: 4px solid $orange; - .tile-label, .tile-text-highlight { + .tile-label { color: $orange; } } @@ -59,18 +59,38 @@ &-internal-transaction { border-left: 4px solid $teal; - .tile-label, .tile-text-highlight { + .tile-label { color: $teal; } } } + &-status { + &--failed { + border-top: 1px solid lighten($danger, 10%); + border-right: 1px solid lighten($danger, 10%); + border-bottom: 1px solid lighten($danger, 10%); + + .tile-status-label { + color: $danger; + } + } + &--out_of_gas { + border-top: 1px solid lighten($warning, 10%); + border-right: 1px solid lighten($warning, 10%); + border-bottom: 1px solid lighten($warning, 10%); + + .tile-status-label { + color: $warning; + } + } + } + .tile-title { font-size: 14px; font-weight: 600; color: $gray-700; margin-bottom: 0; - display: block; } } diff --git a/apps/explorer_web/assets/css/theme/_poa_variables.scss b/apps/explorer_web/assets/css/theme/_poa_variables.scss index b9571921bf..39a0559089 100644 --- a/apps/explorer_web/assets/css/theme/_poa_variables.scss +++ b/apps/explorer_web/assets/css/theme/_poa_variables.scss @@ -38,7 +38,7 @@ $blue: #4786ff !default; $indigo: #5b33a1 !default; $purple: #9987fc !default; $pink: #e83e8c !default; -$red: #dc3545 !default; +$red: #c74d39 !default; $orange: #ef9a60 !default; $yellow: #ffc107 !default; $green: #20b760 !default; diff --git a/apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex b/apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex index 2a4bd40ff5..3c4d8b7dd4 100644 --- a/apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex @@ -18,14 +18,16 @@ <%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.InternalTransactionView.to_address_hash(@internal_transaction), contract: ExplorerWeb.AddressView.contract?(@internal_transaction.to_address), locale: @locale %> <% end %> - <%= ExplorerWeb.TransactionView.value(@internal_transaction, include_label: false) %> POA - -
<%= if @address.hash == @internal_transaction.from_address_hash do %> - OUT + <%= gettext "OUT" %> <% else %> - IN + <%= gettext "IN" %> <% end %>
+
+ + <%= ExplorerWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= gettext "Ether" %> + +
diff --git a/apps/explorer_web/lib/explorer_web/templates/address_transaction/_transaction.html.eex b/apps/explorer_web/lib/explorer_web/templates/address_transaction/_transaction.html.eex index 5f09240e84..213874f705 100644 --- a/apps/explorer_web/lib/explorer_web/templates/address_transaction/_transaction.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/address_transaction/_transaction.html.eex @@ -1,7 +1,12 @@ -
+
-
- <%= ExplorerWeb.TransactionView.transaction_display_type(@transaction) %> +
+ + <%= ExplorerWeb.TransactionView.transaction_display_type(@transaction) %> + +
+ <%= ExplorerWeb.TransactionView.formatted_status(@transaction) %> +
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transaction.hash %> @@ -11,6 +16,7 @@ <% else %> <%= render ExplorerWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(@transaction.from_address), locale: @locale %> <% end %> + → <%= if @address.hash == ExplorerWeb.TransactionView.to_address_hash(@transaction) do %> <%= render ExplorerWeb.AddressView, "_responsive_hash.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address) %> @@ -18,19 +24,26 @@ <%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address), locale: @locale %> <% end %> - <%= ExplorerWeb.TransactionView.value(@transaction, include_label: false) %> POA + + <%= if @address.hash == @transaction.from_address_hash do %> + <%= gettext "OUT" %> + <% else %> + <%= gettext "IN" %> + <% end %> + + + <%= link( + gettext("Block #%{number}", number: to_string(@transaction.block.number)), + to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block) + ) %> + +
-
- <%= if @address.hash == @transaction.from_address_hash do %> - OUT - <% else %> - IN - <% end %> - - <%= link( - gettext("Block #") <> "#{@transaction.block.number}", - to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block) - ) %> +
+ + <%= ExplorerWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %> + + <%= ExplorerWeb.TransactionView.formatted_fee(@transaction, denomination: :ether) %> <%= gettext "Fee" %>
diff --git a/apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex b/apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex index c352798744..4c3e548756 100644 --- a/apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex @@ -148,8 +148,8 @@ <%= for transaction <- @transactions do %> - -
+ +
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: transaction.hash %> diff --git a/apps/explorer_web/lib/explorer_web/templates/chain/_transactions.html.eex b/apps/explorer_web/lib/explorer_web/templates/chain/_transactions.html.eex index 07339a624e..09ebf2599d 100644 --- a/apps/explorer_web/lib/explorer_web/templates/chain/_transactions.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/chain/_transactions.html.eex @@ -3,26 +3,36 @@ <%= link(gettext("View All Transactions →"), to: transaction_path(@conn, :index, Gettext.get_locale), class: "button button--secondary button--xsmall float-right") %>

<%= gettext "Transactions" %>

<%= for transaction <- @chain.transactions do %> -
+
-
- <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %> +
+
+ <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %> +
<%= ExplorerWeb.TransactionView.formatted_status(transaction) %>
+
- <%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: transaction.hash %> + <%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: transaction.hash %> <%= render ExplorerWeb.AddressView, "_link.html", address_hash: transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(transaction.from_address), locale: @locale %> → <%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(transaction), contract: ExplorerWeb.AddressView.contract?(transaction.to_address), locale: @locale %> - <%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> POA + + + + <%= link( + gettext("Block #%{number}", number: to_string(transaction.block.number)), + to: block_path(@conn, :show, @conn.assigns.locale, transaction.block) + ) %> + +
-
- - <%= link( - gettext("Block #") <> "#{transaction.block.number}", - to: block_path(@conn, :show, @conn.assigns.locale, transaction.block) - ) %> +
+ + <%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> <%= gettext "Ether" %> + + <%= ExplorerWeb.TransactionView.formatted_fee(transaction, denomination: :ether) %> <%= gettext "Fee" %>
diff --git a/apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex b/apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex index 0ffddd3ba5..99d1b55ec6 100644 --- a/apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex @@ -27,10 +27,12 @@ <%= for transaction <- @transactions do %>
-
- <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %> +
+
+ <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %> +
<%= ExplorerWeb.TransactionView.formatted_status(transaction) %>
+
-
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: transaction.hash %> @@ -42,7 +44,7 @@ <%= gettext("Contract Address Pending") %> <% end %> - <%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> POA + <%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> <%= gettext "Ether" %>
diff --git a/apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex b/apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex index 6b65e9f613..c484ab9305 100644 --- a/apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex @@ -25,12 +25,14 @@

<%= gettext("Showing %{count} Validated Transactions", count: Cldr.Number.to_string!(@transaction_estimated_count, format: "#,###")) %>

<%= for transaction <- @transactions do %> -
+
-
- <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %> +
+
+ <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %> +
<%= ExplorerWeb.TransactionView.formatted_status(transaction) %>
+
-
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: transaction.hash %> @@ -38,14 +40,19 @@ → <%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(transaction), contract: ExplorerWeb.AddressView.contract?(transaction.to_address), locale: @locale %> - <%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> POA + + + + <%= link( + gettext("Block #%{number}", number: to_string(transaction.block.number)), + to: block_path(@conn, :show, @conn.assigns.locale, transaction.block) + ) %> + +
-
- - <%= link( - gettext("Block #") <> "#{transaction.block.number}", - to: block_path(@conn, :show, @conn.assigns.locale, transaction.block) - ) %> +
+ <%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> <%= gettext "Ether" %> + <%= ExplorerWeb.TransactionView.formatted_fee(transaction, denomination: :ether) %> <%= gettext "Fee" %>
diff --git a/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex b/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex index facd8e0120..78870d81d1 100644 --- a/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex @@ -24,8 +24,8 @@ <%= gettext "Transaction Status" %> - <%= formatted_status(@transaction) %> -
+ <%= ExplorerWeb.TransactionView.formatted_status(@transaction) %> +
diff --git a/apps/explorer_web/lib/explorer_web/views/address_transaction_view.ex b/apps/explorer_web/lib/explorer_web/views/address_transaction_view.ex index abebb26c8c..9436597f8f 100644 --- a/apps/explorer_web/lib/explorer_web/views/address_transaction_view.ex +++ b/apps/explorer_web/lib/explorer_web/views/address_transaction_view.ex @@ -3,8 +3,6 @@ defmodule ExplorerWeb.AddressTransactionView do import ExplorerWeb.AddressView, only: [contract?: 1, smart_contract_verified?: 1] - alias ExplorerWeb.TransactionView - def format_current_filter(filter) do case filter do "to" -> gettext("To") @@ -12,6 +10,4 @@ defmodule ExplorerWeb.AddressTransactionView do _ -> gettext("All") end end - - defdelegate status(transaction), to: TransactionView end diff --git a/apps/explorer_web/lib/explorer_web/views/block_transaction_view.ex b/apps/explorer_web/lib/explorer_web/views/block_transaction_view.ex index 7156e56b72..0f84f5483d 100644 --- a/apps/explorer_web/lib/explorer_web/views/block_transaction_view.ex +++ b/apps/explorer_web/lib/explorer_web/views/block_transaction_view.ex @@ -1,8 +1,7 @@ defmodule ExplorerWeb.BlockTransactionView do use ExplorerWeb, :view - alias ExplorerWeb.{BlockView, TransactionView} + alias ExplorerWeb.BlockView defdelegate formatted_timestamp(block), to: BlockView - defdelegate status(transacton), to: TransactionView end diff --git a/apps/explorer_web/priv/gettext/default.pot b/apps/explorer_web/priv/gettext/default.pot index acdb360d19..69b77e6679 100644 --- a/apps/explorer_web/priv/gettext/default.pot +++ b/apps/explorer_web/priv/gettext/default.pot @@ -148,7 +148,7 @@ msgstr "" #: lib/explorer_web/templates/transaction/overview.html.eex:79 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:31 #: lib/explorer_web/views/address_internal_transaction_view.ex:9 -#: lib/explorer_web/views/address_transaction_view.ex:11 +#: lib/explorer_web/views/address_transaction_view.ex:9 msgid "From" msgstr "" @@ -167,7 +167,7 @@ msgstr "" #: lib/explorer_web/templates/transaction/overview.html.eex:91 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:32 #: lib/explorer_web/views/address_internal_transaction_view.ex:8 -#: lib/explorer_web/views/address_transaction_view.ex:10 +#: lib/explorer_web/views/address_transaction_view.ex:8 msgid "To" msgstr "" @@ -293,6 +293,11 @@ msgid "Showing #%{number}" msgstr "" #: lib/explorer_web/templates/address/_values.html.eex:4 +#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:29 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:44 +#: lib/explorer_web/templates/chain/_transactions.html.eex:33 +#: lib/explorer_web/templates/pending_transaction/index.html.eex:47 +#: lib/explorer_web/templates/transaction/index.html.eex:54 #: lib/explorer_web/templates/transaction/overview.html.eex:63 #: lib/explorer_web/templates/transaction/overview.html.eex:159 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:33 @@ -351,11 +356,13 @@ msgstr "" #: lib/explorer_web/templates/address_internal_transaction/index.html.eex:80 #: lib/explorer_web/templates/address_transaction/index.html.eex:91 #: lib/explorer_web/views/address_internal_transaction_view.ex:10 -#: lib/explorer_web/views/address_transaction_view.ex:12 +#: lib/explorer_web/views/address_transaction_view.ex:10 msgid "All" msgstr "" -#: lib/explorer_web/templates/address_transaction/index.html.eex:102 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:46 +#: lib/explorer_web/templates/chain/_transactions.html.eex:35 +#: lib/explorer_web/templates/transaction/index.html.eex:55 msgid "Fee" msgstr "" @@ -470,8 +477,8 @@ msgstr "" #: lib/explorer_web/templates/address_transaction/index.html.eex:138 #: lib/explorer_web/templates/block/index.html.eex:60 #: lib/explorer_web/templates/block_transaction/index.html.eex:198 -#: lib/explorer_web/templates/pending_transaction/index.html.eex:52 -#: lib/explorer_web/templates/transaction/index.html.eex:55 +#: lib/explorer_web/templates/pending_transaction/index.html.eex:54 +#: lib/explorer_web/templates/transaction/index.html.eex:62 msgid "Older" msgstr "" @@ -551,13 +558,6 @@ msgstr "" msgid "Twitter" msgstr "" -#, elixir-format -#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:31 -#: lib/explorer_web/templates/chain/_transactions.html.eex:23 -#: lib/explorer_web/templates/transaction/index.html.eex:46 -msgid "Block #" -msgstr "" - #, elixir-format #: lib/explorer_web/templates/chain/_blocks.html.eex:4 msgid "View All Blocks →" @@ -625,7 +625,7 @@ msgid "There are no transactions for this address." msgstr "" #, elixir-format -#: lib/explorer_web/templates/pending_transaction/index.html.eex:42 +#: lib/explorer_web/templates/pending_transaction/index.html.eex:44 msgid "Contract Address Pending" msgstr "" @@ -643,3 +643,24 @@ msgstr "" #: lib/explorer_web/templates/address/overview.html.eex:36 msgid "at" msgstr "" + +#, elixir-format +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:36 +#: lib/explorer_web/templates/chain/_transactions.html.eex:25 +#: lib/explorer_web/templates/transaction/index.html.eex:47 +msgid "Block #%{number}" +msgstr "" + +#, elixir-format +#: +#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:24 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:31 +msgid "IN" +msgstr "" + +#, elixir-format +#: +#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:22 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:29 +msgid "OUT" +msgstr "" diff --git a/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po index 5e5b6a9755..a5f8d932e7 100644 --- a/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po @@ -160,7 +160,7 @@ msgstr "Address" #: lib/explorer_web/templates/transaction/overview.html.eex:79 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:31 #: lib/explorer_web/views/address_internal_transaction_view.ex:9 -#: lib/explorer_web/views/address_transaction_view.ex:11 +#: lib/explorer_web/views/address_transaction_view.ex:9 msgid "From" msgstr "From" @@ -179,7 +179,7 @@ msgstr "Success" #: lib/explorer_web/templates/transaction/overview.html.eex:91 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:32 #: lib/explorer_web/views/address_internal_transaction_view.ex:8 -#: lib/explorer_web/views/address_transaction_view.ex:10 +#: lib/explorer_web/views/address_transaction_view.ex:8 msgid "To" msgstr "To" @@ -305,6 +305,11 @@ msgid "Showing #%{number}" msgstr "" #: lib/explorer_web/templates/address/_values.html.eex:4 +#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:29 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:44 +#: lib/explorer_web/templates/chain/_transactions.html.eex:33 +#: lib/explorer_web/templates/pending_transaction/index.html.eex:47 +#: lib/explorer_web/templates/transaction/index.html.eex:54 #: lib/explorer_web/templates/transaction/overview.html.eex:63 #: lib/explorer_web/templates/transaction/overview.html.eex:159 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:33 @@ -363,11 +368,13 @@ msgstr "" #: lib/explorer_web/templates/address_internal_transaction/index.html.eex:80 #: lib/explorer_web/templates/address_transaction/index.html.eex:91 #: lib/explorer_web/views/address_internal_transaction_view.ex:10 -#: lib/explorer_web/views/address_transaction_view.ex:12 +#: lib/explorer_web/views/address_transaction_view.ex:10 msgid "All" msgstr "" -#: lib/explorer_web/templates/address_transaction/index.html.eex:102 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:46 +#: lib/explorer_web/templates/chain/_transactions.html.eex:35 +#: lib/explorer_web/templates/transaction/index.html.eex:55 msgid "Fee" msgstr "" @@ -482,8 +489,8 @@ msgstr "" #: lib/explorer_web/templates/address_transaction/index.html.eex:138 #: lib/explorer_web/templates/block/index.html.eex:60 #: lib/explorer_web/templates/block_transaction/index.html.eex:198 -#: lib/explorer_web/templates/pending_transaction/index.html.eex:52 -#: lib/explorer_web/templates/transaction/index.html.eex:55 +#: lib/explorer_web/templates/pending_transaction/index.html.eex:54 +#: lib/explorer_web/templates/transaction/index.html.eex:62 msgid "Older" msgstr "" @@ -563,13 +570,6 @@ msgstr "" msgid "Twitter" msgstr "" -#, elixir-format -#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:31 -#: lib/explorer_web/templates/chain/_transactions.html.eex:23 -#: lib/explorer_web/templates/transaction/index.html.eex:46 -msgid "Block #" -msgstr "" - #, elixir-format #: lib/explorer_web/templates/chain/_blocks.html.eex:4 msgid "View All Blocks →" @@ -637,7 +637,7 @@ msgid "There are no transactions for this address." msgstr "" #, elixir-format -#: lib/explorer_web/templates/pending_transaction/index.html.eex:42 +#: lib/explorer_web/templates/pending_transaction/index.html.eex:44 msgid "Contract Address Pending" msgstr "" @@ -655,3 +655,24 @@ msgstr "" #: lib/explorer_web/templates/address/overview.html.eex:36 msgid "at" msgstr "" + +#, elixir-format, fuzzy +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:36 +#: lib/explorer_web/templates/chain/_transactions.html.eex:25 +#: lib/explorer_web/templates/transaction/index.html.eex:47 +msgid "Block #%{number}" +msgstr "" + +#, elixir-format +#: +#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:24 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:31 +msgid "IN" +msgstr "" + +#, elixir-format +#: +#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:22 +#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:29 +msgid "OUT" +msgstr "" diff --git a/apps/explorer_web/test/explorer_web/features/pages/address_page.ex b/apps/explorer_web/test/explorer_web/features/pages/address_page.ex index 79c81a3ae1..ac9f77cc6a 100644 --- a/apps/explorer_web/test/explorer_web/features/pages/address_page.ex +++ b/apps/explorer_web/test/explorer_web/features/pages/address_page.ex @@ -67,6 +67,10 @@ defmodule ExplorerWeb.AddressPage do css("[data-test='transaction_count']") end + def transaction_status(%Transaction{hash: transaction_hash}) do + css("[data-transaction-hash='#{transaction_hash}'] [data-test='transaction_status']") + end + def visit_page(session, %Address{hash: address_hash}), do: visit_page(session, address_hash) def visit_page(session, address_hash) do diff --git a/apps/explorer_web/test/explorer_web/features/pages/block_page.ex b/apps/explorer_web/test/explorer_web/features/pages/block_page.ex index b732b3c39d..087a729828 100644 --- a/apps/explorer_web/test/explorer_web/features/pages/block_page.ex +++ b/apps/explorer_web/test/explorer_web/features/pages/block_page.ex @@ -3,9 +3,9 @@ defmodule ExplorerWeb.BlockPage do use Wallaby.DSL - import Wallaby.Query, only: [css: 2] + import Wallaby.Query, only: [css: 1, css: 2] - alias Explorer.Chain.{Block, InternalTransaction} + alias Explorer.Chain.{Block, InternalTransaction, Transaction} def contract_creation(%InternalTransaction{created_contract_address_hash: hash}) do css("[data-address-hash='#{hash}']", text: "Contract Creation") @@ -15,6 +15,14 @@ defmodule ExplorerWeb.BlockPage do css("[data-test='block_detail_number']", text: to_string(block_number)) end + def transaction(%Transaction{hash: transaction_hash}) do + css("[data-transaction-hash='#{transaction_hash}']") + end + + def transaction_status(%Transaction{hash: transaction_hash}) do + css("[data-transaction-hash='#{transaction_hash}'] [data-test='transaction_status']") + end + def visit_page(session, %Block{number: block_number}) do visit(session, "/en/blocks/#{block_number}/transactions") end diff --git a/apps/explorer_web/test/explorer_web/features/pages/home_page.ex b/apps/explorer_web/test/explorer_web/features/pages/home_page.ex index 804bba10e3..582b7287cb 100644 --- a/apps/explorer_web/test/explorer_web/features/pages/home_page.ex +++ b/apps/explorer_web/test/explorer_web/features/pages/home_page.ex @@ -5,7 +5,7 @@ defmodule ExplorerWeb.HomePage do import Wallaby.Query, only: [css: 1, css: 2] - alias Explorer.Chain.InternalTransaction + alias Explorer.Chain.{InternalTransaction, Transaction} def blocks(count: count) do css("[data-test='chain_block']", count: count) @@ -25,6 +25,10 @@ defmodule ExplorerWeb.HomePage do css("[data-test='chain_transaction']", count: count) end + def transaction_status(%Transaction{hash: transaction_hash}) do + css("[data-transaction-hash='#{transaction_hash}'] [data-test='transaction_status']") + end + def visit_page(session) do visit(session, "/") end diff --git a/apps/explorer_web/test/explorer_web/features/pages/transaction_list_page.ex b/apps/explorer_web/test/explorer_web/features/pages/transaction_list_page.ex index 9b2071cc16..68963594e8 100644 --- a/apps/explorer_web/test/explorer_web/features/pages/transaction_list_page.ex +++ b/apps/explorer_web/test/explorer_web/features/pages/transaction_list_page.ex @@ -23,6 +23,10 @@ defmodule ExplorerWeb.TransactionListPage do css("[data-transaction-hash='#{transaction_hash}']") end + def transaction_status(%Transaction{hash: transaction_hash}) do + css("[data-transaction-hash='#{transaction_hash}'] [data-test='transaction_status']") + end + def visit_page(session) do visit(session, "/en/transactions") end diff --git a/apps/explorer_web/test/explorer_web/features/viewing_addresses_test.exs b/apps/explorer_web/test/explorer_web/features/viewing_addresses_test.exs index c588bae319..827324ca25 100644 --- a/apps/explorer_web/test/explorer_web/features/viewing_addresses_test.exs +++ b/apps/explorer_web/test/explorer_web/features/viewing_addresses_test.exs @@ -115,6 +115,7 @@ defmodule ExplorerWeb.ViewingAddressesTest do |> AddressPage.visit_page(addresses.lincoln) |> assert_has(AddressPage.transaction(transactions.from_taft)) |> assert_has(AddressPage.transaction(transactions.from_lincoln)) + |> assert_has(AddressPage.transaction_status(transactions.from_lincoln)) end test "can filter to only see transactions from an address", %{ diff --git a/apps/explorer_web/test/explorer_web/features/viewing_blocks_test.exs b/apps/explorer_web/test/explorer_web/features/viewing_blocks_test.exs index 01d43f6f77..1d86f3dd44 100644 --- a/apps/explorer_web/test/explorer_web/features/viewing_blocks_test.exs +++ b/apps/explorer_web/test/explorer_web/features/viewing_blocks_test.exs @@ -43,6 +43,21 @@ defmodule ExplorerWeb.ViewingBlocksTest do |> assert_has(BlockPage.detail_number(block)) end + test "block detail page has transactions", %{session: session} do + block = insert(:block, number: 42) + + transaction = + :transaction + |> insert() + |> with_block(block) + + session + |> BlockPage.visit_page(block) + |> assert_has(BlockPage.detail_number(block)) + |> assert_has(BlockPage.transaction(transaction)) + |> assert_has(BlockPage.transaction_status(transaction)) + end + test "contract creation is shown for to_address in transaction list", %{session: session} do block = insert(:block, number: 42) diff --git a/apps/explorer_web/test/explorer_web/features/viewing_transactions_test.exs b/apps/explorer_web/test/explorer_web/features/viewing_transactions_test.exs index 64c753ddc5..ffaea76eae 100644 --- a/apps/explorer_web/test/explorer_web/features/viewing_transactions_test.exs +++ b/apps/explorer_web/test/explorer_web/features/viewing_transactions_test.exs @@ -94,6 +94,7 @@ defmodule ExplorerWeb.ViewingTransactionsTest do session |> TransactionListPage.visit_page() |> assert_has(TransactionListPage.transaction(transaction)) + |> assert_has(TransactionListPage.transaction_status(transaction)) |> refute_has(TransactionListPage.transaction(pending)) end @@ -103,6 +104,7 @@ defmodule ExplorerWeb.ViewingTransactionsTest do |> TransactionListPage.click_pending() |> assert_has(TransactionListPage.transaction(pending)) |> assert_has(TransactionListPage.transaction(pending_contract)) + |> assert_has(TransactionListPage.transaction_status(pending_contract)) end test "contract creation is shown for to_address on list page", %{session: session} do