Skip to content

Commit c1d254d

Browse files
authored
Merge pull request #105 from eea/develop
Release
2 parents f5ebfc5 + a70001e commit c1d254d

File tree

7 files changed

+113
-15
lines changed

7 files changed

+113
-15
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d
44

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

7+
### [10.4.6](https://github.com/eea/volto-accordion-block/compare/10.4.5...10.4.6) - 18 January 2024
8+
9+
#### :hammer_and_wrench: Others
10+
11+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`12f799a`](https://github.com/eea/volto-accordion-block/commit/12f799a09c3dd56a3ba0e779d9e767fe53db6de9)]
12+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`937a4e1`](https://github.com/eea/volto-accordion-block/commit/937a4e1035237a655e94839b08dc4eb6a4061e79)]
13+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`fc0f16a`](https://github.com/eea/volto-accordion-block/commit/fc0f16a474aaeeb13edfbad374f564433ef92a53)]
14+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`8240697`](https://github.com/eea/volto-accordion-block/commit/82406970359c5fb3b21b18dd013db46626bb2944)]
15+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`1f88bab`](https://github.com/eea/volto-accordion-block/commit/1f88babd0ea2545731fa013833d66b08d1449fbb)]
16+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`e4312b7`](https://github.com/eea/volto-accordion-block/commit/e4312b7a23caf8285f3c28b50c12603dcca39c6e)]
17+
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`afb8392`](https://github.com/eea/volto-accordion-block/commit/afb839211575a167905238f91aa24089da3f1a20)]
718
### [10.4.5](https://github.com/eea/volto-accordion-block/compare/10.4.4...10.4.5) - 10 December 2023
819

920
### [10.4.4](https://github.com/eea/volto-accordion-block/compare/10.4.3...10.4.4) - 24 November 2023

Jenkinsfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,16 @@ pipeline {
162162
script {
163163
try {
164164
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
165-
sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
165+
sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
166+
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
167+
if ( frontend != 0 ) {
168+
sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
169+
}
170+
166171
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
167172
} finally {
168173
try {
174+
if ( frontend == 0 ) {
169175
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
170176
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
171177
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
@@ -189,6 +195,7 @@ pipeline {
189195
sh '''for file in $(find cypress-results -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos/videos/$testname.mp4; fi; done'''
190196
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
191197
}
198+
}
192199
} finally {
193200
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
194201
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests
8686

8787
.PHONY: cypress-run
8888
cypress-run: ## Run cypress integration tests
89-
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
89+
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
9090

9191
.PHONY: test
9292
test: ## Run jest tests
@@ -155,8 +155,11 @@ start-ci:
155155
cd ../..
156156
yarn start
157157

158+
.PHONY: check-ci
159+
check-ci:
160+
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
161+
158162
.PHONY: cypress-ci
159163
cypress-ci:
160164
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
161-
NODE_ENV=development make cypress-run
162-
165+
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium

jest-addon.config.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ module.exports = {
99
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
1010
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
1111
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
12-
'@package/(.*)$': '<rootDir>/src/$1',
13-
'@root/(.*)$': '<rootDir>/src/$1',
12+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
13+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
1414
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
1515
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
16-
'@plone/volto-slate':
16+
'@plone/volto-slate$':
1717
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
18+
'@plone/volto-slate/(.*)$':
19+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
1820
'~/(.*)$': '<rootDir>/src/$1',
1921
'load-volto-addons':
2022
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
2123
},
24+
transformIgnorePatterns: [
25+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
26+
],
2227
transform: {
2328
'^.+\\.js(x)?$': 'babel-jest',
2429
'^.+\\.(png)$': 'jest-file',
@@ -33,4 +38,7 @@ module.exports = {
3338
statements: 5,
3439
},
3540
},
41+
setupFilesAfterEnv: [
42+
'<rootDir>/node_modules/@eeacms/volto-accordion-block/jest.setup.js',
43+
],
3644
};

jest.setup.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { jest } from '@jest/globals';
2+
import configureStore from 'redux-mock-store';
3+
import thunk from 'redux-thunk';
4+
import { blocksConfig } from '@plone/volto/config/Blocks';
5+
import installSlate from '@plone/volto-slate/index';
6+
7+
var mockSemanticComponents = jest.requireActual('semantic-ui-react');
8+
var mockComponents = jest.requireActual('@plone/volto/components');
9+
var config = jest.requireActual('@plone/volto/registry').default;
10+
11+
config.blocks.blocksConfig = {
12+
...blocksConfig,
13+
...config.blocks.blocksConfig,
14+
};
15+
16+
jest.doMock('semantic-ui-react', () => ({
17+
__esModule: true,
18+
...mockSemanticComponents,
19+
Popup: ({ content, trigger }) => {
20+
return (
21+
<div className="popup">
22+
<div className="trigger">{trigger}</div>
23+
<div className="content">{content}</div>
24+
</div>
25+
);
26+
},
27+
}));
28+
29+
jest.doMock('@plone/volto/components', () => {
30+
return {
31+
__esModule: true,
32+
...mockComponents,
33+
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
34+
};
35+
});
36+
37+
jest.doMock('@plone/volto/registry', () =>
38+
[installSlate].reduce((acc, apply) => apply(acc), config),
39+
);
40+
41+
const mockStore = configureStore([thunk]);
42+
43+
global.fetch = jest.fn(() =>
44+
Promise.resolve({
45+
json: () => Promise.resolve({}),
46+
}),
47+
);
48+
49+
global.store = mockStore({
50+
intl: {
51+
locale: 'en',
52+
messages: {},
53+
formatMessage: jest.fn(),
54+
},
55+
content: {
56+
create: {},
57+
subrequests: [],
58+
},
59+
connected_data_parameters: {},
60+
screen: {
61+
page: {
62+
width: 768,
63+
},
64+
},
65+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eeacms/volto-accordion-block",
3-
"version": "10.4.5",
3+
"version": "10.4.6",
44
"description": "volto-accordion-block: Volto accordion block",
55
"main": "src/index.js",
66
"author": "European Environment Agency: IDM2 A-Team",

src/components/manage/Blocks/Accordion/util.test.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ import config from '@plone/volto/registry';
44
describe('emptyAccordion', () => {
55
it('should create an accordion with a given count of empty blocks', () => {
66
const result = emptyAccordion(2);
7+
const {
8+
blocks,
9+
blocks_layout: { items },
10+
} = result;
711

8-
expect(Object.keys(result.blocks)).toHaveLength(2);
9-
expect(result.blocks_layout.items).toHaveLength(2);
12+
expect(Object.keys(blocks)).toHaveLength(2);
13+
expect(items).toHaveLength(2);
1014

11-
for (const blockId in result.blocks) {
12-
expect(result.blocks[blockId]['@type']).toEqual(
13-
config.settings.defaultBlockType,
14-
);
15-
}
15+
Object.values(blocks).forEach((block) => {
16+
Object.values(block.blocks).forEach((innerBlock) => {
17+
expect(innerBlock['@type']).toEqual(config.settings.defaultBlockType);
18+
});
19+
});
1620
});
1721
});
1822

0 commit comments

Comments
 (0)