Pruebas cypress modificacion 3 #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cypress CI | |
on: | |
push: | |
branches: | |
- master # Despliegue en producción | |
- julio # Ramas de desarrollo | |
- irving # Ramas de desarrollo | |
- jesus # Ramas de desarrollo | |
- feature/* # Ramas de características | |
pull_request: | |
branches: | |
- master | |
- julio | |
- irving | |
- jesus | |
workflow_dispatch: # Activación manual opcional | |
jobs: | |
cypress: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 # Clonar el repositorio | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Cache Node modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install --legacy-peer-deps # Instalar dependencias | |
- name: Start the server | |
run: npm run dev & sleep 5 # Iniciar el servidor y esperar 5 segundos para que esté listo | |
- name: Run Cypress tests | |
run: npx cypress run # Ejecutar las pruebas de Cypress | |
# Guardar resultados de pruebas como artefactos | |
- name: Archive Cypress results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-results | |
path: cypress/results | |
# Notificar en caso de éxito o fallo | |
- name: Notify result | |
if: failure() | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
body: "❌ Las pruebas E2E de Cypress han fallado. Revisa los resultados adjuntos." | |
}) |