Skip to content

Commit

Permalink
Merge pull request #36 from eea/develop
Browse files Browse the repository at this point in the history
run cypress on slate and draftjs blocks
  • Loading branch information
avoinea authored Nov 22, 2021
2 parents 645810a + 6ef8a9b commit 8dd70f0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ 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).

#### [3.4.8](https://github.com/eea/volto-accordion-block/compare/3.4.7...3.4.8)

- cy: make tests run with both slate and draftjs [`e51f7a5`](https://github.com/eea/volto-accordion-block/commit/e51f7a5c36804240d90e19baa9c7b321e41a7c23)

#### [3.4.7](https://github.com/eea/volto-accordion-block/compare/3.4.6...3.4.7)

> 25 October 2021
- Refs #34 ensure floated images don't spill over next accordion titles [`#35`](https://github.com/eea/volto-accordion-block/pull/35)
- Refs #34 ensure floated images from content area don't spill over next accordion title [`79abc8c`](https://github.com/eea/volto-accordion-block/commit/79abc8c1b13eb26fb78b9dbe53fc2711c02a1ed1)

#### [3.4.6](https://github.com/eea/volto-accordion-block/compare/3.4.5...3.4.6)
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
environment {
GIT_NAME = "volto-accordion-block"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,biodiversity.europa.eu,clms.land.copernicus.eu"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,biodiversity.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu"
DEPENDENCIES = ""
}

Expand Down
22 changes: 17 additions & 5 deletions cypress/integration/blocks-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,26 @@ describe('Blocks Tests', () => {
cy.get('.accordion:nth-child(3) > .title > .icon').click();
cy.wait(500);

// the cypress test is run without slate, but with draftjs
// the cypress test runs with both slate and draftjs.
cy.get('.accordion:nth-child(3) .content')
.first()
.within(() => {
cy.get('.public-DraftStyleDefault-block:nth-child(1)')
.should('have.value', '')
.invoke('attr', 'tabindex', 1)
.type('children', { delay: 50 });
cy.getIfExists(
'.public-DraftStyleDefault-block:nth-child(1)',
() => {
cy.get('.public-DraftStyleDefault-block:nth-child(1)')
.should('have.value', '')
.invoke('attr', 'tabindex', 1)
.type('children', { delay: 50 });
},
() => {
cy.get('div.text-slate-editor-inner')
.should('have.value', '')
.invoke('attr', 'tabindex', 1)
.click()
.type('children', { delay: 50 });
},
);
});

cy.get('#toolbar-save path').click({ force: true });
Expand Down
14 changes: 14 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ function getTextNode(el, match) {
}
}
}
function getIfExists(
selector,
successAction = () => {},
failAction = () => {},
) {
cy.get('div.blocks-form').then((body) => {
if (body.find(selector).length > 0 && successAction) {
successAction();
} else if (failAction) {
failAction();
}
});
}

function setBaseAndExtent(...args) {
const document = args[0].ownerDocument;
Expand All @@ -313,3 +326,4 @@ Cypress.Commands.add('store', () => {
Cypress.Commands.add('settings', (key, value) => {
return cy.window().its('settings');
});
Cypress.Commands.add('getIfExists', getIfExists);
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": "3.4.7",
"version": "3.4.8",
"description": "volto-accordion-block: Volto accordion block",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down

0 comments on commit 8dd70f0

Please sign in to comment.