test(webapp): provide tests in CI

- add url and page as env variables to choice where to test and update the others
- To pass a variable to a job's service, they have to be declared in the "variables" global -> doesn't work (see: [#37])
- use of the deployed image to do E2E test instead of services of gitlab
This commit is contained in:
fastium
2025-06-21 16:22:07 +02:00
parent cecd04dd20
commit e436eb354b
10 changed files with 55 additions and 270 deletions

View File

@@ -2,6 +2,11 @@ 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
VUE_APP_REST_USER: $REST_USER
VUE_APP_REST_PASSWORD: $REST_PASSWORD
VUE_APP_REST_URL: $REST_URL
VUE_APP_REST_PAGE: $TEST_PAGE
default:
image: $DOCKER_IMAGE
@@ -35,9 +40,10 @@ web-app-unit-tests:
web-app-e2e-tests:
image: $NODE_IMAGE
stage: web-app-tests
services:
- name: $DOCKER_IMAGE
alias: app
# services:
# - name: $DOCKER_IMAGE
# alias: app
script:
- echo "Running e2e tests"
- apt-get update
@@ -45,6 +51,6 @@ web-app-e2e-tests:
- 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"
- for i in {1..6}; do curl -f https://app.mse.kb28.ch/ && break || sleep 5; done
- echo "App is running"
- npm run test:e2e