Skip to content

Commit

Permalink
feat: add cypress test for basic functionality - refs #252543
Browse files Browse the repository at this point in the history
  • Loading branch information
ana-oprea committed Jun 1, 2023
1 parent 1b1c58c commit d4bbe97
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 29 deletions.
29 changes: 0 additions & 29 deletions cypress/e2e/01-block-basics.cy.js

This file was deleted.

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

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

it('Add Block: Video link', () => {
// Intercept cmshare request
cy.intercept('GET', 'https://cmshare.eea.europa.eu//download').as(
'cmshare',
);

// Change page title
cy.clearSlateTitle();
cy.getSlateTitle().type('Volto NextCloud Video Demo');
cy.get('.documentFirstHeading').contains('Volto NextCloud Video Demo');
cy.getSlate().click();

// Add block
cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get(".blocks-chooser .ui.form .field.searchbox input[type='text']").type(
'video (NextCloud)',
);
cy.get('.nextCloudVideo').click();

// Check if error message is not displayed
cy.get('.ui.error.message').should('not.exist');

// Add youtube video link and check if it is valid
cy.get('.block.video .toolbar-inner .ui.input').type(
'https://www.youtube.com/',
);
cy.get('.block.video .toolbar-inner .ui.buttons .ui.basic.primary').click();
cy.get('.ui.error.message').should('exist');

// Delete the link and check if the error message is not displayed
cy.get('.block.video .toolbar-inner .ui.buttons .ui.basic.cancel').click();
cy.get('.ui.error.message').should('not.exist');

// Add cmshare video link and check if it is valid
cy.get('.block.video .toolbar-inner .ui.input').type(
'https://cmshare.eea.europa.eu/',
);
cy.get('.block.video .toolbar-inner .ui.buttons .ui.basic.primary').click();
cy.get('.ui.error.message').should('not.exist');

// Wait for cmshare request
cy.wait('@cmshare');

// Save
cy.get('#toolbar-save').click();
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');

// The page view should contain our changes
cy.contains('Volto NextCloud Video Demo');
cy.get('.block.video');
});
});

0 comments on commit d4bbe97

Please sign in to comment.