feat: refs #6695 jenkins run e2e
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-10-04 12:08:47 +02:00
parent 81cbeff449
commit da61df0a2a
7 changed files with 69 additions and 51 deletions

22
Jenkinsfile vendored
View File

@ -92,12 +92,22 @@ pipeline {
IMAGE = "$REGISTRY/salix-back"
}
steps {
sh 'docker pull $IMAGE:dev'
sh 'docker ps -a'
sh 'docker network create salix_default'
sh 'docker-compose -f docker-compose.yml build db'
sh 'docker-compose -f docker-compose.yml up db'
sh 'docker run --name back $IMAGE:dev'
// // sh 'docker pull $IMAGE:dev'
// sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git'
// // sh 'docker ps -a'
// sh 'docker network create salix_default'
// sh 'docker-compose -f docker-compose.yml build db'
// sh 'docker-compose -f docker-compose.yml up db'
// sh 'docker run --name back $IMAGE:dev'
sh 'git clone --branch dev https://gitea.verdnatura.es/verdnatura/salix.git'
sh 'cd front'
// sh '# export VERSION=e2e-try'
sh 'docker buildx build -f salix/back/Dockerfile -t back ./salix'
sh 'docker-compose -f docker-compose.e2e.yml up db'
sh 'docker run --net=host -v ./test/cypress/storage:/salix/storage -d back'
sh 'docker-compose -f docker-compose.e2e.yml -d up front'
sh 'docker-compose -f docker-compose.e2e.yml up e2e --build'
}
post {
always {

View File

@ -2,14 +2,14 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://front:9000/',
baseUrl: 'http://localhost:9000/',
experimentalStudio: true,
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js',
videosFolder: 'test/cypress/videos',
video: false,
specPattern: 'test/cypress/integration/**/*.spec.js',
specPattern: 'test/cypress/integration/claim/*.spec.js',
experimentalRunAllSpecs: true,
component: {
componentFolder: 'src',

12
dind.sh Normal file
View File

@ -0,0 +1,12 @@
docker stop dind-container || true && docker rm dind-container || true
docker run --privileged -d \
-p 2376:2376 \
-e DOCKER_TLS_CERTDIR="" \
--name dind-container \
-v /home/alexm/Projects/salix-front:/front \
docker:dind \
dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock
docker exec -it dind-container sh

View File

@ -6,33 +6,37 @@ services:
dockerfile: ./Dockerfile.e2e
ports:
- 9000:9000
back:
image: registry.verdnatura.es/salix-back:${VERSION:?}
build:
context: .
dockerfile: back/Dockerfile
depends_on:
- db
ports:
- 3000:3000
- 5000:5000
volumes:
- ./test/cypress/storage:/salix/storage
network_mode: host
db:
image: db
command: npx myt run -t --ci -n salix-front_default
command: npx myt run -t -d
build:
context: .
dockerfile: test/cypress/db/Dockerfile
target: db
volumes:
- /var/run/docker.sock:/var/run/docker.sock
network_mode: host
e2e:
image: registry.verdnatura.es/salix-frontend:${VERSION:?}
command: npx cypress run
build:
context: .
dockerfile: ./Dockerfile.e2e
network_mode: host
# back:
# image: back
# build:
# context: ./salix
# dockerfile: salix/back/Dockerfile
# # depends_on:
# # - db
# ports:
# - 3000:3000
# - 5000:5000
# volumes:
# - ./test/cypress/storage:/salix/storage
# e2e-2:
# image: registry.verdnatura.es/salix-frontend:${VERSION:?}
# command: npx cypress run --config-file test/cypress/configs/cypress.config.2.js

11
e2e.sh Normal file
View File

@ -0,0 +1,11 @@
git clone --branch dev https://gitea.verdnatura.es/verdnatura/salix.git
cd front
# export VERSION=e2e-try
docker buildx build -f salix/back/Dockerfile -t back ./salix
docker-compose -f docker-compose.e2e.yml up db
docker run --net=host -v ./test/cypress/storage:/salix/storage -d back
docker-compose -f docker-compose.e2e.yml -d up front
docker-compose -f docker-compose.e2e.yml up e2e --build

View File

@ -1,37 +1,18 @@
FROM registry.verdnatura.es/salix-back:e2e-try AS back
FROM docker:dind AS base
ENV TZ Europe/Madrid
ARG DEBIAN_FRONTEND=noninteractive
RUN apk update \
&& apk add --update nodejs npm python3 \
krb5-dev libressl-dev
RUN apk update \
&& apk add --virtual build-dependencies \
build-base gcc wget git
FROM node:lts-bookworm
ENV SHELL bash
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install -g pnpm@8.15.1
RUN pnpm setup
RUN apt install libkrb5-dev libssl-dev
RUN npm i -g pnpm
WORKDIR /salix
# COPY --from=back /.git /test/cypress/.git
# COPY --from=back myt.config.yml /test/cypress
# COPY db db
# COPY node_modules node_modules
# COPY .git .git
# COPY myt.config.yml .
COPY --from=back salix/db db
COPY --from=back salix/myt.config.yml .
COPY --from=back salix/.git .git
COPY salix/db db
COPY salix/myt.config.yml .
COPY salix/.git .git
COPY node_modules node_modules
# RUN pnpm i @verdnatura/myt USAR NODE_MODULES HASTA QUE ESTE LA RAMA DE MYT FUSIONADA (MIENTRAS INSTALAR EN LILIUM, MYT Y MODIFICAR EL CODIGO DE myt-run.js)
FROM base AS db
WORKDIR /salix

View File

@ -83,7 +83,7 @@ Cypress.Commands.add('getValue', (selector) => {
Cypress.Commands.add('selectOption', (selector, option) => {
cy.waitForElement(selector);
cy.get(selector).find('.q-select__dropdown-icon').click();
cy.get('.q-menu .q-item').contains(option).click();
cy.get('.q-menu .q-item').contains(option).should('be.visible').click();
});
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {