Skip to content

Commit

Permalink
test: [JENKINS] Run cypress in started frontend container
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinab25 committed Nov 17, 2023
1 parent 27487cb commit 82a071e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ pipeline {
script {
try {
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
sh '''timeout -s 9 3600 docker run --shm-size=2g --cpu-quota=150000 --link $IMAGE_NAME-plone:plone --entrypoint=make --name="$IMAGE_NAME-cypress" --workdir=/app/src/addons/${GIT_NAME} -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" $IMAGE_NAME-frontend cypress-ci'''
sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
} finally {
try {
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
Expand Down Expand Up @@ -189,6 +190,10 @@ pipeline {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
}
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh '''docker logs $IMAGE_NAME-cypress'''
}
sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,12 @@ test-ci:

.PHONY: start-ci
start-ci:
cp .coverage.babel.config.js /app/babel.config.js
cd ../..
yarn start &
yarn start

.PHONY: cypress-ci
cypress-ci:
cp .coverage.babel.config.js /app/babel.config.js
make start-ci
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
NODE_ENV=development make cypress-run


0 comments on commit 82a071e

Please sign in to comment.