@eeacms/volto-tabs-block 2.2.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,7 @@ const defaultBabel = require('@plone/volto/babel');
2
2
 
3
3
  function applyDefault(api) {
4
4
  const voltoBabel = defaultBabel(api);
5
- voltoBabel.plugins.push(
6
- '@babel/plugin-transform-modules-commonjs',
7
- 'transform-class-properties',
8
- 'istanbul',
9
- );
5
+ voltoBabel.plugins.push('istanbul');
10
6
  return voltoBabel;
11
7
  }
12
8
 
@@ -0,0 +1 @@
1
+ module.exports = require('@plone/volto/babel');
package/CHANGELOG.md CHANGED
@@ -4,7 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- ### [2.2.1](https://github.com/eea/volto-tabs-block/compare/2.2.0...2.2.1) - 20 October 2022
7
+ ### [3.0.0](https://github.com/eea/volto-tabs-block/compare/2.2.1...3.0.0) - 27 October 2022
8
+
9
+ #### :nail_care: Enhancements
10
+
11
+ - refactor: Latest volto compatibility [Miu Razvan - [`82c6563`](https://github.com/eea/volto-tabs-block/commit/82c6563cc98372c7824df0932378d7ab41260cbb)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Cleanup [Alin Voinea - [`655a0fd`](https://github.com/eea/volto-tabs-block/commit/655a0fd5bbe08b2703d5f72f3bd7c67edd272de5)]
16
+ - Cleanup [Miu Razvan - [`d734099`](https://github.com/eea/volto-tabs-block/commit/d734099d751ca1d899d789a220a5083f17832b0c)]
17
+ - Cleanup [Alin Voinea - [`684a899`](https://github.com/eea/volto-tabs-block/commit/684a8999b24d1d57e7c0e6c76087fa8764d839a8)]
18
+ - Update dependencies [Alin Voinea - [`6ce84d1`](https://github.com/eea/volto-tabs-block/commit/6ce84d1277252d0c46bc5ca4782b7a3487a2cb42)]
19
+ ### [2.2.1](https://github.com/eea/volto-tabs-block/compare/2.2.0...2.2.1) - 21 October 2022
8
20
 
9
21
  #### :nail_care: Enhancements
10
22
 
@@ -13,9 +25,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
13
25
 
14
26
  #### :hammer_and_wrench: Others
15
27
 
16
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a00e419`](https://github.com/eea/volto-tabs-block/commit/a00e419aef4c82a25f277f5e25e3d512c7838264)]
17
28
  - lint fix [David Ichim - [`c0a898c`](https://github.com/eea/volto-tabs-block/commit/c0a898c54461478baed2ac2f149ae580d4c89aeb)]
18
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3b284e6`](https://github.com/eea/volto-tabs-block/commit/3b284e65e0eafa9b5ad8c92b4cb77628ffcc8103)]
19
29
  ### [2.2.0](https://github.com/eea/volto-tabs-block/compare/2.1.0...2.2.0) - 25 August 2022
20
30
 
21
31
  #### :hammer_and_wrench: Others
@@ -31,7 +41,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
31
41
 
32
42
  - Release 2.1.0 [Alin Voinea - [`3cdfa30`](https://github.com/eea/volto-tabs-block/commit/3cdfa30d4d03d864be8ad63f0648b4717298734a)]
33
43
  - Squashed commit of the following: [Alin Voinea - [`ca241f5`](https://github.com/eea/volto-tabs-block/commit/ca241f56a96817679a1948154e2a8cc0e17b96fe)]
34
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`68ea5a6`](https://github.com/eea/volto-tabs-block/commit/68ea5a6b971fc36840cf5716a04f68316b229b2b)]
35
44
  ### [2.0.2](https://github.com/eea/volto-tabs-block/compare/2.0.1...2.0.2) - 16 June 2022
36
45
 
37
46
  ### [2.0.1](https://github.com/eea/volto-tabs-block/compare/2.0.0...2.0.1) - 10 June 2022
@@ -75,8 +84,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
75
84
  - Let theme addon to set default values for default template schema [Miu Razvan - [`55f148d`](https://github.com/eea/volto-tabs-block/commit/55f148d1a95417f8a0b55681ce250acde8463c1c)]
76
85
  - Render pane as container if tabs-block has full-width class [Miu Razvan - [`bbffb96`](https://github.com/eea/volto-tabs-block/commit/bbffb96b908476ddee447af3ce79bafb1a12f9a8)]
77
86
  - Refactor default template [Miu Razvan - [`58eff52`](https://github.com/eea/volto-tabs-block/commit/58eff5281adb08a5f8fe6d21fd43330252012277)]
78
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`72a6735`](https://github.com/eea/volto-tabs-block/commit/72a6735cbbc0e7d57b4bb7ea83fea9becc317018)]
79
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`e928da1`](https://github.com/eea/volto-tabs-block/commit/e928da1df7e4680bd4be9b5d46406800d721b8c5)]
80
87
  ### [1.2.12](https://github.com/eea/volto-tabs-block/compare/1.2.11...1.2.12) - 21 January 2022
81
88
 
82
89
  ### [1.2.11](https://github.com/eea/volto-tabs-block/compare/1.2.10...1.2.11) - 4 January 2022
@@ -91,17 +98,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
91
98
 
92
99
  #### :hammer_and_wrench: Others
93
100
 
94
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`cd2e2ac`](https://github.com/eea/volto-tabs-block/commit/cd2e2ac1d127bfc688ecf16e17734603ab727a34)]
95
101
  ### [1.2.8](https://github.com/eea/volto-tabs-block/compare/1.2.7...1.2.8) - 10 December 2021
96
102
 
97
103
  #### :hammer_and_wrench: Others
98
104
 
99
105
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d10c0b3`](https://github.com/eea/volto-tabs-block/commit/d10c0b3d35d25c530d19eebde38dfe5da8fda01b)]
100
- - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`1a7187f`](https://github.com/eea/volto-tabs-block/commit/1a7187f10b2bd9e1307dabf51823f63ccd766864)]
101
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`72a7550`](https://github.com/eea/volto-tabs-block/commit/72a755025b38e1d8dd7fe206273a70585e4b9ac8)]
102
- - Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`022b277`](https://github.com/eea/volto-tabs-block/commit/022b2779a5d7fd7217c2d8a559eafab0bd86ce23)]
103
- - Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`84c9bea`](https://github.com/eea/volto-tabs-block/commit/84c9bea7a0aba2fe9ef9713e7131de6da6e0bcce)]
104
- - Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`020aa97`](https://github.com/eea/volto-tabs-block/commit/020aa97bc70a643ea3857566c5a1dc3a5200c2be)]
105
106
  ### [1.2.7](https://github.com/eea/volto-tabs-block/compare/1.2.6...1.2.7) - 27 August 2021
106
107
 
107
108
  #### :hammer_and_wrench: Others
@@ -118,8 +119,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
118
119
 
119
120
  - Move less import in View instead of Edit [Tiberiu Ichim - [`84aeff0`](https://github.com/eea/volto-tabs-block/commit/84aeff04a980076f54687c546691d37b6e790478)]
120
121
  - gitignore tweaks [Tiberiu Ichim - [`f4c993d`](https://github.com/eea/volto-tabs-block/commit/f4c993d004b126f08f16651ab9460546fa9e9cad)]
121
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`865906a`](https://github.com/eea/volto-tabs-block/commit/865906a0deb261d44cc23e26bfd2d1dd0e319640)]
122
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`5383861`](https://github.com/eea/volto-tabs-block/commit/538386100adbc868e693c1c2a5ba13461307ffee)]
123
122
  - Style update [razvanMiu - [`323aaaf`](https://github.com/eea/volto-tabs-block/commit/323aaafcad01d8fdf0e713a1fc254ae9fe319f43)]
124
123
  - Fix 'scroll to' feature on carousel [razvanMiu - [`16c6a08`](https://github.com/eea/volto-tabs-block/commit/16c6a08f6db687542ea38e07a92b265e592f6173)]
125
124
  - Better accesibility [razvanMiu - [`3511611`](https://github.com/eea/volto-tabs-block/commit/351161197270a4807f01d85a7055cbaadae72f8e)]
package/README.md CHANGED
@@ -61,78 +61,7 @@ Demo GIF
61
61
 
62
62
  ## Release
63
63
 
64
- ### Automatic release using Jenkins
65
-
66
- * 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.
67
- * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
68
- * 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.
69
- * 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.
70
- * 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.
71
- * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
72
- * 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.
73
- * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
74
-
75
- ### Manual release from the develop branch ( beta release )
76
-
77
- #### Installation and configuration of release-it
78
-
79
- You need to first install the [release-it](https://github.com/release-it/release-it) client.
80
-
81
- ```
82
- npm install -g release-it
83
- ```
84
-
85
- Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
86
-
87
- Release-it is a tool that automates 4 important steps in the release process:
88
-
89
- 1. Version increase in `package.json` ( increased from the current version in `package.json`)
90
- 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
91
- 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
92
- 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
93
-
94
- To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
95
-
96
- ```
97
- export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
98
- ```
99
-
100
- To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
101
-
102
- ```
103
- echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
104
- ```
105
-
106
- #### Using release-it tool
107
-
108
- There are 3 yarn scripts that can be run to do the release
109
-
110
- ##### yarn release-beta
111
-
112
- Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
113
-
114
- ```
115
- ? Select increment (next version):
116
- ❯ prepatch (0.1.1-beta.0)
117
- preminor (0.2.0-beta.0)
118
- premajor (1.0.0-beta.0)
119
- Other, please specify...
120
- ```
121
-
122
- ##### yarn release-major-beta
123
-
124
- Same as `yarn release-beta`, but with premajor version pre-selected.
125
-
126
- ##### yarn release
127
-
128
- Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
129
-
130
- #### Important notes
131
-
132
- > 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.
133
-
134
- > 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).
135
-
64
+ See [RELEASE.md](https://github.com/eea/volto-tabs-block/blob/master/RELEASE.md).
136
65
 
137
66
  ## How to contribute
138
67
 
package/RELEASE.md ADDED
@@ -0,0 +1,74 @@
1
+ ## Release
2
+
3
+ ### Automatic release using Jenkins
4
+
5
+ * 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.
6
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
7
+ * 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.
8
+ * 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.
9
+ * 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.
10
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
11
+ * 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.
12
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
13
+
14
+ ### Manual release from the develop branch ( beta release )
15
+
16
+ #### Installation and configuration of release-it
17
+
18
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
19
+
20
+ ```
21
+ npm install -g release-it
22
+ ```
23
+
24
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
25
+
26
+ Release-it is a tool that automates 4 important steps in the release process:
27
+
28
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
29
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
30
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
31
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
32
+
33
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
34
+
35
+ ```
36
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
37
+ ```
38
+
39
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
40
+
41
+ ```
42
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
43
+ ```
44
+
45
+ #### Using release-it tool
46
+
47
+ There are 3 yarn scripts that can be run to do the release
48
+
49
+ ##### yarn release-beta
50
+
51
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
52
+
53
+ ```
54
+ ? Select increment (next version):
55
+ ❯ prepatch (0.1.1-beta.0)
56
+ preminor (0.2.0-beta.0)
57
+ premajor (1.0.0-beta.0)
58
+ Other, please specify...
59
+ ```
60
+
61
+ ##### yarn release-major-beta
62
+
63
+ Same as `yarn release-beta`, but with premajor version pre-selected.
64
+
65
+ ##### yarn release
66
+
67
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
68
+
69
+ #### Important notes
70
+
71
+ > 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.
72
+
73
+ > 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).
74
+
package/babel.config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  module.exports = function (api) {
2
2
  api.cache(true);
3
- const presets = ['razzle/babel'];
3
+ const presets = ['razzle'];
4
4
  const plugins = [
5
5
  [
6
6
  'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work
@@ -0,0 +1,26 @@
1
+ const { defineConfig } = require('cypress');
2
+
3
+ module.exports = defineConfig({
4
+ viewportWidth: 1280,
5
+ defaultCommandTimeout: 8888,
6
+ chromeWebSecurity: false,
7
+ reporter: 'junit',
8
+ video: true,
9
+ retries: {
10
+ runMode: 8,
11
+ openMode: 0,
12
+ },
13
+ reporterOptions: {
14
+ mochaFile: 'cypress/reports/cypress-[hash].xml',
15
+ jenkinsMode: true,
16
+ toConsole: true,
17
+ },
18
+ e2e: {
19
+ setupNodeEvents(on, config) {
20
+ // e2e testing node events setup code
21
+ require('@cypress/code-coverage/task')(on, config);
22
+ return config;
23
+ },
24
+ baseUrl: 'http://localhost:3000',
25
+ },
26
+ });
@@ -9,6 +9,7 @@ module.exports = {
9
9
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
10
10
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
11
11
  '@package/(.*)$': '<rootDir>/src/$1',
12
+ '@root/(.*)$': '<rootDir>/src/$1',
12
13
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
13
14
  '@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
14
15
  '@plone/volto-slate':
@@ -16,12 +17,10 @@ module.exports = {
16
17
  '~/(.*)$': '<rootDir>/src/$1',
17
18
  'load-volto-addons':
18
19
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
20
+ '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
19
21
  },
20
22
  transform: {
21
23
  '^.+\\.js(x)?$': 'babel-jest',
22
- '^.+\\.css$': 'jest-css-modules',
23
- '^.+\\.less$': 'jest-css-modules',
24
- '^.+\\.scss$': 'jest-css-modules',
25
24
  '^.+\\.(png)$': 'jest-file',
26
25
  '^.+\\.(jpg)$': 'jest-file',
27
26
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tabs-block",
3
- "version": "2.2.1",
3
+ "version": "3.0.0",
4
4
  "description": "volto-tabs-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -26,25 +26,28 @@
26
26
  "slick-carousel": "^1.8.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@cypress/code-coverage": "^3.9.5",
29
+ "@plone/scripts": "*",
30
+ "@cypress/code-coverage": "^3.10.0",
30
31
  "babel-plugin-transform-class-properties": "^6.24.1",
31
32
  "md5": "^2.3.0"
32
33
  },
33
34
  "scripts": {
34
35
  "release": "release-it",
36
+ "release-major-beta": "release-it major --preRelease=beta",
37
+ "release-beta": "release-it --preRelease=beta",
35
38
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
36
39
  "test": "make test",
37
40
  "test:fix": "make test-update",
38
41
  "pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix",
39
- "stylelint": "../../../node_modules/.bin/stylelint 'theme/**/*.{css,less}' 'src/**/*.{css,less}'",
40
- "stylelint:overrides": "../../../node_modules/.bin/stylelint --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",
41
- "stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix",
42
- "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",
43
- "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",
44
- "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",
45
- "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",
46
- "i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon",
47
- "cypress:run": "if [ -d ./project ]; then NODE_ENV=development ./project/node_modules/cypress/bin/cypress run; else NODE_ENV=development ../../../node_modules/cypress/bin/cypress run; fi",
48
- "cypress:open": "if [ -d ./project ]; then NODE_ENV=development ./project/node_modules/cypress/bin/cypress open; else NODE_ENV=development ../../../node_modules/cypress/bin/cypress open; fi"
42
+ "stylelint": "make stylelint",
43
+ "stylelint:overrides": "make stylelint-overrides",
44
+ "stylelint:fix": "make stylelint-fix",
45
+ "prettier": "make prettier",
46
+ "prettier:fix": "make prettier-fix",
47
+ "lint": "make lint",
48
+ "lint:fix": "make lint-fix",
49
+ "i18n": "make i18n",
50
+ "cypress:run": "make cypress-run",
51
+ "cypress:open": "make cypress-open"
49
52
  }
50
53
  }
package/Jenkinsfile DELETED
@@ -1,242 +0,0 @@
1
- pipeline {
2
- agent any
3
-
4
- environment {
5
- GIT_NAME = "volto-tabs-block"
6
- NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine"
8
- DEPENDENCIES = "@eeacms/volto-block-style"
9
- VOLTO = "16.0.0-alpha.14"
10
- }
11
-
12
- stages {
13
-
14
- stage('Release') {
15
- when {
16
- allOf {
17
- environment name: 'CHANGE_ID', value: ''
18
- branch 'master'
19
- }
20
- }
21
- steps {
22
- node(label: 'docker') {
23
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
24
- sh '''docker pull eeacms/gitflow'''
25
- sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
26
- }
27
- }
28
- }
29
- }
30
-
31
- stage('Code') {
32
- when {
33
- allOf {
34
- environment name: 'CHANGE_ID', value: ''
35
- not { changelog '.*^Automated release [0-9\\.]+$' }
36
- not { branch 'master' }
37
- }
38
- }
39
- steps {
40
- parallel(
41
-
42
- "ES lint": {
43
- node(label: 'docker') {
44
- 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" plone/volto-addon-ci eslint'''
45
- }
46
- },
47
-
48
- "Style lint": {
49
- node(label: 'docker') {
50
- 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" plone/volto-addon-ci stylelint'''
51
- }
52
- },
53
-
54
- "Prettier": {
55
- node(label: 'docker') {
56
- 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" plone/volto-addon-ci prettier'''
57
- }
58
- }
59
- )
60
- }
61
- }
62
-
63
- stage('Tests') {
64
- when {
65
- allOf {
66
- environment name: 'CHANGE_ID', value: ''
67
- anyOf {
68
- not { changelog '.*^Automated release [0-9\\.]+$' }
69
- branch 'master'
70
- }
71
- }
72
- }
73
- steps {
74
- parallel(
75
-
76
- "Volto": {
77
- node(label: 'docker') {
78
- script {
79
- try {
80
- sh '''docker pull plone/volto-addon-ci'''
81
- 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'''
82
- sh '''rm -rf xunit-reports'''
83
- sh '''mkdir -p xunit-reports'''
84
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/'''
85
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/junit.xml xunit-reports/'''
86
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/unit_tests_log.txt xunit-reports/'''
87
- stash name: "xunit-reports", includes: "xunit-reports/**"
88
- archiveArtifacts artifacts: "xunit-reports/unit_tests_log.txt", fingerprint: true
89
- publishHTML (target : [
90
- allowMissing: false,
91
- alwaysLinkToLastBuild: true,
92
- keepAll: true,
93
- reportDir: 'xunit-reports/coverage/lcov-report',
94
- reportFiles: 'index.html',
95
- reportName: 'UTCoverage',
96
- reportTitles: 'Unit Tests Code Coverage'
97
- ])
98
- } finally {
99
- catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
100
- junit testResults: 'xunit-reports/junit.xml', allowEmptyResults: true
101
- }
102
- sh script: '''docker rm -v $BUILD_TAG-volto''', returnStatus: true
103
- }
104
- }
105
- }
106
- }
107
- )
108
- }
109
- }
110
-
111
- stage('Integration tests') {
112
- when {
113
- allOf {
114
- environment name: 'CHANGE_ID', value: ''
115
- anyOf {
116
- not { changelog '.*^Automated release [0-9\\.]+$' }
117
- branch 'master'
118
- }
119
- }
120
- }
121
- steps {
122
- parallel(
123
-
124
- "Cypress": {
125
- node(label: 'docker') {
126
- script {
127
- try {
128
- 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'''
129
- 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'''
130
- } finally {
131
- try {
132
- sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
133
- sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
134
- sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
135
- sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
136
- coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true
137
- if ( coverage == 0 ) {
138
- publishHTML (target : [allowMissing: false,
139
- alwaysLinkToLastBuild: true,
140
- keepAll: true,
141
- reportDir: 'cypress-coverage/coverage/lcov-report',
142
- reportFiles: 'index.html',
143
- reportName: 'CypressCoverage',
144
- reportTitles: 'Integration Tests Code Coverage'])
145
- }
146
- sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
147
- archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
148
- stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
149
- }
150
- finally {
151
- catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
152
- junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
153
- }
154
- sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
155
- sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
156
- sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
157
-
158
- }
159
- }
160
- }
161
- }
162
- }
163
-
164
- )
165
- }
166
- }
167
-
168
- stage('Report to SonarQube') {
169
- when {
170
- allOf {
171
- environment name: 'CHANGE_ID', value: ''
172
- anyOf {
173
- branch 'master'
174
- allOf {
175
- branch 'develop'
176
- not { changelog '.*^Automated release [0-9\\.]+$' }
177
- }
178
- }
179
- }
180
- }
181
- steps {
182
- node(label: 'swarm') {
183
- script{
184
- checkout scm
185
- unstash "xunit-reports"
186
- unstash "cypress-coverage"
187
- def scannerHome = tool 'SonarQubeScanner';
188
- def nodeJS = tool 'NodeJS';
189
- withSonarQubeEnv('Sonarqube') {
190
- sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
191
- sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; 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"
192
- 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'''
193
- }
194
- }
195
- }
196
- }
197
- }
198
-
199
- stage('Pull Request') {
200
- when {
201
- not {
202
- environment name: 'CHANGE_ID', value: ''
203
- }
204
- environment name: 'CHANGE_TARGET', value: 'master'
205
- }
206
- steps {
207
- node(label: 'docker') {
208
- script {
209
- if ( env.CHANGE_BRANCH != "develop" ) {
210
- error "Pipeline aborted due to PR not made from develop branch"
211
- }
212
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
213
- sh '''docker pull eeacms/gitflow'''
214
- sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-pr" -e GIT_CHANGE_TARGET="$CHANGE_TARGET" -e GIT_CHANGE_BRANCH="$CHANGE_BRANCH" -e GIT_CHANGE_AUTHOR="$CHANGE_AUTHOR" -e GIT_CHANGE_TITLE="$CHANGE_TITLE" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" -e LANGUAGE=javascript eeacms/gitflow'''
215
- }
216
- }
217
- }
218
- }
219
- }
220
-
221
- }
222
-
223
- post {
224
- always {
225
- cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, deleteDirs: true)
226
- }
227
- changed {
228
- script {
229
- def details = """<h1>${env.JOB_NAME} - Build #${env.BUILD_NUMBER} - ${currentBuild.currentResult}</h1>
230
- <p>Check console output at <a href="${env.BUILD_URL}/display/redirect">${env.JOB_BASE_NAME} - #${env.BUILD_NUMBER}</a></p>
231
- """
232
- emailext(
233
- subject: '$DEFAULT_SUBJECT',
234
- body: details,
235
- attachLog: true,
236
- compressLog: true,
237
- recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'CulpritsRecipientProvider']]
238
- )
239
- }
240
- }
241
- }
242
- }
package/Makefile DELETED
@@ -1,50 +0,0 @@
1
- SHELL=/bin/bash
2
-
3
- DIR=$(shell basename $$(pwd))
4
- ADDON ?= "@eeacms/volto-tabs-block"
5
-
6
- # We like colors
7
- # From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
8
- RED=`tput setaf 1`
9
- GREEN=`tput setaf 2`
10
- RESET=`tput sgr0`
11
- YELLOW=`tput setaf 3`
12
-
13
- project:
14
- npm install -g yo
15
- npm install -g @plone/generator-volto
16
- npm install -g mrs-developer
17
- yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive
18
- ln -sf $$(pwd) project/src/addons/
19
- cp .project.eslintrc.js .eslintrc.js
20
- cd project && yarn
21
- @echo "-------------------"
22
- @echo "$(GREEN)Volto project is ready!$(RESET)"
23
- @echo "$(RED)Now run: cd project && yarn start$(RESET)"
24
-
25
- all: project
26
-
27
- .PHONY: start-test-backend
28
- start-test-backend: ## Start Test Plone Backend
29
- @echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
30
- docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e SITE=plone -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
31
-
32
- .PHONY: start-backend-docker
33
- start-backend-docker: ## Starts a Docker-based backend
34
- @echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
35
- docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone
36
-
37
- .PHONY: test
38
- test:
39
- docker pull plone/volto-addon-ci
40
- 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
41
-
42
- .PHONY: test-update
43
- test-update:
44
- docker pull plone/volto-addon-ci
45
- 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
46
-
47
- .PHONY: help
48
- help: ## Show this help.
49
- @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
50
- -s :)"
@@ -1,5 +0,0 @@
1
- {
2
- "name": "Using fixtures to represent data",
3
- "email": "hello@cypress.io",
4
- "body": "Fixtures are a great way to mock data for responses to routes"
5
- }
@@ -1,75 +0,0 @@
1
- import { setupBeforeEach, tearDownAfterEach } from '../support';
2
-
3
- describe('Blocks Tests', () => {
4
- beforeEach(setupBeforeEach);
5
- afterEach(tearDownAfterEach);
6
-
7
- it('Add Block: Empty', () => {
8
- // without this the clear command below does nothing sometimes
9
- cy.wait(500);
10
-
11
- // Change page title
12
- cy.get('[contenteditable=true]').first().clear();
13
-
14
- cy.get('[contenteditable=true]').first().type('My Add-on Page');
15
-
16
- cy.get('.documentFirstHeading').contains('My Add-on Page');
17
-
18
- cy.get('[contenteditable=true]').first().type('{enter}');
19
-
20
- // Add block
21
- cy.get('.ui.basic.icon.button.block-add-button').first().click();
22
- cy.get('.blocks-chooser .title').contains('Media').click();
23
- cy.get('.content.active.media .button.image').contains('Image').click();
24
-
25
- cy.get('[contenteditable=true]').first().type('{enter}');
26
- cy.get('.ui.basic.icon.button.block-add-button').first().click();
27
- cy.get('.blocks-chooser .title').contains('Common').click();
28
- cy.get('.tabs_block').click();
29
-
30
- cy.get('.field-wrapper-title input').last().type('Tab 1');
31
- cy.get('.field-wrapper-template #field-template').click();
32
- cy.get('.react-select__menu').contains('Default').click();
33
- cy.get('.field-wrapper-verticalAlign #field-verticalAlign').click();
34
- cy.get('.react-select__menu').contains('Middle').click();
35
-
36
- cy.get('.field-wrapper-menuAlign #field-menuAlign').click();
37
- cy.get('.react-select__menu').contains('Left').click();
38
- cy.get('.field-wrapper-menuPosition #field-menuPosition').first().click();
39
- cy.get('.react-select__menu').contains('Top').click();
40
-
41
- cy.get('[contenteditable=true]').first().focus().click();
42
- cy.get('.tabs-block [contenteditable=true]').first().type('Hydrogen');
43
- cy.get('.tabs-block .ui.left.menu .item').last().click();
44
- cy.get('.tabs-block').contains('Tab 2').click();
45
- cy.get('.tabs-block.edit [contenteditable=true]').first().type('Oxygen');
46
-
47
- cy.get('[contenteditable=true]').first().type('{enter}');
48
- cy.get('.ui.basic.icon.button.block-add-button').first().click();
49
- cy.get('.blocks-chooser .title').contains('Common').click();
50
- cy.get('.tabs_block').first().click();
51
-
52
- cy.get('.field-wrapper-template #field-template').click();
53
- cy.get('.react-select__menu').contains('Carousel horizontal').click();
54
- cy.get('.field-wrapper-verticalAlign #field-verticalAlign').click();
55
- cy.get('.react-select__menu').contains('Bottom').click();
56
- cy.get('.field-wrapper-theme #field-theme').click();
57
- cy.get('.react-select__menu').contains('Dark').click();
58
- cy.get('.tabs-block .ui.menu .item').last().click();
59
- cy.get('.tabs-block .ui.menu .item').eq(1).click();
60
-
61
- // Save
62
- cy.get('#toolbar-save').click();
63
- cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
64
-
65
- // then the page view should contain our changes
66
- cy.contains('My Add-on Page');
67
- cy.contains('Hydrogen');
68
-
69
- cy.get('.tabs-block p').contains('Tab 2').click();
70
- cy.contains('Oxygen');
71
-
72
- cy.get('.slick-arrow').click();
73
- cy.get('.block.image');
74
- });
75
- });
@@ -1,26 +0,0 @@
1
- /// <reference types="cypress" />
2
- // ***********************************************************
3
- // This example plugins/index.js can be used to load plugins
4
- //
5
- // You can change the location of this file or turn off loading
6
- // the plugins file with the 'pluginsFile' configuration option.
7
- //
8
- // You can read more here:
9
- // https://on.cypress.io/plugins-guide
10
- // ***********************************************************
11
-
12
- // This function is called when a project is opened or re-opened (e.g. due to
13
- // the project's config changing)
14
-
15
- /**
16
- * @type {Cypress.PluginConfig}
17
- */
18
- module.exports = (on, config) => {
19
- // `on` is used to hook into various events Cypress emits
20
- // `config` is the resolved Cypress config
21
- /* coverage-start
22
- require('@cypress/code-coverage/task')(on, config)
23
- on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'))
24
- return config
25
- coverage-end */
26
- };
@@ -1,315 +0,0 @@
1
- /* eslint no-console: ["error", { allow: ["log"] }] */
2
-
3
- // --- AUTOLOGIN -------------------------------------------------------------
4
- Cypress.Commands.add('autologin', () => {
5
- let api_url, user, password;
6
- api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
7
- user = 'admin';
8
- password = 'admin';
9
-
10
- return cy
11
- .request({
12
- method: 'POST',
13
- url: `${api_url}/@login`,
14
- headers: { Accept: 'application/json' },
15
- body: { login: user, password: password },
16
- })
17
- .then((response) => cy.setCookie('auth_token', response.body.token));
18
- });
19
-
20
- // --- CREATE CONTENT --------------------------------------------------------
21
- Cypress.Commands.add(
22
- 'createContent',
23
- ({
24
- contentType,
25
- contentId,
26
- contentTitle,
27
- path = '',
28
- allow_discussion = false,
29
- }) => {
30
- let api_url, auth;
31
- api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
32
- auth = {
33
- user: 'admin',
34
- pass: 'admin',
35
- };
36
- if (contentType === 'File') {
37
- return cy.request({
38
- method: 'POST',
39
- url: `${api_url}/${path}`,
40
- headers: {
41
- Accept: 'application/json',
42
- },
43
- auth: auth,
44
- body: {
45
- '@type': contentType,
46
- id: contentId,
47
- title: contentTitle,
48
- file: {
49
- data: 'dGVzdGZpbGUK',
50
- encoding: 'base64',
51
- filename: 'lorem.txt',
52
- 'content-type': 'text/plain',
53
- },
54
- allow_discussion: allow_discussion,
55
- },
56
- });
57
- }
58
- if (contentType === 'Image') {
59
- return cy.request({
60
- method: 'POST',
61
- url: `${api_url}/${path}`,
62
- headers: {
63
- Accept: 'application/json',
64
- },
65
- auth: auth,
66
- body: {
67
- '@type': contentType,
68
- id: contentId,
69
- title: contentTitle,
70
- image: {
71
- data:
72
- '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',
73
- encoding: 'base64',
74
- filename: 'image.png',
75
- 'content-type': 'image/png',
76
- },
77
- },
78
- });
79
- }
80
- if (['Document', 'Folder', 'CMSFolder'].includes(contentType)) {
81
- return cy
82
- .request({
83
- method: 'POST',
84
- url: `${api_url}/${path}`,
85
- headers: {
86
- Accept: 'application/json',
87
- },
88
- auth: auth,
89
- body: {
90
- '@type': contentType,
91
- id: contentId,
92
- title: contentTitle,
93
- blocks: {
94
- 'd3f1c443-583f-4e8e-a682-3bf25752a300': { '@type': 'title' },
95
- '7624cf59-05d0-4055-8f55-5fd6597d84b0': { '@type': 'text' },
96
- },
97
- blocks_layout: {
98
- items: [
99
- 'd3f1c443-583f-4e8e-a682-3bf25752a300',
100
- '7624cf59-05d0-4055-8f55-5fd6597d84b0',
101
- ],
102
- },
103
- allow_discussion: allow_discussion,
104
- },
105
- })
106
- .then(() => console.log(`${contentType} created`));
107
- } else {
108
- return cy
109
- .request({
110
- method: 'POST',
111
- url: `${api_url}/${path}`,
112
- headers: {
113
- Accept: 'application/json',
114
- },
115
- auth: auth,
116
- body: {
117
- '@type': contentType,
118
- id: contentId,
119
- title: contentTitle,
120
- allow_discussion: allow_discussion,
121
- },
122
- })
123
- .then(() => console.log(`${contentType} created`));
124
- }
125
- },
126
- );
127
-
128
- // --- REMOVE CONTENT --------------------------------------------------------
129
- Cypress.Commands.add('removeContent', (path) => {
130
- let api_url, auth;
131
- api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
132
- auth = {
133
- user: 'admin',
134
- pass: 'admin',
135
- };
136
- return cy
137
- .request({
138
- method: 'DELETE',
139
- url: `${api_url}/${path}`,
140
- headers: {
141
- Accept: 'application/json',
142
- },
143
- auth: auth,
144
- body: {},
145
- })
146
- .then(() => console.log(`${path} removed`));
147
- });
148
-
149
- // --- SET WORKFLOW ----------------------------------------------------------
150
- Cypress.Commands.add(
151
- 'setWorkflow',
152
- ({
153
- path = '/',
154
- actor = 'admin',
155
- review_state = 'publish',
156
- time = '1995-07-31T18:30:00',
157
- title = '',
158
- comment = '',
159
- effective = '2018-01-21T08:00:00',
160
- expires = '2019-01-21T08:00:00',
161
- include_children = true,
162
- }) => {
163
- let api_url, auth;
164
- api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
165
- auth = {
166
- user: 'admin',
167
- pass: 'admin',
168
- };
169
- return cy.request({
170
- method: 'POST',
171
- url: `${api_url}/${path}/@workflow/${review_state}`,
172
- headers: {
173
- Accept: 'application/json',
174
- },
175
- auth: auth,
176
- body: {
177
- actor: actor,
178
- review_state: review_state,
179
- time: time,
180
- title: title,
181
- comment: comment,
182
- effective: effective,
183
- expires: expires,
184
- include_children: include_children,
185
- },
186
- });
187
- },
188
- );
189
-
190
- // --- waitForResourceToLoad ----------------------------------------------------------
191
- Cypress.Commands.add('waitForResourceToLoad', (fileName, type) => {
192
- const resourceCheckInterval = 40;
193
-
194
- return new Cypress.Promise((resolve) => {
195
- const checkIfResourceHasBeenLoaded = () => {
196
- const resource = cy
197
- .state('window')
198
- .performance.getEntriesByType('resource')
199
- .filter((entry) => !type || entry.initiatorType === type)
200
- .find((entry) => entry.name.includes(fileName));
201
-
202
- if (resource) {
203
- resolve();
204
-
205
- return;
206
- }
207
-
208
- setTimeout(checkIfResourceHasBeenLoaded, resourceCheckInterval);
209
- };
210
-
211
- checkIfResourceHasBeenLoaded();
212
- });
213
- });
214
-
215
- // Low level command reused by `setSelection` and low level command `setCursor`
216
- Cypress.Commands.add('selection', { prevSubject: true }, (subject, fn) => {
217
- cy.wrap(subject).trigger('mousedown').then(fn).trigger('mouseup');
218
-
219
- cy.document().trigger('selectionchange');
220
- return cy.wrap(subject);
221
- });
222
-
223
- Cypress.Commands.add(
224
- 'setSelection',
225
- { prevSubject: true },
226
- (subject, query, endQuery) => {
227
- return cy.wrap(subject).selection(($el) => {
228
- if (typeof query === 'string') {
229
- const anchorNode = getTextNode($el[0], query);
230
- const focusNode = endQuery ? getTextNode($el[0], endQuery) : anchorNode;
231
- const anchorOffset = anchorNode.wholeText.indexOf(query);
232
- const focusOffset = endQuery
233
- ? focusNode.wholeText.indexOf(endQuery) + endQuery.length
234
- : anchorOffset + query.length;
235
- setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
236
- } else if (typeof query === 'object') {
237
- const el = $el[0];
238
- const anchorNode = getTextNode(el.querySelector(query.anchorQuery));
239
- const anchorOffset = query.anchorOffset || 0;
240
- const focusNode = query.focusQuery
241
- ? getTextNode(el.querySelector(query.focusQuery))
242
- : anchorNode;
243
- const focusOffset = query.focusOffset || 0;
244
- setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
245
- }
246
- });
247
- },
248
- );
249
-
250
- // Low level command reused by `setCursorBefore` and `setCursorAfter`, equal to `setCursorAfter`
251
- Cypress.Commands.add(
252
- 'setCursor',
253
- { prevSubject: true },
254
- (subject, query, atStart) => {
255
- return cy.wrap(subject).selection(($el) => {
256
- const node = getTextNode($el[0], query);
257
- const offset =
258
- node.wholeText.indexOf(query) + (atStart ? 0 : query.length);
259
- const document = node.ownerDocument;
260
- document.getSelection().removeAllRanges();
261
- document.getSelection().collapse(node, offset);
262
- });
263
- // Depending on what you're testing, you may need to chain a `.click()` here to ensure
264
- // further commands are picked up by whatever you're testing (this was required for Slate, for example).
265
- },
266
- );
267
-
268
- Cypress.Commands.add(
269
- 'setCursorBefore',
270
- { prevSubject: true },
271
- (subject, query) => {
272
- cy.wrap(subject).setCursor(query, true);
273
- },
274
- );
275
-
276
- Cypress.Commands.add(
277
- 'setCursorAfter',
278
- { prevSubject: true },
279
- (subject, query) => {
280
- cy.wrap(subject).setCursor(query);
281
- },
282
- );
283
-
284
- // Helper functions
285
- function getTextNode(el, match) {
286
- const walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
287
- if (!match) {
288
- return walk.nextNode();
289
- }
290
-
291
- let node;
292
- while ((node = walk.nextNode())) {
293
- if (node.wholeText.includes(match)) {
294
- return node;
295
- }
296
- }
297
- }
298
-
299
- function setBaseAndExtent(...args) {
300
- const document = args[0].ownerDocument;
301
- document.getSelection().removeAllRanges();
302
- document.getSelection().setBaseAndExtent(...args);
303
- }
304
-
305
- Cypress.Commands.add('navigate', (route = '') => {
306
- return cy.window().its('appHistory').invoke('push', route);
307
- });
308
-
309
- Cypress.Commands.add('store', () => {
310
- return cy.window().its('store').invoke('getStore', '');
311
- });
312
-
313
- Cypress.Commands.add('settings', (key, value) => {
314
- return cy.window().its('settings');
315
- });
@@ -1,53 +0,0 @@
1
- // ***********************************************************
2
- // This example support/index.js is processed and
3
- // loaded automatically before your test files.
4
- //
5
- // This is a great place to put global configuration and
6
- // behavior that modifies Cypress.
7
- //
8
- // You can change the location of this file or turn off
9
- // automatically serving support files with the
10
- // 'supportFile' configuration option.
11
- //
12
- // You can read more here:
13
- // https://on.cypress.io/configuration
14
- // ***********************************************************
15
-
16
- // Import commands.js using ES2015 syntax:
17
- import './commands';
18
-
19
- // Alternatively you can use CommonJS syntax:
20
- // require('./commands')
21
-
22
- /* coverage-start
23
- //Generate code-coverage
24
- import '@cypress/code-coverage/support';
25
- coverage-end */
26
-
27
- export const setupBeforeEach = () => {
28
- cy.autologin();
29
- cy.createContent({
30
- contentType: 'Document',
31
- contentId: 'cypress',
32
- contentTitle: 'Cypress',
33
- });
34
- cy.createContent({
35
- contentType: 'Document',
36
- contentId: 'my-page',
37
- contentTitle: 'My Page',
38
- path: 'cypress',
39
- });
40
- cy.visit('/cypress/my-page');
41
- cy.waitForResourceToLoad('@navigation');
42
- cy.waitForResourceToLoad('@breadcrumbs');
43
- cy.waitForResourceToLoad('@actions');
44
- cy.waitForResourceToLoad('@types');
45
- cy.waitForResourceToLoad('my-page');
46
- cy.navigate('/cypress/my-page/edit');
47
- cy.get(`.block.title h1`);
48
- };
49
-
50
- export const tearDownAfterEach = () => {
51
- cy.autologin();
52
- cy.removeContent('cypress');
53
- };
package/cypress.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "baseUrl": "http://localhost:3000",
3
- "viewportWidth": 1280,
4
- "defaultCommandTimeout": 8888,
5
- "chromeWebSecurity": false,
6
- "reporter": "junit",
7
- "video": true,
8
- "retries": {
9
- "runMode": 8,
10
- "openMode": 0
11
- },
12
- "reporterOptions": {
13
- "mochaFile": "cypress/reports/cypress-[hash].xml",
14
- "jenkinsMode": true,
15
- "toConsole": true
16
- }
17
- }