test: refs #6695 run e2e parallel
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
7d9f59e147
commit
86d5ae781a
|
@ -124,29 +124,35 @@ pipeline {
|
||||||
sh 'docker-compose -f docker-compose.e2e.yml up -d --build front'
|
sh 'docker-compose -f docker-compose.e2e.yml up -d --build front'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Build E2E') {
|
||||||
|
steps {
|
||||||
|
sh 'docker-compose -f docker-compose.e2e.yml build e2e'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Run E2E') {
|
stage('Run E2E') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh 'docker-compose -f docker-compose.e2e.yml up --build e2e'
|
runCypressTests(['claim', 'ticket'])
|
||||||
def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
|
|
||||||
if (containerId) {
|
|
||||||
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
|
|
||||||
sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/"
|
|
||||||
if (exitCode != '0') {
|
|
||||||
def logs = sh(script: "docker logs ${containerId}", returnStdout: true).trim()
|
|
||||||
error("Cypress E2E tests failed with exit code: ${exitCode}\nLogs:\n${logs}")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error("The Docker container for E2E tests could not be created")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
sh 'docker-compose -f docker-compose.e2e.yml up --build e2e'
|
||||||
|
def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
|
||||||
|
if (containerId) {
|
||||||
|
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
|
||||||
|
sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/"
|
||||||
|
if (exitCode != '0') {
|
||||||
|
def logs = sh(script: "docker logs ${containerId}", returnStdout: true).trim()
|
||||||
|
error("Cypress E2E tests failed with exit code: ${exitCode}\nLogs:\n${logs}")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error("The Docker container for E2E tests could not be created")
|
||||||
|
}
|
||||||
cleanDockerE2E()
|
cleanDockerE2E()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,3 +201,21 @@ def cleanDockerE2E() {
|
||||||
sh 'docker-compose -f docker-compose.e2e.yml down || true'
|
sh 'docker-compose -f docker-compose.e2e.yml down || true'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def runCypressTests(folders) {
|
||||||
|
script {
|
||||||
|
def parallelStages = [:]
|
||||||
|
folders.each { folder ->
|
||||||
|
parallelStages["E2E - ${folder}"] = {
|
||||||
|
stage("E2E - ${folder}") {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
sh "docker-compose run e2e npx cypress run --config specPattern=test/cypress/integration/${folder}/**/*.spec.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parallel parallelStages
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -37,12 +37,6 @@ export default defineConfig({
|
||||||
setupNodeEvents: async (on, config) => {
|
setupNodeEvents: async (on, config) => {
|
||||||
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
||||||
plugin.default(on);
|
plugin.default(on);
|
||||||
// if (process.env.JENKINS_URL) {
|
|
||||||
// on('fail', (error) => {
|
|
||||||
// // Detener la ejecución en caso de fallo solo en Jenkins
|
|
||||||
// throw new Error(error.message);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
viewportWidth: 1280,
|
viewportWidth: 1280,
|
||||||
|
|
Loading…
Reference in New Issue