Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #105

Merged
merged 11 commits into from
Jan 18, 2024
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ 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).

### [10.4.6](https://github.com/eea/volto-accordion-block/compare/10.4.5...10.4.6) - 18 January 2024

#### :hammer_and_wrench: Others

- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`12f799a`](https://github.com/eea/volto-accordion-block/commit/12f799a09c3dd56a3ba0e779d9e767fe53db6de9)]
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`937a4e1`](https://github.com/eea/volto-accordion-block/commit/937a4e1035237a655e94839b08dc4eb6a4061e79)]
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`fc0f16a`](https://github.com/eea/volto-accordion-block/commit/fc0f16a474aaeeb13edfbad374f564433ef92a53)]
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`8240697`](https://github.com/eea/volto-accordion-block/commit/82406970359c5fb3b21b18dd013db46626bb2944)]
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`1f88bab`](https://github.com/eea/volto-accordion-block/commit/1f88babd0ea2545731fa013833d66b08d1449fbb)]
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`e4312b7`](https://github.com/eea/volto-accordion-block/commit/e4312b7a23caf8285f3c28b50c12603dcca39c6e)]
- test: [JENKINS] fix jest config, fail with logs on coverage [valentinab25 - [`afb8392`](https://github.com/eea/volto-accordion-block/commit/afb839211575a167905238f91aa24089da3f1a20)]
### [10.4.5](https://github.com/eea/volto-accordion-block/compare/10.4.4...10.4.5) - 10 December 2023

### [10.4.4](https://github.com/eea/volto-accordion-block/compare/10.4.3...10.4.4) - 24 November 2023
Expand Down
9 changes: 8 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,16 @@ pipeline {
script {
try {
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'''
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'''
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'''
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
if ( frontend != 0 ) {
sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
}

sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
} finally {
try {
if ( frontend == 0 ) {
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
Expand All @@ -189,6 +195,7 @@ pipeline {
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'''
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
}
}
} finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests

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

.PHONY: test
test: ## Run jest tests
Expand Down Expand Up @@ -155,8 +155,11 @@ start-ci:
cd ../..
yarn start

.PHONY: check-ci
check-ci:
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000

.PHONY: cypress-ci
cypress-ci:
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
NODE_ENV=development make cypress-run

CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
14 changes: 11 additions & 3 deletions jest-addon.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ module.exports = {
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@package/(.*)$': '<rootDir>/src/$1',
'@root/(.*)$': '<rootDir>/src/$1',
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
'@plone/volto-slate':
'@plone/volto-slate$':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
'@plone/volto-slate/(.*)$':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
'~/(.*)$': '<rootDir>/src/$1',
'load-volto-addons':
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
},
transformIgnorePatterns: [
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
],
transform: {
'^.+\\.js(x)?$': 'babel-jest',
'^.+\\.(png)$': 'jest-file',
Expand All @@ -33,4 +38,7 @@ module.exports = {
statements: 5,
},
},
setupFilesAfterEnv: [
'<rootDir>/node_modules/@eeacms/volto-accordion-block/jest.setup.js',
],
};
65 changes: 65 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { jest } from '@jest/globals';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { blocksConfig } from '@plone/volto/config/Blocks';
import installSlate from '@plone/volto-slate/index';

var mockSemanticComponents = jest.requireActual('semantic-ui-react');
var mockComponents = jest.requireActual('@plone/volto/components');
var config = jest.requireActual('@plone/volto/registry').default;

config.blocks.blocksConfig = {
...blocksConfig,
...config.blocks.blocksConfig,
};

jest.doMock('semantic-ui-react', () => ({
__esModule: true,
...mockSemanticComponents,
Popup: ({ content, trigger }) => {
return (
<div className="popup">
<div className="trigger">{trigger}</div>
<div className="content">{content}</div>
</div>
);
},
}));

jest.doMock('@plone/volto/components', () => {
return {
__esModule: true,
...mockComponents,
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
};
});

jest.doMock('@plone/volto/registry', () =>
[installSlate].reduce((acc, apply) => apply(acc), config),
);

const mockStore = configureStore([thunk]);

global.fetch = jest.fn(() =>
Promise.resolve({
json: () => Promise.resolve({}),
}),
);

global.store = mockStore({
intl: {
locale: 'en',
messages: {},
formatMessage: jest.fn(),
},
content: {
create: {},
subrequests: [],
},
connected_data_parameters: {},
screen: {
page: {
width: 768,
},
},
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-accordion-block",
"version": "10.4.5",
"version": "10.4.6",
"description": "volto-accordion-block: Volto accordion block",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
18 changes: 11 additions & 7 deletions src/components/manage/Blocks/Accordion/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import config from '@plone/volto/registry';
describe('emptyAccordion', () => {
it('should create an accordion with a given count of empty blocks', () => {
const result = emptyAccordion(2);
const {
blocks,
blocks_layout: { items },
} = result;

expect(Object.keys(result.blocks)).toHaveLength(2);
expect(result.blocks_layout.items).toHaveLength(2);
expect(Object.keys(blocks)).toHaveLength(2);
expect(items).toHaveLength(2);

for (const blockId in result.blocks) {
expect(result.blocks[blockId]['@type']).toEqual(
config.settings.defaultBlockType,
);
}
Object.values(blocks).forEach((block) => {
Object.values(block.blocks).forEach((innerBlock) => {
expect(innerBlock['@type']).toEqual(config.settings.defaultBlockType);
});
});
});
});

Expand Down