diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index 620c5ea125..834aaa810d 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -170,6 +170,22 @@ In your add-ons and projects, we advise you to always use the public components This change improves UX of the Babel view (translation form) since a disabled field cannot be selected to be copied over. +### `volto-slate` Cypress helpers moved to its own module + +There were some Cypress helpers for `volto-slate` along with the other definitions of Cypress commands. +The Cypress command definitions are intended to be loaded only once, whereas the helpers can be imported any number of times. +Therefore, we moved the helpers to its own module: + +```js +import { slateBeforeEach } from '@plone/volto/cypress/support/commands'; +``` + +becomes: + +```js +import { slateBeforeEach } from '@plone/volto/cypress/support/helpers'; +``` + (volto-upgrade-guide-17.x.x)= ## Upgrading to Volto 17.x.x diff --git a/packages/volto/cypress/support/commands.js b/packages/volto/cypress/support/commands.js index c0cdfe97f0..0410029d94 100644 --- a/packages/volto/cypress/support/commands.js +++ b/packages/volto/cypress/support/commands.js @@ -1,4 +1,5 @@ /* eslint-disable no-console */ +import '@testing-library/cypress/add-commands'; import { getIfExists } from '../helpers'; import { ploneAuth } from './constants'; @@ -21,8 +22,6 @@ const ploneAuthObj = { pass: ploneAuth[1], }; -export * from './volto-slate'; - // --- isInViewport ---------------------------------------------------------- Cypress.Commands.add('isInViewport', (element) => { cy.get(element).then(($el) => { diff --git a/packages/volto/cypress/support/helpers.js b/packages/volto/cypress/support/helpers.js new file mode 100644 index 0000000000..046ccce0ac --- /dev/null +++ b/packages/volto/cypress/support/helpers.js @@ -0,0 +1 @@ +export * from './volto-slate'; diff --git a/packages/volto/cypress/tests/core/volto-slate/01-block-slate-title-description.js b/packages/volto/cypress/tests/core/volto-slate/01-block-slate-title-description.js index 6589739022..b37c4ff80b 100644 --- a/packages/volto/cypress/tests/core/volto-slate/01-block-slate-title-description.js +++ b/packages/volto/cypress/tests/core/volto-slate/01-block-slate-title-description.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/02-block-slate.js b/packages/volto/cypress/tests/core/volto-slate/02-block-slate.js index 9cedde19c4..fd795beca7 100644 --- a/packages/volto/cypress/tests/core/volto-slate/02-block-slate.js +++ b/packages/volto/cypress/tests/core/volto-slate/02-block-slate.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/03-block-slate.js b/packages/volto/cypress/tests/core/volto-slate/03-block-slate.js index 4f2cc9baa8..3d4906b1f0 100644 --- a/packages/volto/cypress/tests/core/volto-slate/03-block-slate.js +++ b/packages/volto/cypress/tests/core/volto-slate/03-block-slate.js @@ -1,4 +1,4 @@ -import { slateBeforeEach, getSlateBlockValue } from '../../../support/commands'; +import { slateBeforeEach, getSlateBlockValue } from '../../../support/helpers'; describe('Block Tests', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/04-block-focus.js b/packages/volto/cypress/tests/core/volto-slate/04-block-focus.js index b30bbe16c1..edd4e200dd 100644 --- a/packages/volto/cypress/tests/core/volto-slate/04-block-focus.js +++ b/packages/volto/cypress/tests/core/volto-slate/04-block-focus.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/05-block-slate-format-basics.js b/packages/volto/cypress/tests/core/volto-slate/05-block-slate-format-basics.js index 4bcd4c66de..b80620c59a 100644 --- a/packages/volto/cypress/tests/core/volto-slate/05-block-slate-format-basics.js +++ b/packages/volto/cypress/tests/core/volto-slate/05-block-slate-format-basics.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: Basic text format', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/06-block-slate-format-link.js b/packages/volto/cypress/tests/core/volto-slate/06-block-slate-format-link.js index 84466f323d..08866b263b 100644 --- a/packages/volto/cypress/tests/core/volto-slate/06-block-slate-format-link.js +++ b/packages/volto/cypress/tests/core/volto-slate/06-block-slate-format-link.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: Links', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/07-block-slate-format-ulist.js b/packages/volto/cypress/tests/core/volto-slate/07-block-slate-format-ulist.js index 10cb24ed6d..02f8b85629 100644 --- a/packages/volto/cypress/tests/core/volto-slate/07-block-slate-format-ulist.js +++ b/packages/volto/cypress/tests/core/volto-slate/07-block-slate-format-ulist.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: Bulleted lists', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/08-block-slate-format-olist.js b/packages/volto/cypress/tests/core/volto-slate/08-block-slate-format-olist.js index be763871f4..1e62db98f6 100644 --- a/packages/volto/cypress/tests/core/volto-slate/08-block-slate-format-olist.js +++ b/packages/volto/cypress/tests/core/volto-slate/08-block-slate-format-olist.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: Numbered lists', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/09-block-slate-slashmenu.js b/packages/volto/cypress/tests/core/volto-slate/09-block-slate-slashmenu.js index b421870eba..e5862d441d 100644 --- a/packages/volto/cypress/tests/core/volto-slate/09-block-slate-slashmenu.js +++ b/packages/volto/cypress/tests/core/volto-slate/09-block-slate-slashmenu.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('SlashMenu Test: Shortcuts', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/24-block-slate-format-boldlists.js b/packages/volto/cypress/tests/core/volto-slate/24-block-slate-format-boldlists.js index c6b55806ad..8dc4e9aca8 100644 --- a/packages/volto/cypress/tests/core/volto-slate/24-block-slate-format-boldlists.js +++ b/packages/volto/cypress/tests/core/volto-slate/24-block-slate-format-boldlists.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: Bold Bulleted lists', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/25-block-slate-paste-images.js b/packages/volto/cypress/tests/core/volto-slate/25-block-slate-paste-images.js index 262c731424..7d4dc9a89c 100644 --- a/packages/volto/cypress/tests/core/volto-slate/25-block-slate-paste-images.js +++ b/packages/volto/cypress/tests/core/volto-slate/25-block-slate-paste-images.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: paste external images', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/27-block-slate-paste-html.js b/packages/volto/cypress/tests/core/volto-slate/27-block-slate-paste-html.js index e0f69fac04..0f657a5825 100644 --- a/packages/volto/cypress/tests/core/volto-slate/27-block-slate-paste-html.js +++ b/packages/volto/cypress/tests/core/volto-slate/27-block-slate-paste-html.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: external text containing html contents/tags ', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/cypress/tests/core/volto-slate/28-table-block-slate-paste.js b/packages/volto/cypress/tests/core/volto-slate/28-table-block-slate-paste.js index a07f9a62b6..72de3f313e 100644 --- a/packages/volto/cypress/tests/core/volto-slate/28-table-block-slate-paste.js +++ b/packages/volto/cypress/tests/core/volto-slate/28-table-block-slate-paste.js @@ -1,4 +1,4 @@ -import { slateBeforeEach } from '../../../support/commands'; +import { slateBeforeEach } from '../../../support/helpers'; describe('Block Tests: pasting content in table block', () => { beforeEach(slateBeforeEach); diff --git a/packages/volto/news/5906.internal b/packages/volto/news/5906.internal new file mode 100644 index 0000000000..988b2eab42 --- /dev/null +++ b/packages/volto/news/5906.internal @@ -0,0 +1 @@ +Move `testing-library` Cypress commands import to inner commands, so it can be imported from the outside. @sneridagh