Fix 'DBConnection.OwnershipError' in feature tests.

* Add sandbox config to shared mode when test is async false.
pull/1289/head
Amanda Sposito 6 years ago committed by Luke Imhoff
parent b48a53efec
commit 5fb1347bf4
  1. 2
      apps/block_scout_web/test/block_scout_web/features/viewing_blocks_test.exs
  2. 2
      apps/block_scout_web/test/block_scout_web/features/viewing_transactions_test.exs
  3. 6
      apps/block_scout_web/test/support/feature_case.ex

@ -1,5 +1,5 @@
defmodule BlockScoutWeb.ViewingBlocksTest do
use BlockScoutWeb.FeatureCase, async: true
use BlockScoutWeb.FeatureCase, async: false
alias BlockScoutWeb.{BlockListPage, BlockPage}
alias Explorer.Chain.Block

@ -1,7 +1,7 @@
defmodule BlockScoutWeb.ViewingTransactionsTest do
@moduledoc false
use BlockScoutWeb.FeatureCase, async: true
use BlockScoutWeb.FeatureCase, async: false
alias BlockScoutWeb.{AddressPage, TransactionListPage, TransactionLogsPage, TransactionPage}
alias Explorer.Chain.Wei

@ -20,9 +20,13 @@ defmodule BlockScoutWeb.FeatureCase do
end
end
setup do
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, {:shared, self()})
end
metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for(Explorer.Repo, self())
{:ok, session} = Wallaby.start_session(metadata: metadata)
session = Wallaby.Browser.resize_window(session, 1200, 800)

Loading…
Cancel
Save