diff --git a/goofy-client/apps/goofy-e2e/Jenkinsfile b/goofy-client/apps/goofy-e2e/Jenkinsfile index 40bbc315627d672cd4a87004d6c845796223471e..133b66582440eca412ab4dc2a2d280552cfe8445 100644 --- a/goofy-client/apps/goofy-e2e/Jenkinsfile +++ b/goofy-client/apps/goofy-e2e/Jenkinsfile @@ -614,13 +614,20 @@ Void publishE2ETestResult(String reportFolder, String reportName) { } String runTests(String bezeichner, String reportFolder, Integer dbPort, String stageName) { - def config = generateCypressConfig(bezeichner, reportFolder, dbPort) + generateCypressConfig(bezeichner, reportFolder, dbPort) def specFolder = "apps/goofy-e2e/src/e2e/${reportFolder}" try { dir("goofy-client") { - sh "npm run cypress:version" - sh "npm run cypress:ci-run --CONFIG='${config}' --REPORT_FOLDER=${reportFolder} --SPEC=${specFolder}" + sh ' + npx cypress version + REPORT_FOLDER=${reportFolder} node apps/goofy-e2e/src/support/delete-old-reports.ts + NO_COLOR=1 npx cypress run --project apps/goofy-e2e --spec ${specFolder} + test=$(echo $?) + REPORT_FOLDER=${reportFolder} node apps/goofy-e2e/src/support/pre-merge.ts + mochawesome-merge apps/goofy-e2e/reports/${npm_config_report_folder}/mochawesome-report/**/*.json > apps/goofy-e2e/reports/${npm_config_report_folder}/report.json + marge apps/goofy-e2e/reports/${npm_config_report_folder}/report.json -f report -o apps/goofy-e2e/reports/${npm_config_report_folder} + ' } } catch (Exception e) { printNpmDebugLog() @@ -659,26 +666,30 @@ String cutBranchNameForKeycloakRealm(String branchName, String stageName) { String generateCypressConfig(String bezeichner, String testFolder, Integer dbPort) { def namespace = generateNamespace(bezeichner) + def configName = "cypress.config.json" - def plutoDatabaseSecret = getPlutoDatabaseSecret(namespace); - def decodedPassword = decodeString(plutoDatabaseSecret.password); - def parsablePassword = makePasswordUrlConform(decodedPassword); + dir('goofy-client/apps/goofy-e2e/'){ + def config = readJSON file: 'cypress.config.json' + + def plutoDatabaseSecret = getPlutoDatabaseSecret(namespace); + def decodedPassword = decodeString(plutoDatabaseSecret.password); + def parsablePassword = makePasswordUrlConform(decodedPassword); + + config.baseUrl = "https://${bezeichner}.${env.CLUSTER_BASE_URL}" as String + config.env.dbUrl = "mongodb://${decodeString(plutoDatabaseSecret.username)}:${parsablePassword}@localhost:${dbPort}/admin?ssl=false&directConnection=true" as String + config.env.keycloakUrl = "https://${env.SSO_URL}/" as String + config.env.keycloakRealm = namespace as String + config.env.keycloakClient = "alfa" as String + config.env.sabineUuid = getKeycloakUuid(namespace, "sabine") as String + config.videosFolder = "./reports/${testFolder}/videos" as String + config.screenshotsFolder = "./reports/${testFolder}/screenshots" as String + config.reporterOptions.reportDir = "./reports/${testFolder}/mochawesome-report" as String - config.baseUrl = "https://${bezeichner}.${env.CLUSTER_BASE_URL}" as String - config.env.dbUrl = "mongodb://${decodeString(plutoDatabaseSecret.username)}:${parsablePassword}@localhost:${dbPort}/admin?ssl=false&directConnection=true" as String - config.env.keycloakUrl = "https://${env.SSO_URL}/" as String - config.env.keycloakRealm = namespace as String - config.env.keycloakClient = "alfa" as String - config.env.sabineUuid = getKeycloakUuid(namespace, "sabine") as String - config.integrationFolder = "./src/e2e/${testFolder}" as String - config.videosFolder = "./reports/${testFolder}/videos" as String - config.screenshotsFolder = "./reports/${testFolder}/screenshots" as String - config.reporterOptions.reportDir = "./reports/${testFolder}/mochawesome-report" as String - - config.env.put("search", getElasticsearchEnv(namespace)) - config.env.put("userManager", getUserManagerEnv(namespace, dbPort)) - - return JSONObject.fromObject(config) + config.env.put("search", getElasticsearchEnv(namespace)) + config.env.put("userManager", getUserManagerEnv(namespace, dbPort)) + + writeJSON file: configName, json: config + } } String makePasswordUrlConform(String password) { diff --git a/goofy-client/apps/goofy-e2e/cypress.config.json b/goofy-client/apps/goofy-e2e/cypress.config.json new file mode 100644 index 0000000000000000000000000000000000000000..6827a723f10c4d2ad84cb238283746173a2789aa --- /dev/null +++ b/goofy-client/apps/goofy-e2e/cypress.config.json @@ -0,0 +1,39 @@ +{ + "baseUrl": "http://localhost:4300", + "env": { + "dbUrl": "mongodb://localhost:27018", + "database": "test", + "keycloakRealm": "by-e2e-local-dev", + "keycloakUrl": "https://sso.dev.by.ozg-cloud.de/", + "keycloakClient": "alfa", + "sabineUuid": "2ccf0c13-da74-4516-ae3d-f46d30e8ec0c", + "search": { + "url": "http://localhost:9200", + "index": "e2e-test-index", + "user": "elastic", + "password": "password" + }, + "userManager": { + "dbUrl": "mongodb://localhost:27018", + "database": "usermanager" + } + }, + "fileServerFolder": ".", + "fixturesFolder": "./src/fixtures", + "video": false, + "videosFolder": "./reports/videos", + "screenshotsFolder": "./reports/screenshots", + "chromeWebSecurity": false, + "reporter": "../../node_modules/cypress-mochawesome-reporter", + "defaultCommandTimeout": 10000, + "reporterOptions": { + "html": false, + "json": true, + "reportDir": "./reports/mochawesome-report", + "reportFilename": "report", + "overwrite": true + }, + "specPattern": "src/e2e/**/*.cy.{js,jsx,ts,tsx}", + "supportFile": "src/support/e2e.ts", + "testIsolation": false +} \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/cypress.config.ts b/goofy-client/apps/goofy-e2e/cypress.config.ts index 2c142046e35bbac0bb32403266bebfdff6166203..39e23acec49385b76ca5f77fe97c06068b096479 100644 --- a/goofy-client/apps/goofy-e2e/cypress.config.ts +++ b/goofy-client/apps/goofy-e2e/cypress.config.ts @@ -6,45 +6,7 @@ const Binary = require('mongodb').Binary; const ObjectId = require('mongodb').ObjectId; const Long = require('mongodb').Long; -const cypressJsonConfig = { - baseUrl: 'http://localhost:4300', - env: { - dbUrl: 'mongodb://localhost:27018', - database: 'test', - keycloakRealm: 'by-e2e-local-dev', - keycloakUrl: 'https://sso.dev.by.ozg-cloud.de/', - keycloakClient: 'alfa', - sabineUuid: '2ccf0c13-da74-4516-ae3d-f46d30e8ec0c', - search: { - url: 'http://localhost:9200', - index: 'e2e-test-index', - user: 'elastic', - password: 'password', - }, - userManager: { - dbUrl: 'mongodb://localhost:27018', - database: 'usermanager', - }, - }, - fileServerFolder: '.', - fixturesFolder: './src/fixtures', - video: false, - videosFolder: './reports/videos', - screenshotsFolder: './reports/screenshots', - chromeWebSecurity: false, - reporter: '../../node_modules/cypress-mochawesome-reporter', - defaultCommandTimeout: 10000, - reporterOptions: { - html: false, - json: true, - reportDir: './reports/mochawesome-report', - reportFilename: 'report', - overwrite: true, - }, - specPattern: 'src/e2e/**/*.cy.{js,jsx,ts,tsx}', - supportFile: 'src/support/e2e.ts', - testIsolation: false -}; +const cypressJsonConfig = require('./cypress.config.json'); export default defineConfig({ e2e: {