From bbb9e6fe6683755442ff0dc72f2601742b74e13d Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Thu, 10 Nov 2022 00:29:47 +0200 Subject: [PATCH 01/15] fix: clean up facility/site name before fetching data refs #147296 --- .coverage.babel.config.js | 2 +- .i18n.babel.config.js | 18 +- Jenkinsfile | 14 +- Makefile | 62 ++++- README.md | 104 ++------ RELEASE.md | 74 ++++++ babel.config.js | 17 ++ cypress.config.js | 26 ++ .../01-block-basics.cy.js} | 19 +- cypress/plugins/index.js | 26 -- cypress/support/commands.js | 239 +++++++++++++++++- cypress/support/e2e.js | 125 +++++++++ cypress/support/index.js | 53 ---- jest-addon.config.js | 8 +- locales/volto.pot | 0 .../manage/Blocks/IndustryDataTable/View.jsx | 5 +- .../manage/Blocks/IndustryMap/index.js | 17 +- src/helpers/index.js | 8 + 18 files changed, 585 insertions(+), 232 deletions(-) create mode 100644 RELEASE.md create mode 100644 babel.config.js create mode 100644 cypress.config.js rename cypress/{integration/block-basics.js => e2e/01-block-basics.cy.js} (57%) delete mode 100644 cypress/plugins/index.js create mode 100644 cypress/support/e2e.js delete mode 100644 cypress/support/index.js create mode 100644 locales/volto.pot diff --git a/.coverage.babel.config.js b/.coverage.babel.config.js index e8b54d3..37219fd 100644 --- a/.coverage.babel.config.js +++ b/.coverage.babel.config.js @@ -2,7 +2,7 @@ const defaultBabel = require('@plone/volto/babel'); function applyDefault(api) { const voltoBabel = defaultBabel(api); - voltoBabel.plugins.push('@babel/plugin-transform-modules-commonjs', 'transform-class-properties', 'istanbul'); + voltoBabel.plugins.push('istanbul'); return voltoBabel; } diff --git a/.i18n.babel.config.js b/.i18n.babel.config.js index 2f4e1e8..a900a75 100644 --- a/.i18n.babel.config.js +++ b/.i18n.babel.config.js @@ -1,17 +1 @@ -module.exports = function (api) { - api.cache(true); - const presets = ['razzle/babel']; - const plugins = [ - [ - 'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work - { - messagesDir: './build/messages/', - }, - ], - ]; - - return { - plugins, - presets, - }; -}; +module.exports = require('@plone/volto/babel'); diff --git a/Jenkinsfile b/Jenkinsfile index 74cd622..316b595 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { NAMESPACE = "@eeacms" SONARQUBE_TAGS = "volto.eea.europa.eu,industry.eea.europa.eu" DEPENDENCIES = "" - VOLTO = "16.0.0-alpha.14" + VOLTO = "alpha" } stages { @@ -41,19 +41,19 @@ pipeline { "ES lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO="$VOLTO" plone/volto-addon-ci eslint''' + sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha eslint''' } }, "Style lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO="$VOLTO" plone/volto-addon-ci stylelint''' + sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha stylelint''' } }, "Prettier": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO="$VOLTO" plone/volto-addon-ci prettier''' + sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha prettier''' } } ) @@ -77,8 +77,8 @@ pipeline { node(label: 'docker') { script { try { - sh '''docker pull plone/volto-addon-ci''' - sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci''' + sh '''docker pull plone/volto-addon-ci:alpha''' + sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha''' sh '''rm -rf xunit-reports''' sh '''mkdir -p xunit-reports''' sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/''' @@ -126,7 +126,7 @@ pipeline { script { try { sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' - 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" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress''' + sh '''docker pull plone/volto-addon-ci:alpha; 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" -e NODE_ENV=development -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' } finally { try { sh '''rm -rf cypress-reports cypress-results cypress-coverage''' diff --git a/Makefile b/Makefile index 44057ec..6b61d55 100644 --- a/Makefile +++ b/Makefile @@ -36,15 +36,63 @@ start-backend-docker: ## Starts a Docker-based backend .PHONY: test test: - docker pull plone/volto-addon-ci - docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" plone/volto-addon-ci yarn test --watchAll=false + docker pull plone/volto-addon-ci:alpha + docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha .PHONY: test-update test-update: - docker pull plone/volto-addon-ci - docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" plone/volto-addon-ci yarn test --watchAll=false -u + docker pull plone/volto-addon-ci:alpha + docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha yarn test src/addons/${DIR}/src --watchAll=false -u .PHONY: help -help: ## Show this help. - @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" -.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" +help: ## Show this help. + @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" + + +ifeq ($(wildcard ./project),) + NODE_MODULES = "../../../node_modules" +else + NODE_MODULES = "./project/node_modules" +endif + +.PHONY: stylelint +stylelint: + $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' + +.PHONY: stylelint-overrides +stylelint-overrides: + $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' + +.PHONY: stylelint-fix +stylelint-fix: + $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix + $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix + +.PHONY: prettier +prettier: + $(NODE_MODULES)/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}' + +.PHONY: prettier-fix +prettier-fix: + $(NODE_MODULES)/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}' + +.PHONY: lint +lint: + $(NODE_MODULES)/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}' + +.PHONY: lint-fix +lint-fix: + $(NODE_MODULES)/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}' + +.PHONY: i18n +i18n: + rm -rf build/messages + NODE_ENV=development $(NODE_MODULES)/.bin/i18n --addon + +.PHONY: cypress-run +cypress-run: + NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run + +.PHONY: cypress-open +cypress-open: + NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open diff --git a/README.md b/README.md index ddbfa57..99d19f8 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Demo GIF ``` 1. Start Plone backend + ``` docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone ``` @@ -52,25 +53,25 @@ Demo GIF 1. Start Volto frontend -* If you already have a volto project, just update `package.json`: +- If you already have a volto project, just update `package.json`: - ```JSON - "addons": [ - "@eeacms/volto-industry-theme" - ], + ```JSON + "addons": [ + "@eeacms/volto-industry-theme" + ], - "dependencies": { - "@eeacms/volto-industry-theme": "^1.0.0" - } - ``` + "dependencies": { + "@eeacms/volto-industry-theme": "^1.0.0" + } + ``` -* If not, create one: +- If not, create one: - ``` - npm install -g yo @plone/generator-volto - yo @plone/volto my-volto-project --addon @eeacms/volto-industry-theme - cd my-volto-project - ``` + ``` + npm install -g yo @plone/generator-volto + yo @plone/volto my-volto-project --addon @eeacms/volto-industry-theme + cd my-volto-project + ``` 1. Install new add-ons and restart Volto: @@ -85,78 +86,7 @@ Demo GIF ## Release -### Automatic release using Jenkins - -* The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory. -* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits. -* The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage. -* Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool. -* As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready. -* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0). -* You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation. -* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file. - -### Manual release from the develop branch ( beta release ) - -#### Installation and configuration of release-it - -You need to first install the [release-it](https://github.com/release-it/release-it) client. - - ``` - npm install -g release-it - ``` - -Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository. - -Release-it is a tool that automates 4 important steps in the release process: - -1. Version increase in `package.json` ( increased from the current version in `package.json`) -2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases ) -3. GitHub release on the commit with the changelog and package.json modification on the develop branch -4. NPM release ( by default it's disabled, but can be enabled in the configuration file ) - -To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens) - - ``` - export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX - ``` - - To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN : - - ``` - echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc - ``` - -#### Using release-it tool - -There are 3 yarn scripts that can be run to do the release - -##### yarn release-beta - -Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input). - -``` -? Select increment (next version): -❯ prepatch (0.1.1-beta.0) - preminor (0.2.0-beta.0) - premajor (1.0.0-beta.0) - Other, please specify... -``` - -##### yarn release-major-beta - -Same as `yarn release-beta`, but with premajor version pre-selected. - -##### yarn release - -Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other. - -#### Important notes - -> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST. - -> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version). - +See [RELEASE.md](https://github.com/eea/volto-industry-theme/blob/master/RELEASE.md). ## How to contribute diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..24f98ee --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,74 @@ +## Release + +### Automatic release using Jenkins + +* The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory. +* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits. +* The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage. +* Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool. +* As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready. +* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0). +* You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation. +* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file. + +### Manual release from the develop branch ( beta release ) + +#### Installation and configuration of release-it + +You need to first install the [release-it](https://github.com/release-it/release-it) client. + + ``` + npm install -g release-it + ``` + +Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository. + +Release-it is a tool that automates 4 important steps in the release process: + +1. Version increase in `package.json` ( increased from the current version in `package.json`) +2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases ) +3. GitHub release on the commit with the changelog and package.json modification on the develop branch +4. NPM release ( by default it's disabled, but can be enabled in the configuration file ) + +To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens) + + ``` + export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX + ``` + + To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN : + + ``` + echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc + ``` + +#### Using release-it tool + +There are 3 yarn scripts that can be run to do the release + +##### yarn release-beta + +Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input). + +``` +? Select increment (next version): +❯ prepatch (0.1.1-beta.0) + preminor (0.2.0-beta.0) + premajor (1.0.0-beta.0) + Other, please specify... +``` + +##### yarn release-major-beta + +Same as `yarn release-beta`, but with premajor version pre-selected. + +##### yarn release + +Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other. + +#### Important notes + +> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST. + +> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version). + diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..51bd52b --- /dev/null +++ b/babel.config.js @@ -0,0 +1,17 @@ +module.exports = function (api) { + api.cache(true); + const presets = ['razzle']; + const plugins = [ + [ + 'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work + { + messagesDir: './build/messages/', + }, + ], + ]; + + return { + plugins, + presets, + }; +}; diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 0000000..30be8ac --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,26 @@ +const { defineConfig } = require('cypress'); + +module.exports = defineConfig({ + viewportWidth: 1280, + defaultCommandTimeout: 8888, + chromeWebSecurity: false, + reporter: 'junit', + video: true, + retries: { + runMode: 8, + openMode: 0, + }, + reporterOptions: { + mochaFile: 'cypress/reports/cypress-[hash].xml', + jenkinsMode: true, + toConsole: true, + }, + e2e: { + setupNodeEvents(on, config) { + // e2e testing node events setup code + require('@cypress/code-coverage/task')(on, config); + return config; + }, + baseUrl: 'http://localhost:3000', + }, +}); diff --git a/cypress/integration/block-basics.js b/cypress/e2e/01-block-basics.cy.js similarity index 57% rename from cypress/integration/block-basics.js rename to cypress/e2e/01-block-basics.cy.js index 454084c..089c7b3 100644 --- a/cypress/integration/block-basics.js +++ b/cypress/e2e/01-block-basics.cy.js @@ -1,20 +1,17 @@ -import { setupBeforeEach, tearDownAfterEach } from '../support'; +import { slateBeforeEach, slateAfterEach } from '../support/e2e'; describe('Blocks Tests', () => { - beforeEach(setupBeforeEach); - afterEach(tearDownAfterEach); + beforeEach(slateBeforeEach); + afterEach(slateAfterEach); it('Add Block: Empty', () => { // Change page title - cy.get('.documentFirstHeading > .public-DraftStyleDefault-block') - .clear() - .type('My Add-on Page') - .get('.documentFirstHeading span[data-text]') - .contains('My Add-on Page'); + cy.clearSlateTitle(); + cy.getSlateTitle().type('My Add-on Page'); - cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type( - '{enter}', - ); + cy.get('.documentFirstHeading').contains('My Add-on Page'); + + cy.getSlate().click(); // Add block cy.get('.ui.basic.icon.button.block-add-button').first().click(); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js deleted file mode 100644 index 27a31a5..0000000 --- a/cypress/plugins/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/// -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -/** - * @type {Cypress.PluginConfig} - */ -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - /* coverage-start - require('@cypress/code-coverage/task')(on, config) - on('file:preprocessor', require('@cypress/code-coverage/use-babelrc')) - return config - coverage-end */ -}; diff --git a/cypress/support/commands.js b/cypress/support/commands.js index ac48461..f269a7f 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -1,5 +1,8 @@ /* eslint no-console: ["error", { allow: ["log"] }] */ +const SLATE_SELECTOR = '.content-area .slate-editor [contenteditable=true]'; +const SLATE_TITLE_SELECTOR = '.block.inner.title [contenteditable="true"]'; + // --- AUTOLOGIN ------------------------------------------------------------- Cypress.Commands.add('autologin', () => { let api_url, user, password; @@ -68,8 +71,7 @@ Cypress.Commands.add( id: contentId, title: contentTitle, image: { - data: - 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC', + data: 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC', encoding: 'base64', filename: 'image.png', 'content-type': 'image/png', @@ -92,7 +94,7 @@ Cypress.Commands.add( title: contentTitle, blocks: { 'd3f1c443-583f-4e8e-a682-3bf25752a300': { '@type': 'title' }, - '7624cf59-05d0-4055-8f55-5fd6597d84b0': { '@type': 'text' }, + '7624cf59-05d0-4055-8f55-5fd6597d84b0': { '@type': 'slate' }, }, blocks_layout: { items: [ @@ -122,9 +124,103 @@ Cypress.Commands.add( }) .then(() => console.log(`${contentType} created`)); } - }, + } ); +// --- Add DX Content-Type ---------------------------------------------------------- +Cypress.Commands.add('addContentType', (name) => { + let api_url, auth; + api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; + auth = { + user: 'admin', + pass: 'admin', + }; + return cy + .request({ + method: 'POST', + url: `${api_url}/@controlpanels/dexterity-types/${name}`, + headers: { + Accept: 'application/json', + }, + auth: auth, + body: { + title: name, + }, + }) + .then(() => console.log(`${name} content-type added.`)); +}); + +// --- Remove DX behavior ---------------------------------------------------------- +Cypress.Commands.add('removeContentType', (name) => { + let api_url, auth; + api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; + auth = { + user: 'admin', + pass: 'admin', + }; + return cy + .request({ + method: 'DELETE', + url: `${api_url}/@controlpanels/dexterity-types/${name}`, + headers: { + Accept: 'application/json', + }, + auth: auth, + body: {}, + }) + .then(() => console.log(`${name} content-type removed.`)); +}); + +// --- Add DX field ---------------------------------------------------------- +Cypress.Commands.add('addSlateJSONField', (type, name) => { + let api_url, auth; + api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; + auth = { + user: 'admin', + pass: 'admin', + }; + return cy + .request({ + method: 'POST', + url: `${api_url}/@types/${type}`, + headers: { + Accept: 'application/json', + }, + auth: auth, + body: { + id: name, + title: name, + description: 'Slate JSON Field', + factory: 'SlateJSONField', + required: false, + }, + }) + .then(() => console.log(`${name} SlateJSONField field added to ${type}`)); +}); + +// --- Remove DX field ---------------------------------------------------------- +Cypress.Commands.add('removeSlateJSONField', (type, name) => { + let api_url, auth; + api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; + auth = { + user: 'admin', + pass: 'admin', + }; + return cy + .request({ + method: 'DELETE', + url: `${api_url}/@types/${type}/${name}`, + headers: { + Accept: 'application/json', + }, + auth: auth, + body: {}, + }) + .then(() => + console.log(`${name} SlateJSONField field removed from ${type}`) + ); +}); + // --- REMOVE CONTENT -------------------------------------------------------- Cypress.Commands.add('removeContent', (path) => { let api_url, auth; @@ -146,6 +242,41 @@ Cypress.Commands.add('removeContent', (path) => { .then(() => console.log(`${path} removed`)); }); +Cypress.Commands.add('typeInSlate', { prevSubject: true }, (subject, text) => { + return ( + cy + .wrap(subject) + .then((subject) => { + subject[0].dispatchEvent( + new InputEvent('beforeinput', { + inputType: 'insertText', + data: text, + }) + ); + return subject; + }) + // TODO: do this only for Electron-based browser which does not understand instantaneously + // that the user inserted some text in the block + .wait(1000) + ); +}); + +Cypress.Commands.add('lineBreakInSlate', { prevSubject: true }, (subject) => { + return ( + cy + .wrap(subject) + .then((subject) => { + subject[0].dispatchEvent( + new InputEvent('beforeinput', { inputType: 'insertLineBreak' }) + ); + return subject; + }) + // TODO: do this only for Electron-based browser which does not understand instantaneously + // that the block was split + .wait(1000) + ); +}); + // --- SET WORKFLOW ---------------------------------------------------------- Cypress.Commands.add( 'setWorkflow', @@ -184,7 +315,7 @@ Cypress.Commands.add( include_children: include_children, }, }); - }, + } ); // --- waitForResourceToLoad ---------------------------------------------------------- @@ -244,9 +375,86 @@ Cypress.Commands.add( setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset); } }); - }, + } ); +Cypress.Commands.add('getSlate', ({ createNewSlate = true } = {}) => { + let slate; + cy.getIfExists( + SLATE_SELECTOR, + () => { + slate = cy.get(SLATE_SELECTOR).last(); + }, + () => { + if (createNewSlate) { + cy.get('.block.inner').last().type('{moveToEnd}{enter}'); + } + slate = cy.get(SLATE_SELECTOR, { timeout: 10000 }).last(); + } + ); + return slate; +}); + +Cypress.Commands.add('clearSlate', (selector) => { + return cy + .get(selector) + .focus() + .click() + .wait(1000) + .type('{selectAll}') + .wait(1000) + .type('{backspace}'); +}); + +Cypress.Commands.add('getSlateTitle', () => { + return cy.get(SLATE_TITLE_SELECTOR, { + timeout: 10000, + }); +}); + +Cypress.Commands.add('clearSlateTitle', () => { + return cy.clearSlate(SLATE_TITLE_SELECTOR); +}); + +Cypress.Commands.add('setSlateSelection', (subject, query, endQuery) => { + cy.get('.slate-editor.selected [contenteditable=true]') + .focus() + .click() + .setSelection(subject, query, endQuery) + .wait(1000); // this wait is needed for the selection change to be detected after +}); + +Cypress.Commands.add('getSlateEditorAndType', (type) => { + cy.getSlate().focus().click().type(type); +}); + +Cypress.Commands.add('setSlateCursor', (subject, query, endQuery) => { + cy.get('.slate-editor.selected [contenteditable=true]') + .focus() + .click() + .setCursor(subject, query, endQuery) + .wait(1000); +}); + +Cypress.Commands.add('clickSlateButton', (button) => { + cy.get(`.slate-inline-toolbar .button-wrapper a[title="${button}"]`, { + timeout: 10000, + }).click({ force: true }); //force click is needed to ensure the button in visible in view. +}); + +Cypress.Commands.add('toolbarSave', () => { + cy.wait(1000); + + // Save + cy.get('#toolbar-save').click(); + cy.waitForResourceToLoad('@navigation'); + cy.waitForResourceToLoad('@breadcrumbs'); + cy.waitForResourceToLoad('@actions'); + cy.waitForResourceToLoad('@types'); + cy.waitForResourceToLoad('my-page'); + cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); +}); + // Low level command reused by `setCursorBefore` and `setCursorAfter`, equal to `setCursorAfter` Cypress.Commands.add( 'setCursor', @@ -262,7 +470,7 @@ Cypress.Commands.add( }); // Depending on what you're testing, you may need to chain a `.click()` here to ensure // further commands are picked up by whatever you're testing (this was required for Slate, for example). - }, + } ); Cypress.Commands.add( @@ -270,7 +478,7 @@ Cypress.Commands.add( { prevSubject: true }, (subject, query) => { cy.wrap(subject).setCursor(query, true); - }, + } ); Cypress.Commands.add( @@ -278,7 +486,7 @@ Cypress.Commands.add( { prevSubject: true }, (subject, query) => { cy.wrap(subject).setCursor(query); - }, + } ); // Helper functions @@ -313,3 +521,16 @@ Cypress.Commands.add('store', () => { Cypress.Commands.add('settings', (key, value) => { return cy.window().its('settings'); }); + +Cypress.Commands.add( + 'getIfExists', + (selector, successAction = () => {}, failAction = () => {}) => { + cy.get('body').then((body) => { + if (body.find(selector).length > 0 && successAction) { + successAction(); + } else if (failAction) { + failAction(); + } + }); + } +); diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js new file mode 100644 index 0000000..f696418 --- /dev/null +++ b/cypress/support/e2e.js @@ -0,0 +1,125 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; +// Alternatively you can use CommonJS syntax: +// require('./commands') + +//Generate code-coverage +import '@cypress/code-coverage/support'; + +export const slateBeforeEach = (contentType = 'Document') => { + cy.autologin(); + cy.createContent({ + contentType: 'Document', + contentId: 'cypress', + contentTitle: 'Cypress', + }); + cy.createContent({ + contentType: contentType, + contentId: 'my-page', + contentTitle: 'My Page', + path: 'cypress', + }); + cy.visit('/cypress/my-page'); + cy.waitForResourceToLoad('@navigation'); + cy.waitForResourceToLoad('@breadcrumbs'); + cy.waitForResourceToLoad('@actions'); + cy.waitForResourceToLoad('@types'); + cy.waitForResourceToLoad('my-page'); + cy.navigate('/cypress/my-page/edit'); +}; + +export const slateAfterEach = () => { + cy.autologin(); + cy.removeContent('cypress'); +}; + +export const slateJsonBeforeEach = (contentType = 'slate') => { + cy.autologin(); + cy.addContentType(contentType); + cy.addSlateJSONField(contentType, 'slate'); + slateBeforeEach(contentType); +}; + +export const slateJsonAfterEach = (contentType = 'slate') => { + cy.autologin(); + cy.removeContentType(contentType); + slateAfterEach(); +}; + +export const getSelectedSlateEditor = () => { + return cy.get('.slate-editor.selected [contenteditable=true]').click(); +}; + +export const createSlateBlock = () => { + cy.get('.ui.basic.icon.button.block-add-button').first().click(); + cy.get('.blocks-chooser .title').contains('Text').click(); + cy.get('.ui.basic.icon.button.slate').contains('Text').click(); + return getSelectedSlateEditor(); +}; + +export const getSlateBlockValue = (sb) => { + return sb.invoke('attr', 'data-slate-value').then((str) => { + return typeof str === 'undefined' ? [] : JSON.parse(str); + }); +}; + +export const createSlateBlockWithList = ({ + numbered, + firstItemText, + secondItemText, +}) => { + let s1 = createSlateBlock(); + + s1.typeInSlate(firstItemText + secondItemText); + + // select all contents of slate block + // - this opens hovering toolbar + cy.contains(firstItemText + secondItemText).then((el) => { + selectSlateNodeOfWord(el); + }); + + // TODO: do not hardcode these selectors: + if (numbered) { + // this is the numbered list option in the hovering toolbar + cy.get('.slate-inline-toolbar > :nth-child(9)').click(); + } else { + // this is the bulleted list option in the hovering toolbar + cy.get('.slate-inline-toolbar > :nth-child(10)').click(); + } + + // move the text cursor + const sse = getSelectedSlateEditor(); + sse.type('{leftarrow}'); + for (let i = 0; i < firstItemText.length; ++i) { + sse.type('{rightarrow}'); + } + + // simulate pressing Enter + getSelectedSlateEditor().lineBreakInSlate(); + + return s1; +}; + +export const selectSlateNodeOfWord = (el) => { + return cy.window().then((win) => { + var event = new CustomEvent('Test_SelectWord', { + detail: el[0], + }); + win.document.dispatchEvent(event); + }); +}; diff --git a/cypress/support/index.js b/cypress/support/index.js deleted file mode 100644 index 5c807ed..0000000 --- a/cypress/support/index.js +++ /dev/null @@ -1,53 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands'; - -// Alternatively you can use CommonJS syntax: -// require('./commands') - -/* coverage-start -//Generate code-coverage -import '@cypress/code-coverage/support'; -coverage-end */ - -export const setupBeforeEach = () => { - cy.autologin(); - cy.createContent({ - contentType: 'Document', - contentId: 'cypress', - contentTitle: 'Cypress', - }); - cy.createContent({ - contentType: 'Document', - contentId: 'my-page', - contentTitle: 'My Page', - path: 'cypress', - }); - cy.visit('/cypress/my-page'); - cy.waitForResourceToLoad('@navigation'); - // cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad('my-page'); - cy.navigate('/cypress/my-page/edit'); - cy.get(`.block.title [data-contents]`); -}; - -export const tearDownAfterEach = () => { - cy.autologin(); - cy.removeContent('cypress'); -}; diff --git a/jest-addon.config.js b/jest-addon.config.js index 7c15499..da38318 100644 --- a/jest-addon.config.js +++ b/jest-addon.config.js @@ -9,18 +9,18 @@ module.exports = { '@plone/volto/babel': '/node_modules/@plone/volto/babel', '@plone/volto/(.*)$': '/node_modules/@plone/volto/src/$1', '@package/(.*)$': '/src/$1', + '@root/(.*)$': '/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', + '@plone/volto-slate': + '/node_modules/@plone/volto/packages/volto-slate/src', '~/(.*)$': '/src/$1', 'load-volto-addons': '/node_modules/@plone/volto/jest-addons-loader.js', + '\\.(css|less|scss|sass)$': 'identity-obj-proxy', }, 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', diff --git a/locales/volto.pot b/locales/volto.pot new file mode 100644 index 0000000..e69de29 diff --git a/src/components/manage/Blocks/IndustryDataTable/View.jsx b/src/components/manage/Blocks/IndustryDataTable/View.jsx index 67ca9aa..940fb41 100644 --- a/src/components/manage/Blocks/IndustryDataTable/View.jsx +++ b/src/components/manage/Blocks/IndustryDataTable/View.jsx @@ -7,6 +7,7 @@ import cx from 'classnames'; import RenderComponent from '@eeacms/volto-datablocks/components/manage/Blocks/SimpleDataTable/components'; import { ConnectorContext } from '@eeacms/volto-datablocks/hocs'; import { setQuery } from '@eeacms/volto-industry-theme/actions'; +import { cleanUpText } from '@eeacms/volto-industry-theme/helpers'; import leftSVG from '@plone/volto/icons/left-key.svg'; import rightSVG from '@plone/volto/icons/right-key.svg'; @@ -175,7 +176,7 @@ const getConditions = (query) => { { like: [ 'siteName', - { literal: query.filter_search.text.replaceAll("'", "''") }, + { literal: cleanUpText(query.filter_search.text) }, ], }, ] @@ -186,7 +187,7 @@ const getConditions = (query) => { { like: [ 'facilityNames', - { literal: query.filter_search.text.replaceAll("'", "''") }, + { literal: cleanUpText(query.filter_search.text) }, ], }, ] diff --git a/src/components/manage/Blocks/IndustryMap/index.js b/src/components/manage/Blocks/IndustryMap/index.js index 2d55c54..eca7c42 100644 --- a/src/components/manage/Blocks/IndustryMap/index.js +++ b/src/components/manage/Blocks/IndustryMap/index.js @@ -2,7 +2,10 @@ import axios from 'axios'; import config from '@plone/volto/registry'; import sliderSVG from '@plone/volto/icons/slider.svg'; import mapPlaceholder from '@eeacms/volto-industry-theme/components/PrivacyProtection/map_placeholder.png'; -import { getEncodedQueryString } from '@eeacms/volto-industry-theme/helpers'; +import { + cleanUpText, + getEncodedQueryString, +} from '@eeacms/volto-industry-theme/helpers'; import IndustryMapEdit from './Edit'; import IndustryMapView from './View'; @@ -192,9 +195,8 @@ export const getSiteExtent = (data) => { MAX(shape_wm.STX) AS MAX_X, MAX(shape_wm.STY) AS MAX_Y FROM [IED].[${db_version}].[SiteMap] - WHERE [siteName] COLLATE Latin1_General_CI_AI LIKE '%${data.text.replaceAll( - "'", - "''", + WHERE [siteName] COLLATE Latin1_General_CI_AI LIKE '%${cleanUpText( + data.text, )}%'`)}`, ); }; @@ -203,9 +205,6 @@ export const getFacilityExtent = (data) => { const db_version = process.env.RAZZLE_DB_VERSION || config.settings.db_version || 'latest'; - let text = data.text.replaceAll('\n', ''); - text = text.replaceAll("'", "''"); - return axios.get( `${config.settings.providerUrl}?${getEncodedQueryString(`SELECT MIN(shape_wm.STX) AS MIN_X, @@ -213,7 +212,9 @@ export const getFacilityExtent = (data) => { MAX(shape_wm.STX) AS MAX_X, MAX(shape_wm.STY) AS MAX_Y FROM [IED].[${db_version}].[SiteMap] - WHERE [facilityNames] COLLATE Latin1_General_CI_AI LIKE '%${text}%'`)}`, + WHERE [facilityNames] COLLATE Latin1_General_CI_AI LIKE '%${cleanUpText( + data.text, + )}%'`)}`, ); }; diff --git a/src/helpers/index.js b/src/helpers/index.js index c2d9a1d..5e57bee 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -10,6 +10,14 @@ import { getBaseUrl } from '@plone/volto/helpers'; import config from '@plone/volto/registry'; import { setConnectedDataParameters } from '@eeacms/volto-datablocks/actions'; +export function cleanUpText(value) { + let text = value.replaceAll('\n', ''); + text = text.replaceAll("'", "''"); + text = text.replace(/^\s+|\s+$/gm, ''); + + return text; +} + export function removeValue(arr) { if (!arr || arr.length === 0) return []; let what, From a3dadf6ade0bfab6faae3e48f712ff3049a050f6 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 10 Nov 2022 10:24:44 +0200 Subject: [PATCH 02/15] update gitignore file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index cdcaf46..5111938 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ .vscode/ .history .eslintrc.js +nyc_output project +coverage logs *.log npm-debug.log* From ed4453225031d4e3b28af464ac7b46d88026d702 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 10 Nov 2022 10:33:11 +0200 Subject: [PATCH 03/15] fix error --- .project.eslintrc.js | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/.project.eslintrc.js b/.project.eslintrc.js index cfefd89..ddbf7bc 100644 --- a/.project.eslintrc.js +++ b/.project.eslintrc.js @@ -1,16 +1,21 @@ -const fs = require('fs'); -const path = require('path'); - -const projectRootPath = fs.realpathSync('./project'); // __dirname -const packageJson = require(path.join(projectRootPath, 'package.json')); -const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions; +const fs = require("fs"); +const path = require("path"); + +const projectRootPath = fs.existsSync("./project") + ? fs.realpathSync("./project") + : fs.realpathSync("./../../../"); +const packageJson = require(path.join(projectRootPath, "package.json")); +const jsConfig = require(path.join( + projectRootPath, + "jsconfig.json" +)).compilerOptions; const pathsConfig = jsConfig.paths; -let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto'); +let voltoPath = path.join(projectRootPath, "node_modules/@plone/volto"); -Object.keys(pathsConfig).forEach(pkg => { - if (pkg === '@plone/volto') { +Object.keys(pathsConfig).forEach((pkg) => { + if (pkg === "@plone/volto") { voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`; } }); @@ -18,29 +23,27 @@ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`); const reg = new AddonConfigurationRegistry(projectRootPath); // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons -const addonAliases = Object.keys(reg.packages).map(o => [ +const addonAliases = Object.keys(reg.packages).map((o) => [ o, reg.packages[o].modulePath, ]); - module.exports = { extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`, settings: { - 'import/resolver': { + "import/resolver": { alias: { map: [ - ['@plone/volto', '@plone/volto/src'], + ["@plone/volto", "@plone/volto/src"], ...addonAliases, - ['@package', `${__dirname}/src`], - ['~', `${__dirname}/src`], + ["@package", `${__dirname}/src`], + ["~", `${__dirname}/src`], ], - extensions: ['.js', '.jsx', '.json'], + extensions: [".js", ".jsx", ".json"], }, - 'babel-plugin-root-import': { - rootPathSuffix: 'src', + "babel-plugin-root-import": { + rootPathSuffix: "src", }, }, }, }; - From 177e74fbf29095095a65b10a684554c39d114dfd Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Thu, 10 Nov 2022 11:13:50 +0200 Subject: [PATCH 04/15] fix: replace cypress config file --- cypress.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 cypress.json diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 736dedd..0000000 --- a/cypress.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "baseUrl": "http://localhost:3000", - "viewportWidth": 1280, - "defaultCommandTimeout": 8888, - "chromeWebSecurity": false, - "reporter": "junit", - "video": true, - "retries": { - "runMode": 8, - "openMode": 0 - }, - "reporterOptions": { - "mochaFile": "cypress/reports/cypress-[hash].xml", - "jenkinsMode": true, - "toConsole": true - } -} From 5ce9269509b215c0603f16aa47b43d8e859ac386 Mon Sep 17 00:00:00 2001 From: valentinab25 <30239069+valentinab25@users.noreply.github.com> Date: Fri, 11 Nov 2022 10:22:40 +0200 Subject: [PATCH 05/15] [JENKINS] try cypress 9.7.0 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index efacfa3..72f30e1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "devDependencies": { "@cypress/code-coverage": "^3.9.5", "md5": "^2.3.0", - "babel-plugin-transform-class-properties": "^6.24.1" + "babel-plugin-transform-class-properties": "^6.24.1", + "cypress": "9.7.0" }, "scripts": { "release": "release-it", From 56715435fbf315bdfe627fb25168a78dc124c984 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Fri, 11 Nov 2022 17:07:57 +0530 Subject: [PATCH 06/15] cleanup package.json --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 72f30e1..acc5253 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "@eeacms/volto-matomo" ], "dependencies": { - "@cypress/code-coverage": "^3.9.5", "@eeacms/volto-columns-block": "*", "@eeacms/volto-datablocks": "*", "@eeacms/volto-matomo": "*", @@ -35,10 +34,10 @@ "react-tooltip": "4.2.21" }, "devDependencies": { + "@plone/scripts": "2.0.0", "@cypress/code-coverage": "^3.9.5", "md5": "^2.3.0", - "babel-plugin-transform-class-properties": "^6.24.1", - "cypress": "9.7.0" + "babel-plugin-transform-class-properties": "^6.24.1" }, "scripts": { "release": "release-it", From cb642b87481d94eba465b302549f90edada74a55 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Fri, 11 Nov 2022 17:47:22 +0530 Subject: [PATCH 07/15] update JENKINSFILE --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 316b595..6bc505e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -125,8 +125,8 @@ pipeline { node(label: 'docker') { script { try { - sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' - sh '''docker pull plone/volto-addon-ci:alpha; 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" -e NODE_ENV=development -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' + sh '''docker pull eeacms/plone-backend; docker run --rm -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' + sh '''docker pull plone/volto-addon-ci:alpha; 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" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' } finally { try { sh '''rm -rf cypress-reports cypress-results cypress-coverage''' From dc813815b3a4aebc00b22c2b758d2d3713c086b9 Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Fri, 18 Nov 2022 13:47:32 +0200 Subject: [PATCH 08/15] fix(cypress): use cypress 10 --- .gitignore | 2 +- .project.eslintrc.js | 43 +++++++++++++++++++++--------------------- Makefile | 43 +++++++++++++++++++++--------------------- cypress.config.js | 1 + cypress/support/e2e.js | 3 +++ package.json | 9 +++++---- 6 files changed, 52 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index 5111938..53b9801 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .vscode/ .history .eslintrc.js -nyc_output +.nyc_output project coverage logs diff --git a/.project.eslintrc.js b/.project.eslintrc.js index ddbf7bc..765070f 100644 --- a/.project.eslintrc.js +++ b/.project.eslintrc.js @@ -1,21 +1,18 @@ -const fs = require("fs"); -const path = require("path"); - -const projectRootPath = fs.existsSync("./project") - ? fs.realpathSync("./project") - : fs.realpathSync("./../../../"); -const packageJson = require(path.join(projectRootPath, "package.json")); -const jsConfig = require(path.join( - projectRootPath, - "jsconfig.json" -)).compilerOptions; +const fs = require('fs'); +const path = require('path'); + +const projectRootPath = fs.existsSync('./project') + ? fs.realpathSync('./project') + : fs.realpathSync('./../../../'); +const packageJson = require(path.join(projectRootPath, 'package.json')); +const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions; const pathsConfig = jsConfig.paths; -let voltoPath = path.join(projectRootPath, "node_modules/@plone/volto"); +let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto'); -Object.keys(pathsConfig).forEach((pkg) => { - if (pkg === "@plone/volto") { +Object.keys(pathsConfig).forEach(pkg => { + if (pkg === '@plone/volto') { voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`; } }); @@ -23,27 +20,29 @@ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`); const reg = new AddonConfigurationRegistry(projectRootPath); // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons -const addonAliases = Object.keys(reg.packages).map((o) => [ +const addonAliases = Object.keys(reg.packages).map(o => [ o, reg.packages[o].modulePath, ]); + module.exports = { extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`, settings: { - "import/resolver": { + 'import/resolver': { alias: { map: [ - ["@plone/volto", "@plone/volto/src"], + ['@plone/volto', '@plone/volto/src'], ...addonAliases, - ["@package", `${__dirname}/src`], - ["~", `${__dirname}/src`], + ['@package', `${__dirname}/src`], + ['~', `${__dirname}/src`], ], - extensions: [".js", ".jsx", ".json"], + extensions: ['.js', '.jsx', '.json'], }, - "babel-plugin-root-import": { - rootPathSuffix: "src", + 'babel-plugin-root-import': { + rootPathSuffix: 'src', }, }, }, }; + diff --git a/Makefile b/Makefile index 6b61d55..aeb0f30 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,12 @@ GREEN=`tput setaf 2` RESET=`tput sgr0` YELLOW=`tput setaf 3` +ifeq ($(wildcard ./project),) + NODE_MODULES = "../../../node_modules" +else + NODE_MODULES = "./project/node_modules" +endif + project: npm install -g yo npm install -g @plone/generator-volto @@ -35,28 +41,17 @@ start-backend-docker: ## Starts a Docker-based backend docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone .PHONY: test -test: +test: ## Run jest tests docker pull plone/volto-addon-ci:alpha docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha .PHONY: test-update -test-update: +test-update: ## Update jest tests snapshots docker pull plone/volto-addon-ci:alpha docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha yarn test src/addons/${DIR}/src --watchAll=false -u -.PHONY: help -help: ## Show this help. - @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" - - -ifeq ($(wildcard ./project),) - NODE_MODULES = "../../../node_modules" -else - NODE_MODULES = "./project/node_modules" -endif - .PHONY: stylelint -stylelint: +stylelint: ## Stylelint $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' .PHONY: stylelint-overrides @@ -64,35 +59,39 @@ stylelint-overrides: $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' .PHONY: stylelint-fix -stylelint-fix: +stylelint-fix: ## Fix stylelint $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix .PHONY: prettier -prettier: +prettier: ## Prettier $(NODE_MODULES)/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}' .PHONY: prettier-fix -prettier-fix: +prettier-fix: ## Fix prettier $(NODE_MODULES)/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}' .PHONY: lint -lint: +lint: ## ES Lint $(NODE_MODULES)/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}' .PHONY: lint-fix -lint-fix: +lint-fix: ## Fix ES Lint $(NODE_MODULES)/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}' .PHONY: i18n -i18n: +i18n: ## i18n rm -rf build/messages NODE_ENV=development $(NODE_MODULES)/.bin/i18n --addon .PHONY: cypress-run -cypress-run: +cypress-run: ## Run cypress integration tests NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run .PHONY: cypress-open -cypress-open: +cypress-open: ## Open cypress integration tests NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open + +.PHONY: help +help: ## Show this help. + @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" diff --git a/cypress.config.js b/cypress.config.js index 30be8ac..da8e7ba 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -19,6 +19,7 @@ module.exports = defineConfig({ setupNodeEvents(on, config) { // e2e testing node events setup code require('@cypress/code-coverage/task')(on, config); + require('cypress-fail-fast/plugin')(on, config); return config; }, baseUrl: 'http://localhost:3000', diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index f696418..b7c02f2 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -21,6 +21,9 @@ import './commands'; //Generate code-coverage import '@cypress/code-coverage/support'; +// Fail Fast +import "cypress-fail-fast"; + export const slateBeforeEach = (contentType = 'Document') => { cy.autologin(); cy.createContent({ diff --git a/package.json b/package.json index acc5253..ddecdb0 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,11 @@ "react-tooltip": "4.2.21" }, "devDependencies": { - "@plone/scripts": "2.0.0", - "@cypress/code-coverage": "^3.9.5", - "md5": "^2.3.0", - "babel-plugin-transform-class-properties": "^6.24.1" + "@plone/scripts": "*", + "@cypress/code-coverage": "^3.10.0", + "cypress-fail-fast": "^5.0.1", + "babel-plugin-transform-class-properties": "^6.24.1", + "md5": "^2.3.0" }, "scripts": { "release": "release-it", From a3599de4d17c08355630b88b6f9b54e0621e8692 Mon Sep 17 00:00:00 2001 From: valentinab25 <30239069+valentinab25@users.noreply.github.com> Date: Wed, 7 Dec 2022 19:02:00 +0200 Subject: [PATCH 09/15] [JENKINS] use CYPRESS_INSTALL_BINARY --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6bc505e..f8c8e19 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -126,7 +126,7 @@ pipeline { script { try { sh '''docker pull eeacms/plone-backend; docker run --rm -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' - sh '''docker pull plone/volto-addon-ci:alpha; 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" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' + sh '''docker pull plone/volto-addon-ci:alpha; 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" -e VOLTO=$VOLTO -e CYPRESS_INSTALL_BINARY=10.11.0 plone/volto-addon-ci:alpha cypress''' } finally { try { sh '''rm -rf cypress-reports cypress-results cypress-coverage''' From 45bd73f8383a474f6e7a69150552962048f45ffc Mon Sep 17 00:00:00 2001 From: Nilesh Date: Wed, 21 Dec 2022 15:43:20 +0530 Subject: [PATCH 10/15] test(update) JENKINSFILE, do not use cypress binary in env --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f8c8e19..6bc505e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -126,7 +126,7 @@ pipeline { script { try { sh '''docker pull eeacms/plone-backend; docker run --rm -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' - sh '''docker pull plone/volto-addon-ci:alpha; 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" -e VOLTO=$VOLTO -e CYPRESS_INSTALL_BINARY=10.11.0 plone/volto-addon-ci:alpha cypress''' + sh '''docker pull plone/volto-addon-ci:alpha; 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" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' } finally { try { sh '''rm -rf cypress-reports cypress-results cypress-coverage''' From 2af8271e002f965fcb16bb4c54ef2273f756bda8 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 21 Dec 2022 16:41:40 +0200 Subject: [PATCH 11/15] update steps --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6bc505e..3311897 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,19 +41,19 @@ pipeline { "ES lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha eslint''' + sh '''docker pull plone/volto-addon-ci:alpha; docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha eslint''' } }, "Style lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha stylelint''' + sh '''docker pull plone/volto-addon-ci:alpha; docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha stylelint''' } }, "Prettier": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha prettier''' + sh '''docker pull plone/volto-addon-ci:alpha; docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha prettier''' } } ) @@ -126,7 +126,7 @@ pipeline { script { try { sh '''docker pull eeacms/plone-backend; docker run --rm -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' - sh '''docker pull plone/volto-addon-ci:alpha; 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" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' + sh '''docker pull plone/volto-addon-ci:alpha; 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" -e NODE_ENV=development -e VOLTO=$VOLTO plone/volto-addon-ci:alpha cypress''' } finally { try { sh '''rm -rf cypress-reports cypress-results cypress-coverage''' From 6b3c382b7cfdac3211752ff3ce8edab2df8ef792 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 22 Dec 2022 12:04:23 +0200 Subject: [PATCH 12/15] update tests --- cypress/e2e/01-block-basics.cy.js | 9 +- cypress/support/commands.js | 239 ++---------------------------- cypress/support/e2e.js | 3 - 3 files changed, 15 insertions(+), 236 deletions(-) diff --git a/cypress/e2e/01-block-basics.cy.js b/cypress/e2e/01-block-basics.cy.js index 089c7b3..1e726ef 100644 --- a/cypress/e2e/01-block-basics.cy.js +++ b/cypress/e2e/01-block-basics.cy.js @@ -1,17 +1,20 @@ import { slateBeforeEach, slateAfterEach } from '../support/e2e'; +import 'cypress-fail-fast'; + describe('Blocks Tests', () => { beforeEach(slateBeforeEach); afterEach(slateAfterEach); it('Add Block: Empty', () => { // Change page title - cy.clearSlateTitle(); - cy.getSlateTitle().type('My Add-on Page'); + cy.get('[contenteditable=true]').first().clear(); + + cy.get('[contenteditable=true]').first().type('My Add-on Page'); cy.get('.documentFirstHeading').contains('My Add-on Page'); - cy.getSlate().click(); + cy.get('[contenteditable=true]').first().type('{enter}'); // Add block cy.get('.ui.basic.icon.button.block-add-button').first().click(); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index f269a7f..ac48461 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -1,8 +1,5 @@ /* eslint no-console: ["error", { allow: ["log"] }] */ -const SLATE_SELECTOR = '.content-area .slate-editor [contenteditable=true]'; -const SLATE_TITLE_SELECTOR = '.block.inner.title [contenteditable="true"]'; - // --- AUTOLOGIN ------------------------------------------------------------- Cypress.Commands.add('autologin', () => { let api_url, user, password; @@ -71,7 +68,8 @@ Cypress.Commands.add( id: contentId, title: contentTitle, image: { - data: 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC', + data: + 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuCHSYuc+rkUGeMCViNRARPrzW52N3oQLe6WifNliSuuGaH3czbVNudI9s7ZLUCLHVwWlyES522o1t14uvmbblmVTKqFjaZYJFSTPP4dLL1kU1z7p0lzdbRulmEWLxoQX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC', encoding: 'base64', filename: 'image.png', 'content-type': 'image/png', @@ -94,7 +92,7 @@ Cypress.Commands.add( title: contentTitle, blocks: { 'd3f1c443-583f-4e8e-a682-3bf25752a300': { '@type': 'title' }, - '7624cf59-05d0-4055-8f55-5fd6597d84b0': { '@type': 'slate' }, + '7624cf59-05d0-4055-8f55-5fd6597d84b0': { '@type': 'text' }, }, blocks_layout: { items: [ @@ -124,103 +122,9 @@ Cypress.Commands.add( }) .then(() => console.log(`${contentType} created`)); } - } + }, ); -// --- Add DX Content-Type ---------------------------------------------------------- -Cypress.Commands.add('addContentType', (name) => { - let api_url, auth; - api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; - auth = { - user: 'admin', - pass: 'admin', - }; - return cy - .request({ - method: 'POST', - url: `${api_url}/@controlpanels/dexterity-types/${name}`, - headers: { - Accept: 'application/json', - }, - auth: auth, - body: { - title: name, - }, - }) - .then(() => console.log(`${name} content-type added.`)); -}); - -// --- Remove DX behavior ---------------------------------------------------------- -Cypress.Commands.add('removeContentType', (name) => { - let api_url, auth; - api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; - auth = { - user: 'admin', - pass: 'admin', - }; - return cy - .request({ - method: 'DELETE', - url: `${api_url}/@controlpanels/dexterity-types/${name}`, - headers: { - Accept: 'application/json', - }, - auth: auth, - body: {}, - }) - .then(() => console.log(`${name} content-type removed.`)); -}); - -// --- Add DX field ---------------------------------------------------------- -Cypress.Commands.add('addSlateJSONField', (type, name) => { - let api_url, auth; - api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; - auth = { - user: 'admin', - pass: 'admin', - }; - return cy - .request({ - method: 'POST', - url: `${api_url}/@types/${type}`, - headers: { - Accept: 'application/json', - }, - auth: auth, - body: { - id: name, - title: name, - description: 'Slate JSON Field', - factory: 'SlateJSONField', - required: false, - }, - }) - .then(() => console.log(`${name} SlateJSONField field added to ${type}`)); -}); - -// --- Remove DX field ---------------------------------------------------------- -Cypress.Commands.add('removeSlateJSONField', (type, name) => { - let api_url, auth; - api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone'; - auth = { - user: 'admin', - pass: 'admin', - }; - return cy - .request({ - method: 'DELETE', - url: `${api_url}/@types/${type}/${name}`, - headers: { - Accept: 'application/json', - }, - auth: auth, - body: {}, - }) - .then(() => - console.log(`${name} SlateJSONField field removed from ${type}`) - ); -}); - // --- REMOVE CONTENT -------------------------------------------------------- Cypress.Commands.add('removeContent', (path) => { let api_url, auth; @@ -242,41 +146,6 @@ Cypress.Commands.add('removeContent', (path) => { .then(() => console.log(`${path} removed`)); }); -Cypress.Commands.add('typeInSlate', { prevSubject: true }, (subject, text) => { - return ( - cy - .wrap(subject) - .then((subject) => { - subject[0].dispatchEvent( - new InputEvent('beforeinput', { - inputType: 'insertText', - data: text, - }) - ); - return subject; - }) - // TODO: do this only for Electron-based browser which does not understand instantaneously - // that the user inserted some text in the block - .wait(1000) - ); -}); - -Cypress.Commands.add('lineBreakInSlate', { prevSubject: true }, (subject) => { - return ( - cy - .wrap(subject) - .then((subject) => { - subject[0].dispatchEvent( - new InputEvent('beforeinput', { inputType: 'insertLineBreak' }) - ); - return subject; - }) - // TODO: do this only for Electron-based browser which does not understand instantaneously - // that the block was split - .wait(1000) - ); -}); - // --- SET WORKFLOW ---------------------------------------------------------- Cypress.Commands.add( 'setWorkflow', @@ -315,7 +184,7 @@ Cypress.Commands.add( include_children: include_children, }, }); - } + }, ); // --- waitForResourceToLoad ---------------------------------------------------------- @@ -375,86 +244,9 @@ Cypress.Commands.add( setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset); } }); - } + }, ); -Cypress.Commands.add('getSlate', ({ createNewSlate = true } = {}) => { - let slate; - cy.getIfExists( - SLATE_SELECTOR, - () => { - slate = cy.get(SLATE_SELECTOR).last(); - }, - () => { - if (createNewSlate) { - cy.get('.block.inner').last().type('{moveToEnd}{enter}'); - } - slate = cy.get(SLATE_SELECTOR, { timeout: 10000 }).last(); - } - ); - return slate; -}); - -Cypress.Commands.add('clearSlate', (selector) => { - return cy - .get(selector) - .focus() - .click() - .wait(1000) - .type('{selectAll}') - .wait(1000) - .type('{backspace}'); -}); - -Cypress.Commands.add('getSlateTitle', () => { - return cy.get(SLATE_TITLE_SELECTOR, { - timeout: 10000, - }); -}); - -Cypress.Commands.add('clearSlateTitle', () => { - return cy.clearSlate(SLATE_TITLE_SELECTOR); -}); - -Cypress.Commands.add('setSlateSelection', (subject, query, endQuery) => { - cy.get('.slate-editor.selected [contenteditable=true]') - .focus() - .click() - .setSelection(subject, query, endQuery) - .wait(1000); // this wait is needed for the selection change to be detected after -}); - -Cypress.Commands.add('getSlateEditorAndType', (type) => { - cy.getSlate().focus().click().type(type); -}); - -Cypress.Commands.add('setSlateCursor', (subject, query, endQuery) => { - cy.get('.slate-editor.selected [contenteditable=true]') - .focus() - .click() - .setCursor(subject, query, endQuery) - .wait(1000); -}); - -Cypress.Commands.add('clickSlateButton', (button) => { - cy.get(`.slate-inline-toolbar .button-wrapper a[title="${button}"]`, { - timeout: 10000, - }).click({ force: true }); //force click is needed to ensure the button in visible in view. -}); - -Cypress.Commands.add('toolbarSave', () => { - cy.wait(1000); - - // Save - cy.get('#toolbar-save').click(); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad('my-page'); - cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); -}); - // Low level command reused by `setCursorBefore` and `setCursorAfter`, equal to `setCursorAfter` Cypress.Commands.add( 'setCursor', @@ -470,7 +262,7 @@ Cypress.Commands.add( }); // Depending on what you're testing, you may need to chain a `.click()` here to ensure // further commands are picked up by whatever you're testing (this was required for Slate, for example). - } + }, ); Cypress.Commands.add( @@ -478,7 +270,7 @@ Cypress.Commands.add( { prevSubject: true }, (subject, query) => { cy.wrap(subject).setCursor(query, true); - } + }, ); Cypress.Commands.add( @@ -486,7 +278,7 @@ Cypress.Commands.add( { prevSubject: true }, (subject, query) => { cy.wrap(subject).setCursor(query); - } + }, ); // Helper functions @@ -521,16 +313,3 @@ Cypress.Commands.add('store', () => { Cypress.Commands.add('settings', (key, value) => { return cy.window().its('settings'); }); - -Cypress.Commands.add( - 'getIfExists', - (selector, successAction = () => {}, failAction = () => {}) => { - cy.get('body').then((body) => { - if (body.find(selector).length > 0 && successAction) { - successAction(); - } else if (failAction) { - failAction(); - } - }); - } -); diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index b7c02f2..f696418 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -21,9 +21,6 @@ import './commands'; //Generate code-coverage import '@cypress/code-coverage/support'; -// Fail Fast -import "cypress-fail-fast"; - export const slateBeforeEach = (contentType = 'Document') => { cy.autologin(); cy.createContent({ From f6cb005ca554ad7e367a256996e1d584574a810f Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 22 Dec 2022 12:44:39 +0200 Subject: [PATCH 13/15] update scripts --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ddecdb0..bcbbd88 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,10 @@ "react-tooltip": "4.2.21" }, "devDependencies": { - "@plone/scripts": "*", "@cypress/code-coverage": "^3.10.0", - "cypress-fail-fast": "^5.0.1", + "@plone/scripts": "*", "babel-plugin-transform-class-properties": "^6.24.1", + "cypress-fail-fast": "^5.0.1", "md5": "^2.3.0" }, "scripts": { @@ -51,12 +51,12 @@ "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'", "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'", "stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix", - "prettier": "if [ -d ./project ]; then ./project/node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'; else ../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'; fi", - "prettier:fix": "if [ -d ./project ]; then ./project/node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'; else ../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'; fi", - "lint": "if [ -d ./project ]; then ./project/node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'; else ../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'; fi", - "lint:fix": "if [ -d ./project ]; then ./project/node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'; else ../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'; fi", + "prettier": "../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'", + "prettier:fix": "../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'", + "lint": "../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'", + "lint:fix": "../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'", "i18n": "mv .i18n.babel.config.js babel.config.js; rm -rf build/messages && NODE_ENV=production node src/i18n.js; mv babel.config.js .i18n.babel.config.js", - "cypress:run": "if [ -d ./project ]; then ./project/node_modules/cypress/bin/cypress run; else ../../../node_modules/cypress/bin/cypress run; fi", - "cypress:open": "if [ -d ./project ]; then ./project/node_modules/cypress/bin/cypress open; else ../../../node_modules/cypress/bin/cypress open; fi" + "cypress:run": "../../../node_modules/cypress/bin/cypress run", + "cypress:open": "../../../node_modules/cypress/bin/cypress open" } } From f522b1309feec65f6f739c2669888d7a1654bea7 Mon Sep 17 00:00:00 2001 From: valentinab25 <30239069+valentinab25@users.noreply.github.com> Date: Thu, 22 Dec 2022 15:55:12 +0200 Subject: [PATCH 14/15] tests: remove unused call --- cypress/support/e2e.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index f696418..51369fb 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -36,7 +36,8 @@ export const slateBeforeEach = (contentType = 'Document') => { }); cy.visit('/cypress/my-page'); cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); + // industry does not call @breadcrumbs + // cy.waitForResourceToLoad('@breadcrumbs'); cy.waitForResourceToLoad('@actions'); cy.waitForResourceToLoad('@types'); cy.waitForResourceToLoad('my-page'); From 49d21cdad51392c89f3c7c13c7b278b524a05555 Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Thu, 22 Dec 2022 14:07:47 +0000 Subject: [PATCH 15/15] Automated release 2.0.13 --- CHANGELOG.md | 19 +++++++++++++++++++ package.json | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ffad11..e494e35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ 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). +### [2.0.13](https://github.com/eea/volto-industry-theme/compare/2.0.12...2.0.13) - 22 December 2022 + +#### :bug: Bug Fixes + +- fix(cypress): use cypress 10 [Miu Razvan - [`dc81381`](https://github.com/eea/volto-industry-theme/commit/dc813815b3a4aebc00b22c2b758d2d3713c086b9)] +- fix: replace cypress config file [Miu Razvan - [`177e74f`](https://github.com/eea/volto-industry-theme/commit/177e74fbf29095095a65b10a684554c39d114dfd)] +- fix: clean up facility/site name before fetching data [Miu Razvan - [`bbb9e6f`](https://github.com/eea/volto-industry-theme/commit/bbb9e6fe6683755442ff0dc72f2601742b74e13d)] + +#### :hammer_and_wrench: Others + +- tests: remove unused call [valentinab25 - [`f522b13`](https://github.com/eea/volto-industry-theme/commit/f522b1309feec65f6f739c2669888d7a1654bea7)] +- update scripts [Claudia Ifrim - [`f6cb005`](https://github.com/eea/volto-industry-theme/commit/f6cb005ca554ad7e367a256996e1d584574a810f)] +- update tests [Claudia Ifrim - [`6b3c382`](https://github.com/eea/volto-industry-theme/commit/6b3c382b7cfdac3211752ff3ce8edab2df8ef792)] +- update steps [Claudia Ifrim - [`2af8271`](https://github.com/eea/volto-industry-theme/commit/2af8271e002f965fcb16bb4c54ef2273f756bda8)] +- test(update) JENKINSFILE, do not use cypress binary in env [Nilesh - [`45bd73f`](https://github.com/eea/volto-industry-theme/commit/45bd73f8383a474f6e7a69150552962048f45ffc)] +- update JENKINSFILE [Nilesh - [`cb642b8`](https://github.com/eea/volto-industry-theme/commit/cb642b87481d94eba465b302549f90edada74a55)] +- cleanup package.json [Nilesh - [`5671543`](https://github.com/eea/volto-industry-theme/commit/56715435fbf315bdfe627fb25168a78dc124c984)] +- fix error [Claudia Ifrim - [`ed44532`](https://github.com/eea/volto-industry-theme/commit/ed4453225031d4e3b28af464ac7b46d88026d702)] +- update gitignore file [Claudia Ifrim - [`a3dadf6`](https://github.com/eea/volto-industry-theme/commit/a3dadf6ade0bfab6faae3e48f712ff3049a050f6)] ### [2.0.12](https://github.com/eea/volto-industry-theme/compare/2.0.11...2.0.12) - 26 October 2022 #### :hammer_and_wrench: Others diff --git a/package.json b/package.json index bcbbd88..f2910df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-industry-theme", - "version": "2.0.12", + "version": "2.0.13", "description": "@eeacms/volto-industry-theme: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", @@ -57,6 +57,6 @@ "lint:fix": "../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'", "i18n": "mv .i18n.babel.config.js babel.config.js; rm -rf build/messages && NODE_ENV=production node src/i18n.js; mv babel.config.js .i18n.babel.config.js", "cypress:run": "../../../node_modules/cypress/bin/cypress run", - "cypress:open": "../../../node_modules/cypress/bin/cypress open" + "cypress:open": "../../../node_modules/cypress/bin/cypress open" } }