build(web-app): add tests to gitlab ci
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user