Skip to content

Instantly share code, notes, and snippets.

@owen2345
Last active November 1, 2020 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owen2345/26ab63cbe6af0f2194886c21417c49c1 to your computer and use it in GitHub Desktop.
Save owen2345/26ab63cbe6af0f2194886c21417c49c1 to your computer and use it in GitHub Desktop.
Configure e2e tests using cypress for dockerized projects
#// .github/actions/ruby.yml => Google actions
# Note: Includes error silence to avoid invalid "exit 0" when opening cypress service (cypress bug)
- name: E2e tests
run: docker-compose run test_content_service bash -c "CI=true foreman start -f Procfile-test-e2e 2> /dev/null"
if: ${{env.FRONTEND_CHANGED}}
#// Procfile-e2e ==> Start all required services (rails, react app and then init cypress awaiting for react port)
test_api_server: rm -f tmp/pids/server-test.pid; bundle exec rails s -e test -p 3031 -b '0.0.0.0' --pid tmp/pids/server-test.pid
frontend: cd frontend/ && PORT=3030 BROWSER=none RAILS_PORT=3031 yarn start test --silent
e2e-test: cd frontend/ && yarn install && yarn wait-on tcp:3030 && CYPRESS_BASE_URL=http://localhost:3030 CYPRESS_BACKEND_URL=http://localhost:3031 yarn cypress run
#// Dockerfile => Add int Dockerfile (cypress dependencies)
RUN apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment