Skip to content

Commit

Permalink
test: Add cypress test for basic functionality and demo gif to README…
Browse files Browse the repository at this point in the history
… - refs #253277
  • Loading branch information
ana-oprea committed Jun 9, 2023
1 parent 66e4928 commit 5afd16a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 29 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
## Features

![Timeline Block](https://github.com/eea/volto-timeline-block/raw/develop/docs/timeline-block.png)
![Timeline Block Demo](https://github.com/eea/volto-timeline-block/raw/docs/docs/volto-timeline.gif)


## Getting started

Expand Down
29 changes: 0 additions & 29 deletions cypress/e2e/01-block-basics.cy.js

This file was deleted.

59 changes: 59 additions & 0 deletions cypress/e2e/01-timeline-block-basics.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { slateBeforeEach, slateAfterEach } from '../support/e2e';

describe('Blocks Tests', () => {
beforeEach(slateBeforeEach);
afterEach(slateAfterEach);

it('Add Block: Timeline', () => {
// Change page title
cy.clearSlateTitle();
cy.getSlateTitle().type('Volto Timeline Block Demo');

cy.get('.documentFirstHeading').contains('Volto Timeline Block Demo');

cy.getSlate().click();

// Add block
cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get('.blocks-chooser .title').contains('Common').click({ force: true });
cy.get('.content.active.common .button.timeline_block')
.contains('Timeline')
.click({ force: true });

// Add timeline item
cy.get('.button').contains('Add Timeline item').click();
cy.get('.DateInput.DateInput_1 input[name="datetime-0-items-0-date"]').type(
'05/19/2023',
);
cy.get('input#field-title-1-items-0').type('Test Title');
cy.get('input#field-description-2-items-0').type('Test Description');
cy.get('div#field-color-4-items-0').click();
cy.get('div#field-color-4-items-0').contains('Orange').click();
cy.get('label[for="field-hideTime"]').click();

// Add another timeline item
cy.get('.button').contains('Add Timeline item').click();
cy.get('.DateInput.DateInput_1 input[name="datetime-0-items-1-date"]').type(
'05/22/2023',
);
cy.get('input#field-title-1-items-1').type('Test Title 2');
cy.get('input#field-description-2-items-1').type('Test Description 2');
cy.get('div#field-color-4-items-1').click();
cy.get('div#field-color-4-items-1').contains('Yellow').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('Volto Timeline Block Demo');
cy.get('.timeline');
cy.get('.timeline .header').contains('Test Title');
cy.get('.timeline .description').contains('Test Description');
cy.get('.timeline .content .orange').contains('May 19, 2023');

cy.get('.timeline .header').contains('Test Title 2');
cy.get('.timeline .description').contains('Test Description 2');
cy.get('.timeline .content .yellow').contains('May 22, 2023');
});
});
Binary file added docs/volto-timeline.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5afd16a

Please sign in to comment.