Skip to content

Commit

Permalink
news entry improvement and improved external image cypress test
Browse files Browse the repository at this point in the history
- Correcting the orchid typo from all tests as well
  • Loading branch information
ichim-david committed Aug 1, 2024
1 parent f561e6b commit 9ede06f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
64 changes: 35 additions & 29 deletions packages/volto/cypress/tests/core/blocks/blocks-teaser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ context('Blocks Acceptance Tests', () => {
});

it('As editor I can add a (standalone) Teaser block', () => {
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchidees
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchids
cy.createContent({
contentType: 'Document',
contentId: 'blue-orchidees',
contentTitle: 'Blue Orchidees',
contentId: 'blue-orchids',
contentTitle: 'Blue Orchids',
contentDescription: 'are growing on the mountain tops',
image: true,
path: '/document',
Expand All @@ -35,7 +35,7 @@ context('Blocks Acceptance Tests', () => {
cy.get(
'.objectbrowser-field[aria-labelledby="fieldset-default-field-label-href"] button[aria-label="Open object browser"]',
).click();
cy.get('[aria-label="Select Blue Orchidees"]').dblclick();
cy.get('[aria-label="Select Blue Orchids"]').dblclick();
cy.wait(500);
cy.get('.align-buttons .ui.buttons button[aria-label="Center"]').click();
cy.get('#toolbar-save').click();
Expand All @@ -45,19 +45,19 @@ context('Blocks Acceptance Tests', () => {
cy.get('.block.teaser').should('have.class', 'has--align--center');
cy.get('.block.teaser .image-wrapper img')
.should('have.attr', 'src')
.and('include', '/document/blue-orchidees/@@images/preview_image-');
cy.get('.block.teaser .content h2').contains('Blue Orchidees');
.and('include', '/document/blue-orchids/@@images/preview_image-');
cy.get('.block.teaser .content h2').contains('Blue Orchids');
cy.get('.block.teaser .content p').contains(
'are growing on the mountain tops',
);
});

it('As editor I can add a (standalone) Teaser block that always fetches the live data', () => {
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchidees
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchids
cy.createContent({
contentType: 'Document',
contentId: 'blue-orchidees',
contentTitle: 'Blue Orchidees',
contentId: 'blue-orchids',
contentTitle: 'Blue Orchids',
contentDescription: 'are growing on the mountain tops',
image: true,
path: '/document',
Expand All @@ -73,38 +73,38 @@ context('Blocks Acceptance Tests', () => {
cy.get(
'.objectbrowser-field[aria-labelledby="fieldset-default-field-label-href"] button[aria-label="Open object browser"]',
).click();
cy.get('[aria-label="Select Blue Orchidees"]').dblclick();
cy.get('[aria-label="Select Blue Orchids"]').dblclick();
cy.wait(500);
cy.get('#toolbar-save').click();

cy.visit('/document');
cy.get('.block.teaser .content h2').contains('Blue Orchidees');
cy.get('.block.teaser .content h2').contains('Blue Orchids');
cy.get('.block.teaser .content p').contains(
'are growing on the mountain tops',
);
cy.navigate('/document/blue-orchidees/edit');
cy.navigate('/document/blue-orchids/edit');
cy.wait('@schema');
cy.getSlateTitle().type(' and Tulips');
cy.get('#field-description')
.clear()
.type('are beautifully growing on the mountain tops');
cy.get('#toolbar-save').click();

cy.get('.documentFirstHeading').contains('Blue Orchidees and Tulips');
cy.get('.documentFirstHeading').contains('Blue Orchids and Tulips');
// THEN I can see the updated content in the teaser
cy.navigate('/document');
cy.get('.block.teaser .content h2').contains('Blue Orchidees and Tulips');
cy.get('.block.teaser .content h2').contains('Blue Orchids and Tulips');
cy.get('.block.teaser .content p').contains(
'are beautifully growing on the mountain tops',
);
});

it('As editor I can create a Teaser block and overwrite the data which is is not updated when the target is changed', () => {
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchidees
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchids
cy.createContent({
contentType: 'Document',
contentId: 'blue-orchidees',
contentTitle: 'Blue Orchidees',
contentId: 'blue-orchids',
contentTitle: 'Blue Orchids',
contentDescription: 'are growing on the mountain tops',
image: true,
path: '/document',
Expand All @@ -119,30 +119,30 @@ context('Blocks Acceptance Tests', () => {
cy.get(
'.objectbrowser-field[aria-labelledby="fieldset-default-field-label-href"] button[aria-label="Open object browser"]',
).click();
cy.get('[aria-label="Select Blue Orchidees"]').dblclick();
cy.get('[aria-label="Select Blue Orchids"]').dblclick();
cy.wait(500);
cy.get('label[for="field-overwrite"]').click();
cy.get('#sidebar-properties #field-title').type(' and Tulips');
cy.get('#toolbar-save').click();
cy.visit('/document');
cy.get('.block.teaser .content h2').contains('Blue Orchidees and Tulips');
cy.get('.block.teaser .content h2').contains('Blue Orchids and Tulips');

cy.visit('/document/blue-orchidees/edit');
cy.visit('/document/blue-orchids/edit');
cy.get('.documentFirstHeading').type(' but no Tulips');
cy.get('#toolbar-save').click();
cy.visit('/document/blue-orchidees');
cy.get('.documentFirstHeading').contains('Blue Orchidees but no Tulips');
cy.visit('/document/blue-orchids');
cy.get('.documentFirstHeading').contains('Blue Orchids but no Tulips');
// THEN I still see the overwritten content in the teaser
cy.visit('/document');
cy.get('.block.teaser .content h2').contains('Blue Orchidees and Tulips');
cy.get('.block.teaser .content h2').contains('Blue Orchids and Tulips');
});

it('As editor I can add a Teaser block and override with an external image ', () => {
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchidees
it('As editor I can add a Teaser block and override the data with an external image ', () => {
// GIVEN a Document with the title document and a Document to reference with the title Blue Orchids
cy.createContent({
contentType: 'Document',
contentId: 'blue-orchidees',
contentTitle: 'Blue Orchidees',
contentId: 'blue-orchids',
contentTitle: 'Blue Orchids',
contentDescription: 'are growing on the mountain tops',
image: true,
path: '/document',
Expand All @@ -158,7 +158,7 @@ context('Blocks Acceptance Tests', () => {
cy.get(
'.objectbrowser-field[aria-labelledby="fieldset-default-field-label-href"] button[aria-label="Open object browser"]',
).click();
cy.get('[aria-label="Select Blue Orchidees"]').dblclick();
cy.get('[aria-label="Select Blue Orchids"]').dblclick();
cy.wait(500);
cy.get('input[name="field-overwrite"]').check({ force: true });
cy.get(
Expand All @@ -169,6 +169,12 @@ context('Blocks Acceptance Tests', () => {
`https://github.com/plone/volto/raw/main/logos/volto-colorful.png{enter}`,
);
cy.get('#toolbar-save').click();
cy.get('.image-wrapper > img').should('have.attr', 'src');
cy.get('.image-wrapper > img')
.should('have.attr', 'src')
.and(
'include',
'https://github.com/plone/volto/raw/main/logos/volto-colorful.png',
);
cy.get('.block.teaser .content h2').contains('Blue Orchids');
});
});
2 changes: 1 addition & 1 deletion packages/volto/news/6147.bugfix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix Teaser Block Image Overide- @Tishasoumya-02
Fix `Teaser` block image override option to render external images and internal images pointing to image scales. @Tishasoumya-02

0 comments on commit 9ede06f

Please sign in to comment.