diff --git a/CHANGELOG.md b/CHANGELOG.md index 6815f3c5c..2e559937e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix oauth-proxy sidecar image ([#862](https://github.com/opendevstack/ods-quickstarters/issues/862)) - Upgrade be-gateway-nginx from fedora-rpm to rocky and from version 1.19 to 1.21 ([#880](https://github.com/opendevstack/ods-quickstarters/issues/880)) - Upgraded to Cypress 12, improve login support, add video support ([#899](https://github.com/opendevstack/ods-quickstarters/issues/899)) +- Added Cypress Cloud integration to cypress QS and changed agent node version to node 18 ([#935](https://github.com/opendevstack/ods-quickstarters/pull/935)) - Fix inf-terraform-agent bundler complaining about /tmp permissions ([#903](https://github.com/opendevstack/ods-quickstarters/pull/903)) - Fix nodejs 18 build by removing option always-auth ([#905](https://github.com/opendevstack/ods-quickstarters/issues/905)) - Removed protractor-related configuration from `ini.sh` in Ionic quickstarter ([#885](https://github.com/opendevstack/ods-quickstarters/issues/885)) diff --git a/docs/modules/quickstarters/pages/e2e-cypress.adoc b/docs/modules/quickstarters/pages/e2e-cypress.adoc index 513a1f069..587e70441 100644 --- a/docs/modules/quickstarters/pages/e2e-cypress.adoc +++ b/docs/modules/quickstarters/pages/e2e-cypress.adoc @@ -66,9 +66,9 @@ A more advanced solution could be the use of a custom builder agent, where Cypre [source,docker] ---- # The following FROM tag is informational. It is overwritten by OpenShift. -FROM ods/jenkins-agent-nodejs16:4.x +FROM ods/jenkins-agent-nodejs18:4.x -ARG cypressVersion=9.5.3 +ARG cypressVersion=12.9.0 ARG cypressHash=... USER root @@ -94,10 +94,39 @@ RUN chgrp -R 0 $HOME && \ USER 1001 ---- +== Cypress Cloud + +To use Cypress Cloud within the Cypress QuickSarter, follow these steps: + +1. **Create a project in Cypress Cloud.** Access Cypress Cloud by following this link (https://cloud.cypress.io/), and create a project. This project will be used to store your Cypress tests and results. + +2. **Change the project ID as indicated in Cypress Cloud.** After creating the project, you will need to change the project ID in the four config files, to the one indicated in Cypress Cloud. This ID is used to identify your project and ensure that your tests are associated with the correct project. + +3. **Set the Cypress Record Key as an environment variable in Openshift.** To enable recording of your tests in Cypress Cloud, you will need to set the Cypress Record Key as an environment variable named CYPRESS_RECORD_KEY in Openshift. This key is provided by Cypress and is used to authenticate your tests and results. By setting it in Openshift, we ensure that the record functionality will only be used in official runs and not for local development. + +4. **Modify the Jenkinsfile for using the record script.** In the Jenkinsfile, change the exeuction line: +[source,Jenkinsfile] +---- +def status = sh(script: 'npm run e2e', returnStatus: true) +---- +for the following block of code, which will run the record script only when in master or in a release branch: +[source,Jenkinsfile] +---- +if (context.gitBranch == 'master' || context.gitBranch.startsWith('release/')) { + def status = sh(script: 'npm run e2e:jenkins:record', returnStatus: true) +} else { + def status = sh(script: 'npm run e2e', returnStatus: true) +} +---- + +**Only use this functionality in releases, not development.** It is important to note that Cypress Cloud is intended for use in releases, not development. This ensures that your tests are run against stable and reliable code, and that the Dashboard does not get overflooded with non-relevant tests. For the same reason, the Jenkinsfile is configured to only pass the record parameter when running in the master branch, or in a release. + +You can find more information about using the Cypress Cloud in the official documentation for Cypress https://docs.cypress.io/guides/cloud/introduction. + == Builder agent used This quickstarter uses -https://github.com/opendevstack/ods-quickstarters/tree/master/common/jenkins-agents/nodejs16[Node.js 16 builder agent] for Jenkins. +https://github.com/opendevstack/ods-quickstarters/tree/master/common/jenkins-agents/nodejs18[Node.js 18 builder agent] for Jenkins. == Known limitations diff --git a/e2e-cypress/Jenkinsfile b/e2e-cypress/Jenkinsfile index 7e40c0f8c..3e629d125 100644 --- a/e2e-cypress/Jenkinsfile +++ b/e2e-cypress/Jenkinsfile @@ -15,7 +15,7 @@ node { library("ods-jenkins-shared-library@${sharedLibraryRef}") odsQuickstarterPipeline( - imageStreamTag: "${odsNamespace}/jenkins-agent-nodejs16:${agentImageTag}", + imageStreamTag: "${odsNamespace}/jenkins-agent-nodejs18:${agentImageTag}", ) { context -> odsQuickstarterStageCopyFiles(context) diff --git a/e2e-cypress/Jenkinsfile.template b/e2e-cypress/Jenkinsfile.template index b1fa98865..7a27b076b 100644 --- a/e2e-cypress/Jenkinsfile.template +++ b/e2e-cypress/Jenkinsfile.template @@ -4,15 +4,19 @@ node { dockerRegistry = env.DOCKER_REGISTRY + cypressRecordKey = env.CYPRESS_RECORD_KEY } odsComponentPipeline( podContainers: [ containerTemplate( name: 'jnlp', - image: "${dockerRegistry}/ods/jenkins-agent-nodejs16:@shared_library_ref@", + image: "${dockerRegistry}/ods/jenkins-agent-nodejs18:@shared_library_ref@", workingDir: '/tmp', - resourceRequestCpu: '10m', + envVars: [ + envVar(key: 'CYPRESS_RECORD_KEY', value: cypressRecordKey) + ], + resourceRequestCpu: '100m', resourceLimitCpu: '300m', resourceRequestMemory: '1Gi', resourceLimitMemory: '2Gi', diff --git a/e2e-cypress/files/README.md b/e2e-cypress/files/README.md index 784275b20..89367eb33 100644 --- a/e2e-cypress/files/README.md +++ b/e2e-cypress/files/README.md @@ -43,6 +43,14 @@ In order to generate one xml report per test type (installation, integration and With Cypress 12 version is now available `cy.origin()` that allows you to handle redirections. This funcionality eases the login handling. See `./support/e2e.ts` for a generic login example. +## Cypress Cloud + +Cypress Cloud has been enabled as a functionality and can be used by the quickstarter users. Some configuration needs to be done in the quickstarter for the dashboard to start recording executions. + +The steps for configuring this functionality are defined in (https://www.opendevstack.org/ods-documentation/opendevstack/latest/quickstarters/e2e-cypress.html). + +For more information on this, please contact the support team. + #### *Obsolete* This quickstarter provides a login command for Azure SSO with MSALv2 (`./support/msalv2-login.ts`) as well as sample code for a generic login (`./support/generic-login.ts`). diff --git a/e2e-cypress/files/cypress-acceptance.config.ts b/e2e-cypress/files/cypress-acceptance.config.ts index 039e97389..b5c9c6623 100644 --- a/e2e-cypress/files/cypress-acceptance.config.ts +++ b/e2e-cypress/files/cypress-acceptance.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'cypress' import setupNodeEvents from './plugins/index.js' export default defineConfig({ + //projectId: '[Your project ID from Cypress cloud]', reporter: 'junit', reporterOptions: { mochaFile: 'build/test-results/acceptance-junit-[hash].xml', diff --git a/e2e-cypress/files/cypress-installation.config.ts b/e2e-cypress/files/cypress-installation.config.ts index 86a1ef50c..bee3fc611 100644 --- a/e2e-cypress/files/cypress-installation.config.ts +++ b/e2e-cypress/files/cypress-installation.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'cypress' import setupNodeEvents from './plugins/index.js' export default defineConfig({ - //projectId: '[Define your project id for Cypress cloud]', + //projectId: '[Your project ID from Cypress cloud]', reporter: 'junit', reporterOptions: { mochaFile: 'build/test-results/installation-junit-[hash].xml', diff --git a/e2e-cypress/files/cypress-integration.config.ts b/e2e-cypress/files/cypress-integration.config.ts index 6023e1fe1..02f233b29 100644 --- a/e2e-cypress/files/cypress-integration.config.ts +++ b/e2e-cypress/files/cypress-integration.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'cypress' import setupNodeEvents from './plugins/index.js' export default defineConfig({ - //projectId: '[Define your project id for Cypress cloud]', + //projectId: '[Your project ID from Cypress cloud]', reporter: 'junit', reporterOptions: { mochaFile: 'build/test-results/integration-junit-[hash].xml', diff --git a/e2e-cypress/files/package.json b/e2e-cypress/files/package.json index 9a5bdcfef..02f05932a 100644 --- a/e2e-cypress/files/package.json +++ b/e2e-cypress/files/package.json @@ -14,7 +14,8 @@ "junit-acceptance-report": "jrm build/test-results/acceptance-junit.xml 'build/test-results/acceptance-*.xml'", "delete-junit-results": "rimraf build/test-results", "e2e": "npm-run-all delete-junit-results cypress:run-installation cypress:run-integration cypress:run-acceptance", - "combine:reports": "npm-run-all junit-installation-report junit-integration-report junit-acceptance-report" + "combine:reports": "npm-run-all junit-installation-report junit-integration-report junit-acceptance-report", + "e2e:jenkins:record": "npm run delete-junit-results && npm run cypress:run-installation --record && npm run cypress:run-integration --record && npm run cypress:run-acceptance --record" }, "private": true, "devDependencies": {