generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cypress): Cypress 10 / Razzle 4
- Loading branch information
Showing
27 changed files
with
3,638 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { slateBeforeEach, slateAfterEach } from '../support/e2e'; | ||
|
||
describe('Blocks Tests', () => { | ||
beforeEach(slateBeforeEach); | ||
afterEach(slateAfterEach); | ||
|
||
it('Add Block: Empty', () => { | ||
// Change page title | ||
cy.clearSlateTitle(); | ||
cy.getSlateTitle().type('My Add-on Page'); | ||
|
||
cy.get('.documentFirstHeading').contains('My Add-on Page'); | ||
|
||
cy.getSlate().click(); | ||
|
||
// Add block | ||
cy.get('.ui.basic.icon.button.block-add-button').first().click(); | ||
cy.get('.blocks-chooser .title').contains('Media').click(); | ||
cy.get('.content.active.media .button.image').contains('Image').click(); | ||
|
||
// Save | ||
cy.get('#toolbar-save').click(); | ||
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); | ||
|
||
// then the page view should contain our changes | ||
cy.contains('My Add-on Page'); | ||
cy.get('.block.image'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { slateBeforeEach, slateAfterEach } from '../support/e2e'; | ||
|
||
describe('Blocks Tests', () => { | ||
beforeEach(slateBeforeEach); | ||
afterEach(slateAfterEach); | ||
|
||
it('Add Block: Empty', () => { | ||
// Change page title | ||
cy.clearSlateTitle(); | ||
cy.getSlateTitle().type('My Add-on Page'); | ||
|
||
cy.get('.documentFirstHeading').contains('My Add-on Page'); | ||
|
||
cy.getSlate().click(); | ||
|
||
// Add block | ||
cy.get('.ui.basic.icon.button.block-add-button').first().click(); | ||
cy.get('.blocks-chooser .title').contains('Common').click(); | ||
cy.get('.content.active.common .button.columnsBlock') | ||
.contains('Columns') | ||
.click({ force: true }); | ||
|
||
cy.get('.columns-block .ui.card').eq(2).click(); | ||
cy.get('.field-wrapper-title #field-title').last().type('Column test'); | ||
cy.get('.field-wrapper-data .columns-area button').last().click(); | ||
|
||
cy.get('.columns-area .drag.handle.wrapper') | ||
.first() | ||
.trigger('mousedown', { which: 1 }, { force: true }) | ||
.trigger('mousemove', 0, 60, { force: true }) | ||
.trigger('mouseup'); | ||
|
||
cy.get('.field-wrapper-gridCols #field-gridCols').click(); | ||
cy.get('.react-select__menu').contains('25').click(); | ||
|
||
cy.get('[contenteditable=true]').first().focus().click(); | ||
cy.get('.columns-block [contenteditable=true]') | ||
.eq(0) | ||
.focus() | ||
.click() | ||
.type('First'); | ||
cy.get('.columns-block [contenteditable=true]') | ||
.eq(1) | ||
.focus() | ||
.click() | ||
.type('Second'); | ||
cy.get('.columns-block [contenteditable=true]') | ||
.eq(2) | ||
.focus() | ||
.click() | ||
.type('Third'); | ||
cy.get('.block-toolbar button').eq(1).click(); | ||
|
||
cy.get( | ||
'.field-wrapper-grid_vertical_align #field-grid_vertical_align', | ||
).click(); | ||
cy.get('.react-select__menu').contains('Middle').click(); | ||
cy.get('.field-wrapper-backgroundColor .ui.huge.button').click(); | ||
cy.get('.github-picker.color-picker span').eq(3).click(); | ||
|
||
// Save | ||
cy.get('#toolbar-save').click(); | ||
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); | ||
|
||
// then the page view should contain our changes | ||
cy.contains('My Add-on Page'); | ||
cy.contains('First'); | ||
cy.contains('Second'); | ||
cy.contains('Third'); | ||
cy.get('.columns-view'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { slateBeforeEach, slateAfterEach } from '../support/e2e'; | ||
|
||
describe('Blocks Tests', () => { | ||
beforeEach(slateBeforeEach); | ||
afterEach(slateAfterEach); | ||
|
||
it('Add Block: Empty', () => { | ||
// Change page title | ||
cy.clearSlateTitle(); | ||
cy.getSlateTitle().type('My Add-on Page'); | ||
|
||
cy.get('.documentFirstHeading').contains('My Add-on Page'); | ||
|
||
cy.getSlate().click(); | ||
|
||
// Add block | ||
cy.get('.ui.basic.icon.button.block-add-button').first().click(); | ||
cy.get('.blocks-chooser .title').contains('Common').click(); | ||
cy.get('.content.active.common .button.group') | ||
.contains('Section (Group)') | ||
.click({ force: true }); | ||
|
||
cy.get('.block-editor-group [contenteditable=true]') | ||
.focus() | ||
.click() | ||
.type('test{enter}'); | ||
cy.get('.block-editor-group [contenteditable=true]') | ||
.eq(1) | ||
.focus() | ||
.click() | ||
.type('test2{enter}'); | ||
cy.get('.block-editor-group [contenteditable=true]') | ||
.eq(2) | ||
.focus() | ||
.click() | ||
.type('test3'); | ||
|
||
cy.get('.block-toolbar svg') | ||
.first() | ||
.trigger('mousedown', { button: 0 }) | ||
.trigger('mousemove', 10, -40, { force: true }) | ||
.trigger('mouseup', 10, -40, { force: true }); | ||
|
||
// Save | ||
cy.get('#toolbar-save').click(); | ||
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); | ||
|
||
// then the page view should contain our changes | ||
cy.contains('My Add-on Page'); | ||
cy.contains('test2'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { slateBeforeEach, slateAfterEach } from '../support/e2e'; | ||
|
||
describe('Block Tests: Metadata', () => { | ||
beforeEach(slateBeforeEach); | ||
afterEach(slateAfterEach); | ||
|
||
it('As editor I can add metadata mentions', function () { | ||
// Complete chained commands | ||
cy.getSlateEditorAndType('Colorless green ideas sleep furiously.'); | ||
|
||
// Metadata mention | ||
cy.setSlateSelection('Colorless', 'green'); | ||
cy.clickSlateButton('Metadata'); | ||
|
||
cy.get('.sidebar-container div[id="field-metadata"]') | ||
.type('Publishing Date{enter}'); | ||
cy.get('.sidebar-container .form .header button:first-of-type').click(); | ||
|
||
// Remove link | ||
cy.setSlateSelection('Colorless') | ||
.setSlateSelection('green'); | ||
cy.clickSlateButton('Remove metadata'); | ||
|
||
// Re-add link | ||
cy.setSlateSelection('green', 'sleep'); | ||
cy.clickSlateButton('Metadata'); | ||
|
||
cy.get('.sidebar-container div[id="field-metadata"]') | ||
.type('Summary{enter}'); | ||
cy.get('.sidebar-container [id="blockform-fieldset-metadata"] [id="field-description"]') | ||
.type('blue cats sleep'); | ||
cy.get('.sidebar-container .form .header button:first-of-type').click(); | ||
|
||
// Save | ||
cy.toolbarSave(); | ||
|
||
// then the page view should contain a link | ||
cy.contains('Colorless blue cats sleep furiously.'); | ||
}); | ||
}); |
Oops, something went wrong.