From 5b5ed2c34fed0fc3e79b31921d2d2bea6011a27a Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 20 Feb 2025 09:57:46 +0100 Subject: [PATCH] fix: refs #6695 update Cypress cache handling and increase wait timeout for elements --- Jenkinsfile | 2 +- test/cypress/Dockerfile | 18 +++++------------- test/cypress/docker/run/run_group.sh | 4 ++-- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08d35d123..235a52398 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,8 +107,8 @@ pipeline { -e TZ=Europe/Madrid -e DOCKER=true -e CI=true - -e CYPRESS_CACHE_FOLDER=/app/.cypress_cache """.stripIndent()) { + sh 'pnpm exec cypress install' sh 'pnpm exec cypress run --browser chromium' } } diff --git a/test/cypress/Dockerfile b/test/cypress/Dockerfile index 5d5f1cb09..33a8f2210 100644 --- a/test/cypress/Dockerfile +++ b/test/cypress/Dockerfile @@ -1,20 +1,12 @@ FROM alexmorenovn/vndev:latest WORKDIR /app + +# Copiar los archivos de package.json y pnpm-lock.yaml para evitar reinstalar dependencias innecesariamente COPY package.json pnpm-lock.yaml ./ -# Especificamos la ruta personalizada para la caché de Cypress -ENV CYPRESS_CACHE_FOLDER=/app/.cypress_cache - -# Instalamos las dependencias y Cypress en la ruta definida -RUN pnpm install --frozen-lockfile \ - && CYPRESS_CACHE_FOLDER=$CYPRESS_CACHE_FOLDER pnpm exec cypress install - -# Verificamos que la caché de Cypress se haya instalado correctamente -RUN echo "Cypress cache installed at: $CYPRESS_CACHE_FOLDER" \ - && ls -la $CYPRESS_CACHE_FOLDER || true - -# Configuramos el PATH para que Cypress sea accesible -ENV PATH="$CYPRESS_CACHE_FOLDER/${CYPRESS_VERSION}/Cypress:${PATH}" +# Instalar solo Cypress sin instalar todas las dependencias del proyecto +RUN pnpm install --frozen-lockfile && pnpm exec cypress install +# Definir el directorio de trabajo por defecto WORKDIR /app diff --git a/test/cypress/docker/run/run_group.sh b/test/cypress/docker/run/run_group.sh index 9afc74ef1..b544aa473 100644 --- a/test/cypress/docker/run/run_group.sh +++ b/test/cypress/docker/run/run_group.sh @@ -18,7 +18,7 @@ run_group() { -v "$(pwd)":/app \ -w /app \ cypress-setup \ - pnpm exec cypress run --browser chromium --spec test/cypress/integration/${folderName}/**/*.spec.js) + pnpm exec cypress run --browser chromium --spec test/cypress/integration/${folderName}/**/*.spec.js --no-exit) # 🔹 Esperar activamente a que el contenedor finalice while true; do @@ -33,7 +33,7 @@ run_group() { exit_code=$(docker inspect -f '{{.State.ExitCode}}' "$containerId" 2>/dev/null || echo "1") if [[ "$exit_code" -ne 0 ]]; then - # echo "❌ Error en la ejecución de ${folderName} (Exit Code: $exit_code)" + echo "❌ Fallos - ${folderName}" docker logs "$containerId" > "test/cypress/docker/logs/${uniqueName}_${folderName}_log" 2>/dev/null || true fi docker rm -f ${uniqueName}_${folderName}_cypress >/dev/null 2>&1 || true