I try to run external automation app for my elixir/phoenix application but I got error:
could not lookup Ecto repo Automation.Repo because it was not started or it does not exist
my code on the automation app:
setup do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Automation.Repo)
metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for(Automation.Repo, self())|>IO.inspect()
{:ok, session} = Wallaby.start_session([metadata: metadata, capabilities: %{browserName: "chrome"}])
%{session: session}
end
test "test", session do
session.session
|> visit("http://localhost:4000/topics/new")
end
The automation config:
config :automation, Automation.Repo,
adapter: Ecto.Adapters.Postgres,
username: "user",
password: "",
database: "my_app_dev",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
In the app code:
On endpoint file:
if Application.get_env(:my_app, :sql_sandbox) do
plug Phoenix.Ecto.SQL.Sandbox
end
And on config file:
config :my_app, MyApp.Repo,
adapter: Ecto.Adapters.Postgres,
username: "user",
password: "",
database: "my_app_dev",
hostname: "localhost",
pool_size: 10
config :my_app, :sql_sandbox, true