diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1eafcd..3056661 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,8 @@ stages: - gateway-build - web-app-build + - web-app-tests include: - local: gateway/.gitlab-ci.yml - - local: web-app/.gitlab-ci.yml \ No newline at end of file + - local: web-app/.gitlab-ci.yml diff --git a/web-app/.gitlab-ci.yml b/web-app/.gitlab-ci.yml index e6b3cba..5fcd239 100644 --- a/web-app/.gitlab-ci.yml +++ b/web-app/.gitlab-ci.yml @@ -1,11 +1,13 @@ variables: DOCKER_IMAGE: registry.forge.hefr.ch/team-raclette/project-softweng/web-app:latest + NODE_IMAGE: cypress/included:cypress-14.4.1-node-22.16.0-chrome-137.0.7151.68-1-ff-139.0.1-edge-137.0.3296.62-1 default: image: $DOCKER_IMAGE stages: - web-app-build + - web-app-tests web-app-docker-build: image: docker:latest @@ -20,3 +22,29 @@ web-app-docker-build: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_COMMIT_BRANCH == 'main' - changes: - web-app/* + +web-app-unit-tests: + image: $NODE_IMAGE + stage: web-app-tests + script: + - echo "Running unit tests" + - cd ./web-app + - npm install --include=dev + - npm run test:unit + +web-app-e2e-tests: + image: $NODE_IMAGE + stage: web-app-tests + services: + - name: $DOCKER_IMAGE + alias: app + script: + - echo "Running e2e tests" + - apt-get update + - apt-get install curl + - cd ./web-app + - npm install --include=dev + - echo "Wait web-app app is running" + - for i in {1..6}; do curl -f http://app:8080 && break || sleep 5; done + - echo "Flask app is running" + - npm run test:e2e