Skip to content

Commit

Permalink
Merge pull request #83 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea committed Sep 29, 2023
2 parents 9859325 + 3b9b6f6 commit a787129
Show file tree
Hide file tree
Showing 10 changed files with 224 additions and 263 deletions.
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ -n "$CI" ] && exit 0
yarn lint-staged
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ 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).

### [6.3.4](https://github.com/eea/volto-columns-block/compare/6.3.3...6.3.4) - 29 September 2023

#### :house: Internal changes

- style: lint-staged reorder in package.json [Alin Voinea - [`4c58155`](https://github.com/eea/volto-columns-block/commit/4c58155e5ab792d1aa063c27de9756226269ee77)]
- chore: Remove i18n.js script [Alin Voinea - [`395ac31`](https://github.com/eea/volto-columns-block/commit/395ac31bc7b8bc7c1549617f24b6b5c0636c4464)]

#### :house: Documentation changes

- docs: Update README and DEVELOP [Alin Voinea - [`f080af8`](https://github.com/eea/volto-columns-block/commit/f080af88dd0965fdf47401229a5df237ad1723a8)]
- docs: Update README and DEVELOP [Alin Voinea - [`efb0708`](https://github.com/eea/volto-columns-block/commit/efb0708c878cb0569172af49a94c224f85f408f8)]

#### :hammer_and_wrench: Others

- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`c2c524c`](https://github.com/eea/volto-columns-block/commit/c2c524c764a7565d7aaf61a91279908718fa1772)]
- test: Add cypress test for columns in DX Layout - refs #254894 [Crețu Mihaela - [`44effad`](https://github.com/eea/volto-columns-block/commit/44effada16c61a51338a8f8e3140e35084ef9d5b)]
### [6.3.3](https://github.com/eea/volto-columns-block/compare/6.3.2...6.3.3) - 29 August 2023

#### :rocket: New Features
Expand Down
24 changes: 7 additions & 17 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

1. Go to http://localhost:3000

1. Happy hacking!
1. Initialize git hooks

```Bash
cd src/addons/volto-columns-block/
yarn prepare
```

1. Happy hacking!

### Or add @eeacms/volto-columns-block to your Volto project

Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
Expand All @@ -32,7 +34,7 @@ Before starting make sure your development environment is properly set. See [Vol

1. Create new volto app

yo @plone/volto my-volto-project --addon @eeacms/volto-columns-block --workspace src/addons/volto-columns-block --skip-install
yo @plone/volto my-volto-project --addon @eeacms/volto-columns-block --skip-install
cd my-volto-project

1. Add the following to `mrs.developer.json`:
Expand All @@ -48,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol

1. Install

yarn develop
make develop
yarn

1. Start backend

docker pull plone
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend

...wait for backend to setup and start - `Ready to handle requests`:

docker logs -f plone

...you can also check http://localhost:8080/Plone

1. Start frontend
Expand All @@ -71,15 +70,6 @@ Before starting make sure your development environment is properly set. See [Vol
1. Happy hacking!

cd src/addons/volto-columns-block/
frontend

$ yarn start

1. Go to http://localhost:3000

1. Happy hacking!

$ cd src/addons/volto-columns-block/

## Cypress

Expand Down
66 changes: 45 additions & 21 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ pipeline {

stage('Tests') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
}
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
}
}
}
Expand Down Expand Up @@ -110,11 +116,17 @@ pipeline {

stage('Integration tests') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
}
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
}
}
}
Expand Down Expand Up @@ -167,13 +179,19 @@ pipeline {

stage('Report to SonarQube') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
branch 'master'
allOf {
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
}
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
allOf {
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
}
branch 'master'
}
}
}
Expand All @@ -200,10 +218,16 @@ pipeline {

stage('SonarQube compare to master') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
}
allOf {
environment name: 'CHANGE_ID', value: ''
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
}
}
}
steps {
Expand Down
61 changes: 20 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,12 @@ blocks container.

### Try volto-columns-block with Docker

1. Get the latest Docker images
git clone https://github.com/eea/volto-columns-block.git
cd volto-columns-block
make
make start

```
docker pull plone
docker pull plone/volto
```

1. Start Plone backend

```
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
```

1. Start Volto frontend

```
docker run -it --rm -p 3000:3000 --link plone -e ADDONS="@eeacms/volto-columns-block" plone/volto
```

1. Go to http://localhost:3000
Go to http://localhost:3000

### Add volto-columns-block to your Volto project

Expand All @@ -62,25 +48,25 @@ blocks container.

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-columns-block"
],
```JSON
"addons": [
"@eeacms/volto-columns-block"
],
"dependencies": {
"@eeacms/volto-columns-block": "^4.0.0"
}
```
"dependencies": {
"@eeacms/volto-columns-block": "*"
}
```

- If not, create one:
* If not, create one:

```
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --addon @eeacms/volto-columns-block
cd my-volto-project
```
```
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-columns-block
cd my-volto-project
```

1. Install new add-ons and restart Volto:

Expand Down Expand Up @@ -111,10 +97,3 @@ See [LICENSE.md](https://github.com/eea/volto-columns-block/blob/master/LICENSE.
## Funding

[European Environment Agency (EU)](http://eea.europa.eu)
rved.

See [LICENSE.md](https://github.com/eea/volto-columns-block/blob/master/LICENSE.md) for details.

## Funding

[European Environment Agency (EU)](http://eea.europa.eu)
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
viewportWidth: 1280,
defaultCommandTimeout: 8888,
defaultCommandTimeout: 5000,
chromeWebSecurity: false,
reporter: 'junit',
video: true,
retries: {
runMode: 8,
runMode: 1,
openMode: 0,
},
reporterOptions: {
Expand Down
90 changes: 90 additions & 0 deletions cypress/e2e/02-dexterity-controlpanel-layout.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { slateLayoutBeforeEach, slateLayoutAfterEach } from '../support/e2e';

describe('ControlPanel: Dexterity Content-Types Layout', () => {
beforeEach(slateLayoutBeforeEach);
afterEach(slateLayoutAfterEach);

it('Edit Blocks Layout for Book', () => {
cy.visit('/controlpanel/dexterity-types');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');

cy.get('a[href="/controlpanel/dexterity-types/book"]').should(
'have.text',
'book',
);

cy.visit('/controlpanel/dexterity-types/book/layout');
cy.get('#page-controlpanel-layout').contains(
'Can not edit Layout for book',
);
cy.get('#page-controlpanel-layout button').click();

// Wait a bit for draftjs to load, without this the title block
// custom placeholder is missing and cypress gives a timeout error
cy.wait(1000);
cy.get('input[id="field-placeholder"]').type('Book title');
cy.get('label[for="field-required"]').click();
cy.get('label[for="field-fixed"]').click();

cy.getSlate().click();

cy.get('.ui.basic.icon.button.block-add-button:visible').click();
cy.get('.blocks-chooser .title').contains('Common').click();
cy.get('.content.active.common .button.columnsBlock')
.contains('Columns')
.click({ force: true });
cy.get('.block.inner.columnsBlock .cards .card:nth-child(1)').click();

cy.get('#field-allowedBlocks.react-select-container')
.click()
.type('Image{enter}');
cy.get('#field-allowedBlocks.react-select-container')
.click()
.type('Text{enter}');

cy.get('.columns-block .grid .column:nth-child(1) .block-editor-slate')
.click({ force: true })
.type('Text 1{enter}');

cy.get('#toolbar-save').click();

cy.visit('/cypress');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');

cy.get('button[class="add"]').click();
cy.get('#toolbar-add-book').click();
cy.get('.block.title').contains('Book title');

// Change book title
cy.clearSlateTitle();
cy.getSlateTitle().type('My First Book');
cy.get('.documentFirstHeading').contains('My First Book');

cy.get('.columns-block .grid .column:nth-child(2) .block-editor-slate').click();
cy.get('.ui.basic.icon.button.block-add-button:visible').click();
cy.get('.content.active.mostUsed .button.image')
.contains('Image')
.click({ force: true });

cy.get('.block.image input[type="text"]')
.click()
.type(
'https://eea.github.io/volto-eea-design-system/img/eea_icon.png{enter}',
);

cy.get('#toolbar-save').click();
cy.get('.documentFirstHeading').contains('My First Book');
cy.get('.columns-view .column-grid .column:nth-child(1)').contains('Text 1');
cy.get('.columns-view .column-grid .image img').should(
'have.attr',
'src',
'https://eea.github.io/volto-eea-design-system/img/eea_icon.png',
);
});
});
16 changes: 16 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ export const slateJsonAfterEach = (contentType = 'slate') => {
slateAfterEach();
};

export const slateLayoutBeforeEach = (contentType = 'book') => {
cy.autologin();
cy.addContentType(contentType);
cy.createContent({
contentType: 'Document',
contentId: 'cypress',
contentTitle: 'Cypress',
});
};

export const slateLayoutAfterEach = (contentType = 'book') => {
cy.autologin();
cy.removeContentType(contentType);
cy.removeContent('cypress');
};

export const getSelectedSlateEditor = () => {
return cy.get('.slate-editor.selected [contenteditable=true]').click();
};
Expand Down
Loading

0 comments on commit a787129

Please sign in to comment.