From efaa8a517b08446d0b5335f82dfd39689a5f3e01 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 3 Mar 2025 09:32:03 +0100 Subject: [PATCH] feat: refs #8698 add Cypress tests for login, logout, password recovery, and two-factor authentication --- Jenkinsfile | 32 ++++++++++--------- .../{outLogin => login}/login.spec.js | 0 .../{outLogin => login}/logout.spec.js | 0 .../recoverPassword.spec.js | 0 .../{outLogin => login}/twoFactor.spec.js | 0 5 files changed, 17 insertions(+), 15 deletions(-) rename test/cypress/integration/{outLogin => login}/login.spec.js (100%) rename test/cypress/integration/{outLogin => login}/logout.spec.js (100%) rename test/cypress/integration/{outLogin => login}/recoverPassword.spec.js (100%) rename test/cypress/integration/{outLogin => login}/twoFactor.spec.js (100%) diff --git a/Jenkinsfile b/Jenkinsfile index 7d3acd305..a2041b1ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -90,24 +90,26 @@ pipeline { lastSuccessfulBuild = lastSuccessfulBuild.previousBuild } - if (lastSuccessfulBuild != null && lastSuccessfulBuild.changesets.size() > 0) { - echo "lastSuccessfulBuild ${lastSuccessfulBuild} ${lastSuccessfulBuild.changesets.size()}" - // Extraer el commit del build exitoso desde el changelog - def lastCommitHash = "" - for (changeSet in lastSuccessfulBuild.changesets) { - for (change in changeSet.items) { - echo "Autor: ${change.author}" - echo "Comentario: ${change.comment}" - echo "Archivos modificados: ${change.affectedPaths}" - // echo "Commit: ${change.commitId}" + def lastCommitHash = "" + + if (lastSuccessfulBuild) { + def rawBuild = lastSuccessfulBuild.getRawBuild() // Convertimos a hudson.model.Run + + if (rawBuild.changeSets?.size() > 0) { + echo "lastSuccessfulBuild: #${lastSuccessfulBuild.number}, Changesets: ${rawBuild.changeSets.size()}" + + for (changeSet in rawBuild.changeSets) { + for (change in changeSet.items) { + echo "Archivos modificados: ${change.affectedPaths}" + echo "Commit: ${change.commitId}" + lastCommitHash = change.commitId // Tomamos el commit más reciente + } } } + } - if (lastCommitHash) { - echo "Último commit exitoso: ${lastCommitHash}" - } - } else { - lastCommitHash = sh(script: "git rev-parse origin/${env.CHANGE_TARGET}}", returnStdout: true).trim() + if (!lastCommitHash) { + lastCommitHash = sh(script: "git rev-parse origin/${env.CHANGE_TARGET}", returnStdout: true).trim() echo "Hash obtenido con git: ${lastCommitHash}" } } diff --git a/test/cypress/integration/outLogin/login.spec.js b/test/cypress/integration/login/login.spec.js similarity index 100% rename from test/cypress/integration/outLogin/login.spec.js rename to test/cypress/integration/login/login.spec.js diff --git a/test/cypress/integration/outLogin/logout.spec.js b/test/cypress/integration/login/logout.spec.js similarity index 100% rename from test/cypress/integration/outLogin/logout.spec.js rename to test/cypress/integration/login/logout.spec.js diff --git a/test/cypress/integration/outLogin/recoverPassword.spec.js b/test/cypress/integration/login/recoverPassword.spec.js similarity index 100% rename from test/cypress/integration/outLogin/recoverPassword.spec.js rename to test/cypress/integration/login/recoverPassword.spec.js diff --git a/test/cypress/integration/outLogin/twoFactor.spec.js b/test/cypress/integration/login/twoFactor.spec.js similarity index 100% rename from test/cypress/integration/outLogin/twoFactor.spec.js rename to test/cypress/integration/login/twoFactor.spec.js