Starting & stopping chromedriver for end-to-end tests with hound

I am trying to find a good way to automatically start and stop chromedriver when running ExUnit tests with hound in my Phoenix application.

Starting chromedriver with porcelain in the setup_all callback works, but there is no corresponding on_exit_all function to stop it after all tests ran. It also doesn’t work to start chromedriver per test, since then hound complains that no webdriver is running.

I’ve also considered adding a genserver that would start/stop the webdriver to “extra_applications” or to use start_supervised in the test itself, all without success.

Is there a neat way to integrate this in Phoenix or should I just write a shell script instead?

4 Likes