fix: refs #6695 update Cypress cache handling and increase wait timeout for elements
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-20 09:30:52 +01:00
parent 416916a92b
commit 0f5f5b847e
3 changed files with 13 additions and 9 deletions

2
Jenkinsfile vendored
View File

@ -109,7 +109,7 @@ pipeline {
-e CI=true -e CI=true
-e CYPRESS_CACHE_FOLDER=/root/.cache/Cypress -e CYPRESS_CACHE_FOLDER=/root/.cache/Cypress
""".stripIndent()) { """.stripIndent()) {
sh 'ls -la /root/.cache/Cypress' // Verificar que el binario está disponible sh 'ls -la /root/.cache/Cypress' // Debug opcional
sh 'pnpm exec cypress run --browser chromium' sh 'pnpm exec cypress run --browser chromium'
} }
} }

View File

@ -3,16 +3,20 @@ FROM alexmorenovn/vndev:latest
WORKDIR /app WORKDIR /app
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml ./
# Instalamos las dependencias y descargamos Cypress # Instalamos dependencias y Cypress
RUN pnpm install --frozen-lockfile \ RUN pnpm install --frozen-lockfile \
&& CYPRESS_CACHE_FOLDER=/root/.cache/Cypress pnpm exec cypress install && pnpm exec cypress install
# Movemos la caché de Cypress al directorio raíz para evitar problemas de permisos # Verificamos dónde está instalada la caché de Cypress
RUN mkdir -p /root/.cache/Cypress \ RUN echo "Cypress cache directory: $(pnpm exec cypress cache path)" \
&& cp -r /home/node/.cache/Cypress/* /root/.cache/Cypress/ && ls -la $(pnpm exec cypress cache path) || true
# Configuramos variables de entorno # Aseguramos que la caché esté en un lugar accesible
ENV CYPRESS_CACHE_FOLDER=/root/.cache/Cypress ENV CYPRESS_CACHE_FOLDER=/root/.cache/Cypress
ENV PATH="/root/.cache/Cypress/${CYPRESS_VERSION}/Cypress:${PATH}" RUN mkdir -p ${CYPRESS_CACHE_FOLDER} \
&& if [ -d "/home/node/.cache/Cypress" ]; then cp -r /home/node/.cache/Cypress/* ${CYPRESS_CACHE_FOLDER}/; fi
# Configuramos la variable de entorno y el PATH
ENV PATH="${CYPRESS_CACHE_FOLDER}:${PATH}"
WORKDIR /app WORKDIR /app

View File

@ -59,7 +59,7 @@ Cypress.Commands.add('login', (user) => {
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => { Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete')); cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
}); });
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => { Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled'); cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
}); });