test: refs #6695 capture e2e erros and publish
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-03 08:18:05 +01:00
parent 1ca6fd15b5
commit 3a14c76ad0
3 changed files with 27 additions and 18 deletions

41
Jenkinsfile vendored
View File

@ -93,18 +93,16 @@ pipeline {
NODE_ENV = ""
CREDENTIALS = credentials('docker-registry')
}
stages {
stage('Setup') {
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
cleanDockerE2E()
}
sh 'rm -rf salix'
sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git'
}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
cleanDockerE2E()
}
sh 'rm -rf salix'
sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git'
}
stages {
stage('Up') {
parallel{
stage('Database') {
@ -127,17 +125,28 @@ pipeline {
}
stage('Run E2E') {
steps {
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
script {
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
def result = sh(script: 'docker-compose -f docker-compose.e2e.yml ps -q e2e | xargs docker inspect -f "{{.State.ExitCode}}"', returnStatus: true)
sh 'docker cp $(docker-compose -f docker-compose.e2e.yml ps -q e2e):/app/test/cypress/reports ./test/cypress/'
if (result != 0) {
error("Cypress E2E tests failed with exit code: ${result}")
}
}
}
}
}
post {
always {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'test/cypress/reports',
reportFiles: '*.html',
reportName: 'Cypress Mochawesome Report'
])
cleanDockerE2E()
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
}
}

View File

@ -24,6 +24,7 @@ export default defineConfig({
embeddedScreenshots: true,
reportDir: 'test/cypress/reports',
inlineAssets: true,
json: true,
},
component: {
componentFolder: 'src',
@ -33,7 +34,6 @@ export default defineConfig({
setupNodeEvents: async (on, config) => {
const plugin = await import('cypress-mochawesome-reporter/plugin');
plugin.default(on);
return config;
},
viewportWidth: 1280,

View File

@ -7,7 +7,7 @@ services:
dockerfile: ./Dockerfile.e2e
network_mode: host
e2e:
command: npx cypress run --reporter junit --reporter-options "mochaFile=junitresults.xml"
command: npx cypress run
build:
context: .
dockerfile: ./Dockerfile.e2e