Skip to content

Commit

Permalink
Merge pull request #22 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Oct 6, 2023
2 parents 985a001 + da9e5fc commit a66b139
Show file tree
Hide file tree
Showing 12 changed files with 613 additions and 72 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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ 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).

### [1.2.3](https://github.com/eea/volto-quote-block/compare/1.2.2...1.2.3) - 5 October 2023

#### :house: Internal changes

- style: lint-staged reorder in package.json [Alin Voinea - [`af8d474`](https://github.com/eea/volto-quote-block/commit/af8d4747199e2b4c26b402f5b4bf81d361075b0b)]

#### :house: Documentation changes

- docs: Update README and DEVELOP [Alin Voinea - [`a0d3975`](https://github.com/eea/volto-quote-block/commit/a0d3975825e97accb32bf1308c11b3905b32fb81)]
- docs: Update README and DEVELOP [Alin Voinea - [`57a6323`](https://github.com/eea/volto-quote-block/commit/57a6323d9b37888fa953e5fdf0d9b1c2b5c8eca7)]

#### :hammer_and_wrench: Others

- test: add unit tests - refs #254313 [ana-oprea - [`685bbe3`](https://github.com/eea/volto-quote-block/commit/685bbe3bbd98e2cc840be5bba6529c495403b97a)]
- test: change volto version in Jenkinsfile [ana-oprea - [`d72433a`](https://github.com/eea/volto-quote-block/commit/d72433a88b523b20b89a17c1611771b429987f55)]
- test: increase cypress timeout [ana-oprea - [`acfc0ca`](https://github.com/eea/volto-quote-block/commit/acfc0ca8be505d0c84002f1d2e144ce6ef7cfc93)]
- test: Add cypress test for quote block in DX Layout - refs #254894 [Crețu Mihaela - [`5f4d40c`](https://github.com/eea/volto-quote-block/commit/5f4d40c75077faff9c2f8803ed3db15fbc16ed85)]
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`26aeb5f`](https://github.com/eea/volto-quote-block/commit/26aeb5f9df5217c595e44d73747bea72470036f1)]
### [1.2.2](https://github.com/eea/volto-quote-block/compare/1.2.1...1.2.2) - 30 August 2023

#### :house: Documentation changes
Expand Down
14 changes: 6 additions & 8 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-quote-block/
yarn prepare
```

1. Happy hacking!

### Or add @eeacms/volto-quote-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 @@ -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,7 +70,6 @@ Before starting make sure your development environment is properly set. See [Vol
1. Happy hacking!

cd src/addons/volto-quote-block/
o-addon-template/

## Cypress

Expand Down
68 changes: 46 additions & 22 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline {
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,forest.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,biodiversity.europa.eu,climate-adapt.eea.europa.eu,climate-energy.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-ims,www.eea.europa.eu-en,industry.eea.europa.eu,water.europa.eu-freshwater"
DEPENDENCIES = ""
VOLTO = ""
VOLTO = "16"
}

stages {
Expand Down 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 @@ -199,10 +217,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
59 changes: 20 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,12 @@

### Try volto-quote-block with Docker

1. Get the latest Docker images
git clone https://github.com/eea/volto-quote-block.git
cd volto-quote-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-quote-block" plone/volto
```

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

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

Expand All @@ -55,25 +41,25 @@

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-quote-block"
],
```JSON
"addons": [
"@eeacms/volto-quote-block"
],

"dependencies": {
"@eeacms/volto-quote-block": "^1.0.0"
}
```
"dependencies": {
"@eeacms/volto-quote-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-quote-block
cd my-volto-project
```
```
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-quote-block
cd my-volto-project
```

1. Install new add-ons and restart Volto:

Expand Down Expand Up @@ -104,8 +90,3 @@ See [LICENSE.md](https://github.com/eea/volto-quote-block/blob/master/LICENSE.md
## Funding

[European Environment Agency (EU)](http://eea.europa.eu)
/LICENSE.md) for details.

## Funding

[European Environment Agency (EU)](http://eea.europa.eu)
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = defineConfig({
reporter: 'junit',
video: true,
retries: {
runMode: 8,
runMode: 1,
openMode: 0,
},
reporterOptions: {
Expand Down
93 changes: 93 additions & 0 deletions cypress/e2e/02-dexterity-controlpanel-layout.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
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();

// Add quote block with default variation
cy.get('.ui.basic.icon.button.block-add-button:visible').click();
cy.get('.blocks-chooser .title').contains('Text').click();
cy.get('.content.active.text .button.quote')
.contains('Quote')
.click({ force: true });

// Add quote block with testimonial quote variation
cy.getSlate().click();
cy.get('.ui.basic.icon.button.block-add-button:visible').click();
cy.get('.blocks-chooser .title').contains('Text').click();
cy.get('.content.active.text .button.quote')
.contains('Quote')
.click({ force: true });
cy.get('#sidebar .formtabs').contains('Block').click();
cy.get('.form .react-select-container').click();
cy.get('.react-select__menu').contains('Testimonial quote').click();

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');
cy.get('.block-editor-quote').should('have.length', 2);

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

cy.get('.block.quote:nth(1) div[role="textbox"]')
.click()
.type('My default quote');
cy.get('.block.quote:nth(2) div[role="textbox"]')
.click()
.type('My testimonial quote');
cy.get('.form .field-wrapper-image .input input')
.click()
.type(
'https://eea.github.io/volto-eea-design-system/img/eea_icon.png{enter}',
);
cy.get('.form .field-wrapper-image .buttons .primary .icon').click();

cy.get('#toolbar-save').click();
cy.get('.documentFirstHeading').contains('My First Book');
cy.get('.block-editor-quote').contains('My default quote');
cy.get('.block-editor-quote').contains('My testimonial quote');
cy.get('.testimonial .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 a66b139

Please sign in to comment.