Front End Testing using Elixir

oh you will very much want to do this at the head of your mix task or else you’ll be wondering why nothing works:

    Application.ensure_all_started(:hound)
    Chromedriver.ensure_running()
# linux, very hacky, MacOS - ymmv
  @spec ensure_running(non_neg_integer) :: :ok
  def ensure_running(sleep_time \\ 500) do
    {ps, _} = System.cmd("ps", ["aux"])
    unless ps =~ "chromedriver" do
      chromedriver_executable = System.find_executable("chromedriver")

      {:ok, _pid} = Task.start(fn ->
        System.cmd(chromedriver_executable, [], stderr_to_stdout: true)
      end)

      Process.sleep(sleep_time)
    end
    :ok
  end