Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Enable e2e tests for the local setup #7646

Merged
merged 8 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/E2E-tests/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ docker volume rm $(docker volume ls -q) || true

docker compose -f ./docker/cypress-E2E-tests-mysql.yml down -v
docker compose -f ./docker/cypress-E2E-tests-postgres.yml down -v
docker compose -f ./docker/cypress-E2E-tests-local.yml down -v

# show all running docker containers and volumes after the cleanup to detect issues
echo "SHOW RUNNING Docker containers and volumes:"
Expand Down
2 changes: 2 additions & 0 deletions .ci/E2E-tests/execute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$DB" = "mysql" ]; then
COMPOSE_FILE="cypress-E2E-tests-mysql.yml"
elif [ "$DB" = "postgres" ]; then
COMPOSE_FILE="cypress-E2E-tests-postgres.yml"
elif [ "$DB" = "local" ]; then
COMPOSE_FILE="cypress-E2E-tests-local.yml"
else
echo "Invalid database type. Please choose either mysql or postgres."
exit 1
Expand Down
14 changes: 14 additions & 0 deletions docker/artemis/config/cypress-local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configuration overrides for the Cypress E2E Postgres setups
# ----------------------------------------------------------------------------------------------------------------------

SPRING_PROFILES_ACTIVE="artemis,scheduling,localvc,localci,prod,docker"

ARTEMIS_USERMANAGEMENT_USEEXTERNAL="false"
ARTEMIS_VERSIONCONTROL_URL='https://localhost'
ARTEMIS_VERSIONCONTROL_USER='demo'
ARTEMIS_VERSIONCONTROL_PASSWORD='demo'
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENVALUE='demo'
ARTEMIS_CONTINUOUSINTEGRATION_DOCKERCONNECTIONURI='unix:///var/run/docker.sock'
ARTEMIS_GIT_NAME='artemis'
ARTEMIS_GIT_EMAIL='[email protected]'
62 changes: 62 additions & 0 deletions docker/cypress-E2E-tests-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ----------------------------------------------------------------------------------------------------------------------
# Cypress Setup MySQL
# ----------------------------------------------------------------------------------------------------------------------

services:
mysql:
extends:
file: ./mysql.yml
service: mysql

artemis-app:
extends:
file: ./artemis.yml
service: artemis-app
user: 0:0
depends_on:
mysql:
condition: service_healthy
env_file:
- ./artemis/config/cypress.env
- ./artemis/config/cypress-local.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock

nginx:
extends:
file: ./nginx.yml
service: nginx
# the artemis-app service needs to be started, otherwise there are problems with name resolution in docker
depends_on:
artemis-app:
condition: service_started
volumes:
- ./nginx/artemis-nginx-cypress.conf:/etc/nginx/conf.d/artemis-nginx-cypress.conf:ro
ports:
- "80:80"
- "443:443"
# see comments in artemis/config/cypress.env why this port is necessary
- "54321:54321"

artemis-cypress:
extends:
file: ./cypress.yml
service: artemis-cypress
depends_on:
artemis-app:
condition: service_healthy
environment:
CYPRESS_DB_TYPE: "Local"
SORRY_CYPRESS_PROJECT_ID: "artemis-local"
CYPRESS_createUsers: "true"
command: sh -c "cd /app/artemis/src/test/cypress && chmod 777 /root && npm ci && npm run cypress:setup && (npm run cypress:record:local & sleep 60 && npm run cypress:record:local & wait)"

networks:
artemis:
driver: "bridge"
name: artemis
volumes:
artemis-mysql-data:
name: artemis-mysql-data
artemis-data:
name: artemis-data
1 change: 1 addition & 0 deletions src/test/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"cypress:setup": "cypress install && cypress run --quiet --spec init/ImportUsers.cy.ts",
"cypress:record:mysql": "npx cypress-cloud run --parallel --record --ci-build-id \"${SORRY_CYPRESS_BRANCH_NAME} #${SORRY_CYPRESS_BUILD_ID} ${SORRY_CYPRESS_RERUN_COUNT} (MySQL)\"",
"cypress:record:postgres": "npx cypress-cloud run --parallel --record --ci-build-id \"${SORRY_CYPRESS_BRANCH_NAME} #${SORRY_CYPRESS_BUILD_ID} ${SORRY_CYPRESS_RERUN_COUNT} (Postgres)\"",
"cypress:record:local": "npx cypress-cloud run --parallel --record --ci-build-id \"${SORRY_CYPRESS_BRANCH_NAME} #${SORRY_CYPRESS_BUILD_ID} ${SORRY_CYPRESS_RERUN_COUNT} (Local)\"",
"update": "ncu -i --format group"
}
}
Loading