From d2177aca8bdeaaa9c2ad37b6838c96258379dc2b Mon Sep 17 00:00:00 2001 From: Doc Ritezel Date: Tue, 16 Jan 2018 22:55:42 -0800 Subject: [PATCH] Run tests with headless chrome --- .gitignore | 5 ++++- circle.yml | 24 ++++++++++++++++++------ config/test.exs | 4 ++++ mix.exs | 6 +++--- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index d5be28f8b3..1c9e1f73c7 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,7 @@ npm-debug.log # Alternatively, you may comment the line below and commit the # secrets files as long as you replace their contents by environment # variables. -/config/*.secret.exs \ No newline at end of file +/config/*.secret.exs + +# Wallaby screenshots +screenshots/ diff --git a/circle.yml b/circle.yml index f193c06ec2..967acc5639 100644 --- a/circle.yml +++ b/circle.yml @@ -1,3 +1,7 @@ +general: + artifacts: + - screenshots + machine: environment: PATH: "$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH" @@ -11,12 +15,15 @@ machine: - mkdir -p $CIRCLE_TEST_REPORTS/eslint dependencies: - cache_directories: - - ~/.asdf - - _build - - deps - - assets/node_modules pre: + - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + - sudo dpkg -i google-chrome-stable_current_amd64.deb + - sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome + - rm google-chrome-stable_current_amd64.deb + - "LATEST_RELEASE=`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE` && wget https://chromedriver.storage.googleapis.com/${LATEST_RELEASE}/chromedriver_linux64.zip" + - unzip chromedriver_linux64.zip + - sudo cp chromedriver /usr/local/bin/chromedriver + - sudo chmod +x /usr/local/bin/chromedriver - if ! asdf | grep version; then git clone https://github.com/HashNuke/asdf.git ~/.asdf; fi - if ! asdf plugin-list | grep erlang; then asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git; fi - if ! asdf plugin-list | grep elixir; then asdf plugin-add elixir https://github.com/HashNuke/asdf-elixir.git; fi @@ -24,9 +31,14 @@ dependencies: timeout: 3600 - awk '/elixir/ { print $2 }' .tool-versions | xargs asdf install elixir: timeout: 3600 + override: - yes | mix do deps.get, local.rebar, deps.compile, compile - cd assets && npm install && cd .. - + cache_directories: + - ~/.asdf + - _build + - deps + - assets/node_modules test: pre: diff --git a/config/test.exs b/config/test.exs index cfa6c0d32a..0b76c4ca1d 100644 --- a/config/test.exs +++ b/config/test.exs @@ -17,3 +17,7 @@ config :explorer, Explorer.Repo, database: "explorer_test", hostname: "localhost", pool: Ecto.Adapters.SQL.Sandbox + +config :wallaby, + screenshot_on_failure: true, + chrome: [headless: false] diff --git a/mix.exs b/mix.exs index 7271256fef..a4614e24e4 100644 --- a/mix.exs +++ b/mix.exs @@ -39,14 +39,14 @@ defmodule Explorer.Mixfile do [ {:phoenix, "~> 1.3.0"}, {:phoenix_pubsub, "~> 1.0"}, - {:phoenix_pubsub_redis, "~> 2.1.0"}, + {:phoenix_pubsub_redis, "~> 2.1.0", only: [:prod]}, {:phoenix_ecto, "~> 3.2"}, {:postgrex, ">= 0.0.0"}, {:phoenix_html, "~> 2.10"}, - {:phoenix_live_reload, "~> 1.0", only: :dev}, + {:phoenix_live_reload, "~> 1.0", only: [:dev]}, {:gettext, "~> 0.11"}, {:cowboy, "~> 1.0"}, - {:wallaby, "~> 0.19.2", [runtime: false, only: :test]}, + {:wallaby, "~> 0.19.2", only: [:test], runtime: false}, {:junit_formatter, ">= 0.0.0"}, {:credo, "~> 0.8", only: [:dev, :test], runtime: false} ]