I have a feature test written like this:
confirmation_page = visit(session, "/confirm/#{id}")
confirmation_page
|> click(link("Decline"))
confirmation_page
|> assert_text("You have declined.")
However the test always fails, because in controller, on click of this page, I am doing this:
conn
|> put_flash(:info, "You have declined.")
|> redirect(to: Routes.group_path(conn, :show, group.slug))
So the flash is coming on the redirected page, and not the original page. How can I wait for the redirect and assert on the new page?