Skip to content

Commit

Permalink
Manually setup Cypress in CI e2e_test job
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Jul 22, 2022
1 parent 11a0d2e commit 8375e2a
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ jobs:
name: Run E2E tests
needs: [version, build]
runs-on: ubuntu-22.04
# Mandatory for Firefox to work
# https://github.com/cypress-io/github-action#firefox
container:
image: cypress/browsers:latest
options: --user 1001
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
Expand All @@ -161,6 +156,35 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
cache-dependency-path: ./frontend/package-lock.json
node-version: 18

# https://docs.cypress.io/guides/getting-started/installing-cypress#Linux-Prerequisites
- name: Install Cypress dependencies
run: |
sudo apt-get install -y \
firefox \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb
- name: Install Node.js dependencies
uses: cypress-io/github-action@v4
run: npm ci
working-directory: ./frontend

- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
with:
Expand All @@ -173,16 +197,10 @@ jobs:
run: until $(curl --output /dev/null --silent --fail "http://localhost:8081/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=monitorfish:regulations&outputFormat=application/json&CQL_FILTER=topic=%27Ouest%20Cotentin%20Bivalves%27%20AND%20zone=%27Praires%20Ouest%20cotentin%27"); do printf '.'; sleep 5; done;

- name: Run Cypress tests
uses: cypress-io/github-action@v4
with:
browser: firefox
env: PORT=8880
install: true
install-command: npm i
parallel: true
record: true
wait-on: "http://localhost:8880"
working-directory: frontend
run: |
while ! echo exit | nc localhost 8880; do sleep 10; done
npm run cypress:run --parallel --record
working-directory: ./frontend

push_to_registry:
name: Push to registry
Expand Down

0 comments on commit 8375e2a

Please sign in to comment.