From fdb6e6c105a047f5ea29ed06b1bb576bac58f857 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 5 Feb 2025 15:03:19 +0100 Subject: [PATCH] test: refs #6695 e2e front use dockerfile.e2e --- Dockerfile.e2e | 13 ++++++++----- Jenkinsfile | 12 ++++++------ cypress.config.js | 13 ++++++++++++- docker-compose.e2e.yml | 4 +++- test/cypress/integration/ticket/ticketSale.spec.js | 6 ++++++ 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 1bd92ea1f..c7112c576 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -2,9 +2,9 @@ FROM node:lts-bookworm ENV SHELL bash ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" - RUN npm install -g pnpm@8.15.1 && \ - pnpm setup + pnpm setup && \ + pnpm install -g @quasar/cli@2.2.1 RUN apt-get -y --fix-missing update && \ apt-get -y --fix-missing upgrade && \ @@ -32,7 +32,6 @@ COPY \ pnpm-lock.yaml \ ./ -# Verifica si node_modules existe; si no, instala dependencias RUN if [ ! -d "node_modules" ]; then \ pnpm install; \ fi && \ @@ -40,13 +39,17 @@ RUN if [ ! -d "node_modules" ]; then \ npx cypress install COPY \ + quasar.config.js \ + index.html \ jsconfig.json \ quasar.extensions.json \ + # .eslintignore \ + # .eslintrc.js \ postcss.config.js \ cypress.config.js \ ./ +COPY src src COPY test/cypress test/cypress +COPY public public -ENV CYPRESS_BROWSER=chrome -ENV CHROME_BIN=/usr/bin/chromium diff --git a/Jenkinsfile b/Jenkinsfile index c38727aab..7b2b0db41 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -120,15 +120,15 @@ pipeline { } stage('Frontend') { steps { - sh 'quasar build' // Use quasar prod version + // sh 'quasar build' // Use quasar prod version sh 'docker-compose -f docker-compose.e2e.yml up -d --build front' } } - stage('Build Cypress') { - steps { - sh 'docker-compose -f docker-compose.e2e.yml build e2e' - } - } + // stage('Build Cypress') { + // steps { + // sh 'docker-compose -f docker-compose.e2e.yml build e2e' + // } + // } } } stage('Run E2E') { diff --git a/cypress.config.js b/cypress.config.js index 4eb7692ca..1bc810b16 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -18,7 +18,18 @@ export default defineConfig({ videosFolder: 'test/cypress/videos', downloadsFolder: 'test/cypress/downloads', video: false, - specPattern: 'test/cypress/integration/**/*.spec.js', + specPattern: [ + 'test/cypress/integration/entry/stockBought.spec.js', + 'test/cypress/integration/invoiceOut/invoiceOutNegativeBases.js', + 'test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js', + 'test/cypress/integration/item/itemTag.spec.js', + 'test/cypress/integration/route/routeList.spec.js', + 'test/cypress/integration/ticket/ticketList.spec.js', + 'test/cypress/integration/ticket/ticketSale.spec.js', + 'test/cypress/integration/vnComponent/UserPanel.spec.js', + 'test/cypress/integration/vnComponent/VnLocation.spec.js', + 'test/cypress/integration/worker/workerNotificationsManager.spec.js', + ], experimentalRunAllSpecs: true, watchForFileChanges: true, reporter: 'cypress-mochawesome-reporter', diff --git a/docker-compose.e2e.yml b/docker-compose.e2e.yml index 799d37a40..7138e4f46 100644 --- a/docker-compose.e2e.yml +++ b/docker-compose.e2e.yml @@ -5,8 +5,10 @@ services: command: npx quasar serve --history --proxy ./proxy.mjs --hostname 127.0.0.1 --port 9000 build: context: . - dockerfile: ./Dockerfile + dockerfile: ./Dockerfile.e2e network_mode: host + volumes: + - ./node_modules:/app/node_modules e2e: command: npx cypress run --browser chromium build: diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js index aed8dc85a..8b8bf3222 100644 --- a/test/cypress/integration/ticket/ticketSale.spec.js +++ b/test/cypress/integration/ticket/ticketSale.spec.js @@ -76,7 +76,10 @@ describe('TicketSale', () => { selectFirstRow(); cy.dataCy('ticketSaleMoreActionsDropdown').click(); cy.waitForElement('[data-cy="markAsReservedItem"]'); + cy.intercept('POST', '/Sales/reserve').as('reserveRequest'); cy.dataCy('markAsReservedItem').click(); + cy.wait('@reserveRequest').its('response.statusCode').should('eq', 200); + cy.dataCy('ticketSaleReservedIcon').should('exist'); }); @@ -84,7 +87,10 @@ describe('TicketSale', () => { selectFirstRow(); cy.dataCy('ticketSaleMoreActionsDropdown').click(); cy.waitForElement('[data-cy="unmarkAsReservedItem"]'); + cy.intercept('POST', '/Sales/reserve').as('reserveRequest'); cy.dataCy('unmarkAsReservedItem').click(); + cy.wait('@reserveRequest').its('response.statusCode').should('eq', 200); + cy.dataCy('ticketSaleReservedIcon').should('not.exist'); });