test: refs #6695 run all e2e
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-03 13:42:41 +01:00
parent 1da88fd70c
commit d0ba2f41e1
1 changed files with 16 additions and 55 deletions

71
Jenkinsfile vendored
View File

@ -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
}
}