I have a Liveview page that forwards 3rd party webhook to my local machine and I want to test this functionality.
test "forward webhooks?" do
{:ok, lv, html} = live(conn, path())
target_domain = MyAppWeb.Endpoint.url()
# This returns http://localhost:4003
assert webhook_flash =
lv
|> element("#flash-info-0")
|> render()
end
If it is successful, lv should have #flash-info-0
flash message. But I can’t foward a webhook to target domain.
But, If I run mix phx.server
then forward to http://localhost:4000
it works.
So I updated test.exs file to run a test server
config :my_app, MyAppWeb.Endpoint,
url: [host: "localhost", port: 4003],
secret_key_base: "secret"
server: true
But still failed to forward.
What am I doing wrong?