Skip to content

Commit

Permalink
Merge pull request #3 from eea/develop
Browse files Browse the repository at this point in the history
Enables cypress tests -> don't wait for breadcrumbs
  • Loading branch information
razvanMiu committed Nov 2, 2021
2 parents 3ce621a + 462ff59 commit 48f24b2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 457 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [0.1.2](https://github.com/eea/volto-industry-theme/compare/0.1.1...0.1.2)

- Update [`3c681b9`](https://github.com/eea/volto-industry-theme/commit/3c681b9cb4790f37ef149efd5aa8b55ea4161656)
- Enables cypress tests -> don't wait for breadcrumbs [`972e593`](https://github.com/eea/volto-industry-theme/commit/972e5931504f2e0ab866b5c5f8d2b9e1bb5053b9)

#### [0.1.1](https://github.com/eea/volto-industry-theme/compare/0.1.0...0.1.1)

> 1 November 2021
- Added eprtr blocks and more [`#2`](https://github.com/eea/volto-industry-theme/pull/2)
- Commented cypress [`80eb317`](https://github.com/eea/volto-industry-theme/commit/80eb317730e92feef27316f87ba4f6080e5fa7fd)
- Use latest addons versions [`384cd34`](https://github.com/eea/volto-industry-theme/commit/384cd34d51b8debb1444cb241576149e4abfe432)
- Stylelint fix [`19ef60c`](https://github.com/eea/volto-industry-theme/commit/19ef60c117e427fa7f1df4ced8a9686e88b19c72)
- Added eprtr blocks and more [`0ad23d2`](https://github.com/eea/volto-industry-theme/commit/0ad23d2e17fafff396137e53b5903b3b0b4b41e8)
- Improved Header & Footer [`cdbedcf`](https://github.com/eea/volto-industry-theme/commit/cdbedcf4cc75f71c8c892042db2d814f210348f0)
- Theme override [`c31ef7e`](https://github.com/eea/volto-industry-theme/commit/c31ef7e694b310508bace3b43a6ea2db142b7a54)
- Run bootstrap [`16b42cc`](https://github.com/eea/volto-industry-theme/commit/16b42cc3b48907fb0c803f256b549c034ca90d96)
Expand Down
95 changes: 47 additions & 48 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,52 +74,52 @@ pipeline {
}
}

// stage('Integration tests') {
// steps {
// parallel(

// "Cypress": {
// node(label: 'docker') {
// script {
// try {
// sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
// sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
// } finally {
// try {
// sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
// sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
// sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
// sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
// coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true
// if ( coverage == 0 ) {
// publishHTML (target : [allowMissing: false,
// alwaysLinkToLastBuild: true,
// keepAll: true,
// reportDir: 'cypress-coverage/coverage/lcov-report',
// reportFiles: 'index.html',
// reportName: 'CypressCoverage',
// reportTitles: 'Integration Tests Code Coverage'])
// }
// archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
// stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
// }
// finally {
// catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
// junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
// }
// sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true

// }
// }
// }
// }
// }

// )
// }
// }
stage('Integration tests') {
steps {
parallel(

"Cypress": {
node(label: 'docker') {
script {
try {
sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
} finally {
try {
sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true
if ( coverage == 0 ) {
publishHTML (target : [allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'cypress-coverage/coverage/lcov-report',
reportFiles: 'index.html',
reportName: 'CypressCoverage',
reportTitles: 'Integration Tests Code Coverage'])
}
archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
}
finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
}
sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true

}
}
}
}
}

)
}
}

stage('Report to SonarQube') {
// Exclude Pull-Requests
Expand All @@ -138,8 +138,7 @@ pipeline {
def nodeJS = tool 'NodeJS11';
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
// sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Demo GIF

### Try volto-industry-theme with Docker

**IMPORTANT:** make sure that you don't wait for `@breadcrumbs` request in your frontend cypress tests as this theme disables breadcrumbs.

1. Get the latest Docker images

```
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const setupBeforeEach = () => {
});
cy.visit('/cypress/my-page');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
// cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('my-page');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-industry-theme",
"version": "0.1.1",
"version": "0.1.2",
"description": "@eeacms/volto-industry-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
122 changes: 0 additions & 122 deletions src/customizations/volto/components/theme/View/DefaultView.jsx

This file was deleted.

Loading

0 comments on commit 48f24b2

Please sign in to comment.