diff --git a/alfa-client/Jenkinsfile.e2e b/alfa-client/Jenkinsfile.e2e index 4d9192728334431b0219afb7c8ac6372cf9bdaab..04cd7e108360fb4996ae623280585116c10fedc7 100644 --- a/alfa-client/Jenkinsfile.e2e +++ b/alfa-client/Jenkinsfile.e2e @@ -243,7 +243,7 @@ pipeline { // failFast false // parallel { - stage('E2E-EA') { + stage('E2E-Alfa-EA') { when { expression { !SKIP_RUN } } @@ -268,13 +268,13 @@ pipeline { } always { script { - publishE2ETestResult("einheitlicher-ansprechpartner", "Alfa E2E-Tests EA") + publishAlfaE2ETestResult("einheitlicher-ansprechpartner", "Alfa E2E-Tests EA") } } } } - stage('E2E-Main') { + stage('E2E-Alfa-Main') { when { expression { !SKIP_RUN } } @@ -299,11 +299,41 @@ pipeline { } always { script { - publishE2ETestResult("main-tests", "Alfa E2E-Tests main") + publishAlfaE2ETestResult("main-tests", "Alfa E2E-Tests main") } } } } + stage('E2E-Admin-Main') { + when { + expression { !SKIP_RUN } + } + steps { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + script { + def bezeichner = env.MAIN_BEZEICHNER + + Integer mongoDbPort = forwardMongoDbPort(generateNamespace(bezeichner)) + + runTests(bezeichner, 'main-tests', mongoDbPort, env.STAGE_NAME) + + stopForwardMongoDbPort(generateNamespace(bezeichner)) + } + } + } + post { + failure { + script { + FAILED_PARALLEL_STAGE += "${env.STAGE_NAME} " + } + } + always { + script { + publishAdminE2ETestResult("main-tests", "Admin E2E-Tests main") + } + } + } + } // } // } @@ -547,6 +577,8 @@ Void waitForRollout(String bezeichner) { waitForHealthyApplication(bezeichner, 'vorgang-manager') waitForHealthyApplication(bezeichner, 'user-manager') waitForHealthyApplication(bezeichner, 'alfa') + waitForHealthyApplication(bezeichner, 'administration') + waitForHealthyApplication(bezeichner, 'admin-client') } Void waitForHealthyApplication(String bezeichner, String application) { @@ -580,17 +612,25 @@ Void waitForHealthyStatus(String bezeichner, String application) { sh "kubectl wait --for=jsonpath='{.status.health.status}'=Healthy applications/by-${bezeichner}-dev-${application} -n argocd --timeout=900s" } -Void publishE2ETestResult(String reportFolder, String reportName) { - publishHTML ( - target: [ - allowMissing: false, - alwaysLinkToLastBuild: false, - keepAll: true, - reportDir: "alfa-client/apps/alfa-e2e/reports/${reportFolder}", - reportFiles: 'report.html', - reportName: reportName - ] - ) +Void publishAlfaE2ETestResult(String reportFolder, String reportName) { + publishE2ETestResult2("alfa-client/apps/alfa-e2e/reports/${reportFolder}", reportName) +} + +Void publishAdminE2ETestResult(String reportFolder, String reportName) { + publishE2ETestResult2("alfa-client/apps/admin-e2e/reports/${reportFolder}", reportName) +} + +Void publishE2ETestResult2(String reportDir, String reportName) { + publishHTML ( + target: [ + allowMissing: false, + alwaysLinkToLastBuild: false, + keepAll: true, + reportDir: ${reportDir}, + reportFiles: 'report.html', + reportName: reportName + ] + ) } String runTests(String bezeichner, String reportFolder, Integer dbPort, String stageName) { diff --git a/alfa-client/apps/admin-e2e/cypress.config.json b/alfa-client/apps/admin-e2e/cypress.config.json index 136d40d4f8a967df5e477627ba6c81b37d58080d..7bab4470a97551fc92eee55d557dfd983d382fe3 100644 --- a/alfa-client/apps/admin-e2e/cypress.config.json +++ b/alfa-client/apps/admin-e2e/cypress.config.json @@ -19,7 +19,7 @@ "reporterOptions": { "html": false, "json": true, - "reportDir": "./reports/mochawesome-report", + "reportDir": "./reports/main-tests/mochawesome-report", "reportFilename": "report", "overwrite": true } diff --git a/alfa-client/apps/admin-e2e/src/e2e/app/0-login-logout.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/main-tests/app/0-login-logout.cy.ts similarity index 68% rename from alfa-client/apps/admin-e2e/src/e2e/app/0-login-logout.cy.ts rename to alfa-client/apps/admin-e2e/src/e2e/main-tests/app/0-login-logout.cy.ts index fc19b08d96e0a250e5fa64f323c0e44095458ab1..cbee0dcfa84f4ca39bc865b67cebb499194b7920 100644 --- a/alfa-client/apps/admin-e2e/src/e2e/app/0-login-logout.cy.ts +++ b/alfa-client/apps/admin-e2e/src/e2e/main-tests/app/0-login-logout.cy.ts @@ -1,8 +1,8 @@ -import { HeaderE2EComponent } from '../../page-objects/header.po'; -import { MainPage } from '../../page-objects/main.po'; -import { reload } from '../../support/cypress-helper'; -import { exist } from '../../support/cypress.util'; -import { loginByUi } from '../../support/user-util'; +import { HeaderE2EComponent } from '../../../page-objects/header.po'; +import { MainPage } from '../../../page-objects/main.po'; +import { reload } from '../../../support/cypress-helper'; +import { exist } from '../../../support/cypress.util'; +import { loginByUi } from '../../../support/user-util'; describe('Login and Logout', () => { const mainPage: MainPage = new MainPage(); diff --git a/alfa-client/apps/admin-e2e/src/e2e/app/buildinfo.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/main-tests/app/buildinfo.cy.ts similarity index 100% rename from alfa-client/apps/admin-e2e/src/e2e/app/buildinfo.cy.ts rename to alfa-client/apps/admin-e2e/src/e2e/main-tests/app/buildinfo.cy.ts diff --git a/alfa-client/apps/admin-e2e/src/e2e/benutzer_rollen/benutzer_rollen.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/main-tests/benutzer_rollen/benutzer_rollen.cy.ts similarity index 70% rename from alfa-client/apps/admin-e2e/src/e2e/benutzer_rollen/benutzer_rollen.cy.ts rename to alfa-client/apps/admin-e2e/src/e2e/main-tests/benutzer_rollen/benutzer_rollen.cy.ts index fe3c7a872af5c83ece40d73e3160a6953df0795d..6121e86446152b79b321b7052f42046e602f2d88 100644 --- a/alfa-client/apps/admin-e2e/src/e2e/benutzer_rollen/benutzer_rollen.cy.ts +++ b/alfa-client/apps/admin-e2e/src/e2e/main-tests/benutzer_rollen/benutzer_rollen.cy.ts @@ -1,7 +1,7 @@ -import { HeaderE2EComponent } from '../../page-objects/header.po'; -import { MainPage } from '../../page-objects/main.po'; -import { exist } from '../../support/cypress.util'; -import { loginAsAriane } from '../../support/user-util'; +import { HeaderE2EComponent } from '../../../page-objects/header.po'; +import { MainPage } from '../../../page-objects/main.po'; +import { exist } from '../../../support/cypress.util'; +import { loginAsAriane } from '../../../support/user-util'; const mainPage: MainPage = new MainPage(); const header: HeaderE2EComponent = mainPage.getHeader(); diff --git a/alfa-client/apps/admin-e2e/src/e2e/postfach/signatur.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/main-tests/postfach/signatur.cy.ts similarity index 100% rename from alfa-client/apps/admin-e2e/src/e2e/postfach/signatur.cy.ts rename to alfa-client/apps/admin-e2e/src/e2e/main-tests/postfach/signatur.cy.ts diff --git a/alfa-client/apps/alfa-e2e/cypress.config.json b/alfa-client/apps/alfa-e2e/cypress.config.json index 3a604c010deb694376105420fb38252bc1029efe..10160a6f1a1a224da71dcdc3671381d635fed8b9 100644 --- a/alfa-client/apps/alfa-e2e/cypress.config.json +++ b/alfa-client/apps/alfa-e2e/cypress.config.json @@ -34,7 +34,7 @@ "reporterOptions": { "html": false, "json": true, - "reportDir": "./reports/mochawesome-report", + "reportDir": "./reports/main-tests/mochawesome-report", "reportFilename": "report", "overwrite": true } diff --git a/alfa-client/apps/run-tests.sh b/alfa-client/apps/run-tests.sh index fa5009b7d4966811e57783a10594c05819d75705..68164e39d5eb7e58524bc0627fce77ee3a29182d 100644 --- a/alfa-client/apps/run-tests.sh +++ b/alfa-client/apps/run-tests.sh @@ -1,37 +1,43 @@ #!/bin/bash export NO_COLOR=1 -REPORT_FOLDER=$1 -CONFIG_FILE="${2:-cypress.config.ts}" -SUITE_NAME="${3:-alfa-e2e}" +if [ $# -eq 0 ]; then + >&2 echo "This script is for Jenkins Execution of E2E-Tests" + >&2 echo "Example: ./run-tests.sh admin-e2e main-tests cypress.config.ts" + exit 1 +fi +APP_NAME="${1:-alfa-e2e}" +APP_VARIATION="${2:-main-tests}" +CONFIG_FILE="${3:-cypress.config.ts}" -if [ -z $REPORT_FOLDER ]; then echo "Report Folder not set" && exit 1; fi +if [ -z $APP_NAME ]; then echo "App Folder not set" && exit 1; fi +if [ -z $APP_VARIATION ]; then echo "Variation Name not set" && exit 1; fi if [ -z $CONFIG_FILE ]; then echo "Config File not set" && exit 1; fi -if [ -z $SUITE_NAME ]; then echo "Suite Name not set" && exit 1; fi - -BASE_PATH=${SUITE_NAME} -REPORT_BASE_PATH=${BASE_PATH}/reports/ -FULL_REPORT_PATH=${REPORT_BASE_PATH}${REPORT_FOLDER} -MOCHA_REPORT_PATH=${FULL_REPORT_PATH}/mochawesome-report/ -MOCHA_REPORT_JSONS=${MOCHA_REPORT_PATH}.jsons -MOCHA_REPORT_FILE=${MOCHA_REPORT_PATH}report.json -echo "Run E2E for ${REPORT_FOLDER} with configuration ${BASE_PATH}/$CONFIG_FILE..." +BASE_PATH=${APP_NAME} +SPEC_GROUP=${BASE_PATH}/src/e2e/${APP_VARIATION} +COMMAND="npx cypress run --project ${BASE_PATH} --spec ${SPEC_GROUP} --config-file ${CONFIG_FILE}" +REPORT_PATH=${BASE_PATH}/reports/${APP_VARIATION} -rm -rf ${FULL_REPORT_PATH} +echo "Run E2E for ${APP_NAME} with command: '$COMMAND'" -npx cypress run --project ${BASE_PATH} --spec ${BASE_PATH}/src/e2e/${REPORT_FOLDER} --config-file $CONFIG_FILE +rm -rf ${REPORT_PATH} +eval $COMMAND TEST_RESULT=$? -if [ -d "${MOCHA_REPORT_JSONS}" ]; then - mv ${MOCHA_REPORT_JSONS} ${MOCHA_REPORT_PATH}/jsons - npx mochawesome-merge ${MOCHA_REPORT_PATH}**/*.json > ${MOCHA_REPORT_FILE} - # Workaround: mochawesome's "screenshotsFolder" value is not added in the generated HTML file. Add "screenshots" to image paths. - sed --in-place --regexp-extended 's/"([^"]*\.png)/"screenshots\1/' ${MOCHA_REPORT_FILE} - npx marge ${MOCHA_REPORT_FILE} -f report -o ${FULL_REPORT_PATH} +if [ -d "${REPORT_PATH}" ]; then + MOCHA_REPORT_PATH=${REPORT_PATH}/mochawesome-report/ + MOCHA_REPORT_JSONS=${MOCHA_REPORT_PATH}.jsons + MOCHA_REPORT_FILE=${MOCHA_REPORT_PATH}report.json + + mv ${MOCHA_REPORT_JSONS} ${MOCHA_REPORT_PATH}/jsons + npx mochawesome-merge ${MOCHA_REPORT_PATH}**/*.json > ${MOCHA_REPORT_FILE} + # Workaround: mochawesome's "screenshotsFolder" value is not added in the generated HTML file. Add "screenshots" to image paths. + sed --in-place --regexp-extended 's/"([^"]*\.png)/"screenshots\1/' ${MOCHA_REPORT_FILE} + npx marge ${MOCHA_REPORT_FILE} -f report -o ${REPORT_PATH} else - echo "ERROR: Reports do not exist at ${MOCHA_REPORT_JSONS}" + echo "ERROR: Reports do not exist at ${REPORT_PATH}" fi exit $TEST_RESULT \ No newline at end of file