avh4 / elm-program-test

Test Elm programs
https://elm-program-test.netlify.com/
MIT License
93 stars 27 forks source link

Feature request: Add ProgramTest.ensurePageChange #165

Open jfmengels opened 2 years ago

jfmengels commented 2 years ago

There is a expectPageChange function in the API, but there is no ensurePageChange.

Context

We would like to have a test that asserts the flow of multiple pages, and the flow includes a click on a link.

-- ...
  |> ProgramTest.clickLink "Text" "href"
  |> ProgramTest.ensurePageChange "/href"
  -- do more assertions once the page has changed

Is there a limitation in the framework to do this, or is it counter to the philosophy of the tool?

avh4 commented 2 years ago

ensurePageChange is meant for when you clicked a link that your app doesn't handle, so the browser is handling it and navigating you to a new URL, so this would correspond to the Elm app being destroyed!