⚠️ This project relies heavily on https://github.com/hitobito/development, so you might start there and get it working before checking out this repo.
git clone https://github.com/scout-ch/midata-cypress.git
cd midata-cypress
git clone https://github.com/hitobito/development.git
cd development/app
git clone https://github.com/hitobito/hitobito.git
git clone https://github.com/hitobito/hitobito_youth.git
git clone https://github.com/hitobito/hitobito_pbs.git
cd ../..
docker-compose pull
docker volume create hitobito_bundle
docker volume create hitobito_yarn_cache
docker-compose run --rm cypress
# edit tests and continue…
# when finished:
docker-compose down
Generally check the docs:
docker-compose run --rm cypress
# edit tests and continue…
# when finished:
docker-compose down
If you want to run the tests against a running dev server:
docker-compose run --rm --no-deps -e CYPRESS_BASE_URL=http://rails:3000 cypress
Note: You can only connect to servers running inside docker-compose. If you need to connect to servers outside (aka you only wan't to run cypress in docker), check here.
docker-compose up -d rails worker
- Install yarn
- Install the testing dependencies (might take a while):
yarn install --frozen-lockfile
yarn run ci:wait && yarn run cypress:open
- Start adding tests, they get rerun automatically when open!
- Run
xhost local:root
to allow the root user from the Docker container to send messages to the X server docker-compose run cypress-gui
This will run hitobito with Cypress (if it is not already running), wait for the seeding to finish and then open the Cypress GUI.
It is probably easier, faster and cleaner to use cypress directly (check above).
- Install the XQuartz X11 server (
brew cask install xquartz
) and restart your machine - Open XQuartz, go to settings and "Allow connections from network clients" (further reference here)
- In the project directory, run
IP=$(ipconfig getifaddr en0)
. (You might want to adjust theen0
to your network interface of choice…) - Run
xhost + $IP
to allow the Docker container to send messages to the X server - Run
DISPLAY=$IP:0 docker-compose run cypress-gui
_ Not yet tested_
https://dev.to/darksmile92/run-gui-app-in-linux-docker-container-on-windows-host-4kde
When you have set everything up, you should be able to start the same as on the mac…
If you don't want to run the test server on port 3000 or on another host you can either edit the baseURL in .docker/cypress/spec/cypress.json
or set an env var before starting: export CYPRESS_BASE_URL=http://localhost:8080