diff --git a/.gitignore b/.gitignore index 211dab2..28b40bb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ yarn-error.log node_modules build dist +screenshots +cypress/videos +cypress/reports .env.local .env.development.local .env.test.local diff --git a/Jenkinsfile b/Jenkinsfile index e6b2481..a3f651d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,19 +16,19 @@ pipeline { "ES lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-test eslint''' + sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci eslint''' } }, "Style lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-test stylelint''' + sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci stylelint''' } }, "Prettier": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-test prettier''' + sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci prettier''' } } ) @@ -43,8 +43,8 @@ pipeline { node(label: 'docker') { script { try { - sh '''docker pull eeacms/volto-test''' - sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-test''' + sh '''docker pull plone/volto-addon-ci''' + sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci''' sh '''mkdir -p xunit-reports''' sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/''' sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/junit.xml xunit-reports/''' @@ -80,7 +80,7 @@ pipeline { 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 eeacms/volto-test; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-test cypress''' + sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e DEPENDENCIES="$DEPENDENCIES" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci cypress''' } finally { sh '''mkdir -p cypress-reports''' sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/''' diff --git a/README.md b/README.md index 13c48d6..920190c 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ ], "dependencies": { - "@eeacms/volto-accordion-block": "^1.0.0" + "@eeacms/volto-accordion-block": "^2.0.0" } ``` diff --git a/cypress.json b/cypress.json index fb834b3..23eedae 100644 --- a/cypress.json +++ b/cypress.json @@ -1,4 +1,11 @@ { "baseUrl": "http://localhost:3000", - "viewportWidth": 1280 + "viewportWidth": 1280, + "defaultCommandTimeout": 15000, + "reporter": "junit", + "video": true, + "reporterOptions": { + "mochaFile": "cypress/reports/cypress-[hash].xml", + "toConsole": true + } } diff --git a/jest-addon.config.js b/jest-addon.config.js new file mode 100644 index 0000000..7c15499 --- /dev/null +++ b/jest-addon.config.js @@ -0,0 +1,36 @@ +module.exports = { + testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'], + collectCoverageFrom: [ + 'src/addons/**/src/**/*.{js,jsx,ts,tsx}', + '!src/**/*.d.ts', + ], + moduleNameMapper: { + '@plone/volto/cypress': '/node_modules/@plone/volto/cypress', + '@plone/volto/babel': '/node_modules/@plone/volto/babel', + '@plone/volto/(.*)$': '/node_modules/@plone/volto/src/$1', + '@package/(.*)$': '/src/$1', + '@plone/volto-quanta/(.*)$': '/src/addons/volto-quanta/src/$1', + '@eeacms/(.*?)/(.*)$': '/src/addons/$1/src/$2', + 'volto-slate/(.*)$': '/src/addons/volto-slate/src/$1', + '~/(.*)$': '/src/$1', + 'load-volto-addons': + '/node_modules/@plone/volto/jest-addons-loader.js', + }, + transform: { + '^.+\\.js(x)?$': 'babel-jest', + '^.+\\.css$': 'jest-css-modules', + '^.+\\.less$': 'jest-css-modules', + '^.+\\.scss$': 'jest-css-modules', + '^.+\\.(png)$': 'jest-file', + '^.+\\.(jpg)$': 'jest-file', + '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js', + }, + coverageThreshold: { + global: { + branches: 5, + functions: 5, + lines: 5, + statements: 5, + }, + }, +};