From c83fde389637543ca4e8404724700ec279e61980 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 27 Sep 2023 14:56:03 +0200 Subject: [PATCH] OZG-3934 Use new Cypress configuration parameter --- goofy-client/apps/goofy-e2e/Jenkinsfile | 49 ++++++++++--------------- goofy-client/package.json | 2 +- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/goofy-client/apps/goofy-e2e/Jenkinsfile b/goofy-client/apps/goofy-e2e/Jenkinsfile index cb5ffcccaa..50fd697a3f 100644 --- a/goofy-client/apps/goofy-e2e/Jenkinsfile +++ b/goofy-client/apps/goofy-e2e/Jenkinsfile @@ -614,12 +614,12 @@ Void publishE2ETestResult(String reportFolder, String reportName) { } String runTests(String bezeichner, String reportFolder, Integer dbPort, String stageName) { - def configFile = generateCypressConfig(bezeichner, reportFolder, dbPort) + def config = generateCypressConfig(bezeichner, reportFolder, dbPort) try { dir("goofy-client") { sh "npm run cypress:version" - sh "npm run cypress:ci-run --CONFIG_FILE=${configFile} --REPORT_FOLDER=${reportFolder}" + sh "npm run cypress:ci-run --CONFIG='${config}' --REPORT_FOLDER=${reportFolder}" } } catch (Exception e) { printNpmDebugLog() @@ -658,35 +658,26 @@ String cutBranchNameForKeycloakRealm(String branchName, String stageName) { String generateCypressConfig(String bezeichner, String testFolder, Integer dbPort) { def namespace = generateNamespace(bezeichner) - def configName = "cypress-ci-"+testFolder+".json" - dir('goofy-client/apps/goofy-e2e/'){ - def config = readJSON file: 'cypress-ci.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.integrationFolder = "./src/integration/${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)) - - writeJSON file: configName, json: config - - sh "cat ${configName}" - } + def plutoDatabaseSecret = getPlutoDatabaseSecret(namespace); + def decodedPassword = decodeString(plutoDatabaseSecret.password); + def parsablePassword = makePasswordUrlConform(decodedPassword); - return configName + 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/integration/${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) } String makePasswordUrlConform(String password) { diff --git a/goofy-client/package.json b/goofy-client/package.json index b2b96281e0..f3cc6f84ca 100644 --- a/goofy-client/package.json +++ b/goofy-client/package.json @@ -39,7 +39,7 @@ "cypress:version": "npx cypress version", "cypress:install": "npx cypress install", "cypress:open": "npx cypress open --project apps/goofy-e2e", - "cypress:ci-run": "npm run cypress:delete-old-reports --REPORT_FOLDER=${npm_config_report_folder} ; NO_COLOR=1 npm run cypress:run -- --env cypressCiJsonFile=${npm_config_config_file} ; test=$(echo \"$?\") ; npm run cypress:pre-merge --REPORT_FOLDER=${npm_config_report_folder} ; npm run cypress:generate-report --REPORT_FOLDER=${npm_config_report_folder} ; exit $test", + "cypress:ci-run": "npm run cypress:delete-old-reports --REPORT_FOLDER=${npm_config_report_folder} ; NO_COLOR=1 npm run cypress:run -- --config=${npm_config_config} ; test=$(echo \"$?\") ; npm run cypress:pre-merge --REPORT_FOLDER=${npm_config_report_folder} ; npm run cypress:generate-report --REPORT_FOLDER=${npm_config_report_folder} ; exit $test", "cypress:delete-old-reports": "REPORT_FOLDER=${npm_config_report_folder} node apps/goofy-e2e/src/support/delete-old-reports.ts", "cypress:pre-merge": "REPORT_FOLDER=${npm_config_report_folder} node apps/goofy-e2e/src/support/pre-merge.ts", "cypress:generate-report": "npm run cypress:merge-report --REPORT_FOLDER=${npm_config_report_folder} ; npm run cypress:generate-html --REPORT_FOLDER=${npm_config_report_folder}", -- GitLab