From d0ba2f41e114cbfdf568697fe3e052613df08bad Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 3 Feb 2025 13:42:41 +0100 Subject: [PATCH] test: refs #6695 run all e2e --- Jenkinsfile | 71 ++++++++++++----------------------------------------- 1 file changed, 16 insertions(+), 55 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0284807129..224a49c97e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -105,11 +105,6 @@ pipeline { sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git' } } - stage('Build E2E') { - steps { - sh 'docker-compose -f docker-compose.e2e.yml build e2e' - } - } stage('Up') { parallel{ stage('Database') { @@ -129,32 +124,27 @@ pipeline { sh 'docker-compose -f docker-compose.e2e.yml up -d --build front' } } - } - } - stage('Run: Globals') { - parallel{ - stage('outLogin') { + stage('Build Cypress') { steps { - sh 'docker-compose -f docker-compose.e2e.yml run e2e npx cypress run --config specPattern=test/cypress/integration/outLogin/**/*.spec.js' - } - } - stage('vnComponent') { - steps { - sh 'docker-compose -f docker-compose.e2e.yml run e2e npx cypress run --config specPattern=test/cypress/integration/vnComponent/**/*.spec.js' + sh 'docker-compose -f docker-compose.e2e.yml build e2e' } } } } - stage('Run: Specifics') { - parallel{ - stage('claim') { - steps { - sh 'docker-compose -f docker-compose.e2e.yml run e2e npx cypress run --config specPattern=test/cypress/integration/claim/**/*.spec.js' - } - } - stage('item') { - steps { - sh 'docker-compose -f docker-compose.e2e.yml run e2e npx cypress run --config specPattern=test/cypress/integration/item/**/*.spec.js' + stage('Run E2E') { + steps { + script { + sh 'docker-compose -f docker-compose.e2e.yml up e2e' + def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim() + if (containerId) { + def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim() + sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/" + if (exitCode != '0') { + def logs = sh(script: "docker logs ${containerId}", returnStdout: true).trim() + error("Cypress E2E tests failed with exit code: ${exitCode}\nLogs:\n${logs}") + } + } else { + error("The Docker container for E2E tests could not be created") } } } @@ -162,17 +152,6 @@ pipeline { } post { always { - // def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim() - // if (containerId) { - // def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim() - // sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/" - // if (exitCode != '0') { - // def logs = sh(script: "docker logs ${containerId}", returnStdout: true).trim() - // error("Cypress E2E tests failed with exit code: ${exitCode}\nLogs:\n${logs}") - // } - // } else { - // error("The Docker container for E2E tests could not be created") - // } cleanDockerE2E() } } @@ -221,21 +200,3 @@ def cleanDockerE2E() { sh 'docker-compose -f docker-compose.e2e.yml down || true' } } - -def runCypressTests(folders) { - script { - def parallelStages = [:] - folders.each { folder -> - parallelStages["E2E - ${folder}"] = { - stage("E2E - ${folder}") { - steps { - script { - sh "docker-compose run e2e npx cypress run --config specPattern=test/cypress/integration/${folder}/**/*.spec.js" - } - } - } - } - } - parallel parallelStages - } -}